Skip to main content
. 2020 Oct 16;20(20):5858. doi: 10.3390/s20205858
Algorithm 1 Cluster Tree-Based Routing Algorithm
Input: Coordinates of Node “N
Output: Number of CH node
Cluster Formation:
1: Calculate the distance between the nodes.
dist=(xjxi)2+(yjyi)2
2: Compute the distance matrix for all the nodes.
dist=0t1,2t1,n0 tn,1tn,20
3: Calculate the centroid of the network nodes
centroid((xiyi), (xjyj))= (xi+xj2,yi+yj2)
4: Generate the cluster in the network from Equation (7).
5: Calculate the total number of clusters C
C=i=1xcount(centroidxi,yi)
6: Obtain a set of “C” clusters.
CH Selection:
7: Compute ERER and Edep of nodes in the cluster.
8: Compute the payoff “p” value for each CM
pCMij=Rij×RERCMj  Pij×EdepCMj+RNCMi,jCH.
9: Compute the Nash equilibrium for deciding the CH node in the cluster
CHi=maxi=1 tokp(CMi)
10: Obtain the optimum CH node.
Route Establishment:
11: Compute the DIOC-ETX, DIOC-QU, DIOC-RER, and DIOC-CHNC from the parent CH node.
12: Calculate the quality of the CH parent node using the objective function
OFQU,ETXi=w1×QUi+w2×ETXi+w1×RERi+w2×CHNCi
13: Compute the rank for selecting best CH parent node.
CHr X=rp X+ri 
ri = sv +rmin 
14: Return the best CH parent node.