Research Article

Tree-Based Multihop Routing Method for Energy Efficiency of Wireless Sensor Networks

Pseudocode 2

For MHRA-PT Algorithm.
MHRA-PT algorithm
1. Initialization, get(Node set) and (Maximum number of rounds of the algorithm)
2.
3. 
4.    //If the nodeis selected as cluster head
5.     //The nodejoins(Cluster head set)
6.  
7.     //The nodejoins(Non-cluster head set)
8.  
9. 
10.    //is any cluster set in the network
11.     //If the nodeis selected as working node
12.      //The nodejoins(working node set)
13.  
14.     //The nodejoins(Sleep node set)
15.  
16. 
17. Construct sorted cluster head set //represents thecluster head
18. 
19.     //Ifis the first cluster head of the set
20.     //is regarded as the parent node of
21.     //Ifis not the first cluster head of the set
22.  Calculate weight of path   //represents theoptional parent node of
23.  //is regarded as the parent node of
24.  Determine whether needs to replace the parent node according to equ.(21)
25.  
26. 
27. Perform data transfer
28.