Skip to main content
. 2015 Mar 5;15(3):5474–5503. doi: 10.3390/s150305474
Algorithm 3. Head_Selection (), implemented in member nodes, selects the closest SH based on the rank calculated using Equation (22).
Input: rank, SHInfo
1:    sort SHInfo in descending order based on rank
2:    create network layer packet joinCntrlPacket
3:     SHDpop top element from SHInfo.SHS
4:     set SELF_NET_ADDR as source, SHD as destination and Packet Type = 4 to joinCntrlPacket
5:     //Unicast joining request to the closest head node.
6:     toMacLayer (joinCntrlPacket, SHD)