Skip to main content
. 2020 Jul 23;20(15):4095. doi: 10.3390/s20154095
Algorithm 1: EERS pseudo-code for reference node selection (sink node only)
Initial:,CoverNodesFlagfalse,cnt 0, k0, SeqN0
1. ssink node
2. RefNodes(1)s
3. Schslot(1)0
4. CoverNodesFlag(s)true
5. Compute the hop distance from s and the level to every node (i.e., using BFS)
6. while (k !=LevelMax1) do//LevelMax is equal to the level of the farthest node from sink node
7.    for (every edge (i,j)E, iNk,jNk+1  ) do
8.      detrmine di,j
9.    end for
10.    while (CoverNodesFlag(Nk+1) !=true) do
11.       RNk(max(di,j))
12.       RefNodes(cnt)R
13.       SchSlots(cnt)cnt
14.      CoverNodesFlag(m) true  // (m Nk+1) are the neighbor nodes of R
15.       cntcnt+1
16.    end while
17. kk+1
18. end while
19. SeqNSeqN+1
20. brodcast refernces scheduling message <RefNodes,SchSlots, SeqN>