Research Article
Efficient Data Collection Method in Sensor Networks
Algorithm 3
Efficient data gathering algorithm.
| 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) | length = SNS.length; //Obtain the length of unmarked node in SNS | (3) | totle = 0; | (4) | foreach node p in SNS | (5) | if P not exists in Route then | (6) | P(, p) = getPSet(p); | (7) | totle = totle + P(, p).length; | (8) | end if | (9) | end foreach | (10) | average = totle/length; | (11) | foreach node k in SNS | (12) | if k not exists in Route and getPSet(k).length average then | (13) | tempSNS.add(k); | (14) | end if | (15) | end foreach | (16) | u = randSelect(tempSNS); //Randomly select node u from tempSNS | (17) | xu (t) = (t − 1) + xu (t − 1); //Superimposing node’s data | (18) | Route.length = Route.length + 1; //Increase 1 to the length of random path | (19) | u.flag = 1; //Mark u as accessed | (20) | return u; //Return to u |
|