Research Article
Efficient Data Collection Method in Sensor Networks
| Function: Randomly select the next node in the random path | | Input: Current node v | | Output: Next node u | | Algorithm Description: | (1) | SNS = getSNS(); //Obtain the neighbor node set SNS | (2) | u = randSelect(SNS); //Randomly select node u from SNS | (3) | while u exists in Route do | (4) | u = randSelect(SNS); | (5) | end while | (6) | xu (t) = (t − 1) + xu (t − 1); //Superimposing node’s data | (7) | Route.length = Route.length + 1; //Increase 1 to the length of random path | (8) | u.flag = 1; //Mark u as accessed | (9) | return u; //Return to u |
|