Method for determining a cost of a link between a first electronic device and a second electronic device for a routing protocol of a mesh communication network comprising said electronic devices, the first electronic device comprising, associated with the second electronic device, a first and a second operating mode, the method being executed by the first electronic device and comprising the steps of: - receiving, from the second electronic device, a first message to determine a route between two electronic devices of the communication network, - determining a first cost of the link in accordance with a measurement of a quality of reception of the first message, - determining the operating mode of the first electronic device associated with the second electronic device, and, - when the first electronic device is in the first operating mode, then: - sending, to the second electronic device, a second message comprising an instruction for the second electronic device to measure a quality of reception of said second message in order to determine a second cost of the link, and - receiving, from the second electronic device, a third message, the third message comprising the second cost of the link, - determining the cost of the link in accordance with the first cost and with the second cost, - or, when the first electronic device is in the second operating mode, determining the cost of the link as being equal to the first cost of the link, the method being characterized in that it comprises a step of selecting the operating mode associated with the second electronic device, said selection step being executed by the first electronic device autonomously in accordance with one or more criteria determined by the first electronic device from among: - a number of errors in the transmission of messages to the second electronic device, - a characteristic of the second electronic device, and - a comparison between a measurement of the quality of reception of a message and quality information determined in accordance with a parameter of said message. - receiving, from the second electronic device, a first message to determine a route between two electronic devices of the communication network, - determining a first cost of the link in accordance with a measurement of a quality of reception of the first message, - determining the operating mode of the first electronic device associated with the second electronic device, and, - when the first electronic device is in the first operating mode, then: - sending, to the second electronic device, a second message comprising an instruction for the second electronic device to measure a quality of reception of said second message in order to determine a second cost of the link, and - receiving, from the second electronic device, a third message, the third message comprising the second cost of the link, - determining the cost of the link in accordance with the first cost and with the second cost, - sending, to the second electronic device, a second message comprising an instruction for the second electronic device to measure a quality of reception of said second message in order to determine a second cost of the link, and - receiving, from the second electronic device, a third message, the third message comprising the second cost of the link, - determining the cost of the link in accordance with the first cost and with the second cost, - or, when the first electronic device is in the second operating mode, determining the cost of the link as being equal to the first cost of the link, - a number of errors in the transmission of messages to the second electronic device, - a characteristic of the second electronic device, and - a comparison between a measurement of the quality of reception of a message and quality information determined in accordance with a parameter of said message.