Skip to main content
. 2018 Feb 28;18(3):724. doi: 10.3390/s18030724
Algorithm 3. Our proposed algorithm.
Input: G(V,E)
Output: Tree{1,2,…M}, Optr
1 randomly select M sensor nodes g1,g2,…,gM in the network probability MN, generate Φ
2 for i=1:M
3   query candidate nodes Cani(ϕij≠0) of projection nodes i
4   initialization Treei←i, tempi←i
5   while !empty(temp) do
6     CanNode←Del(temp)
7     if CanNode is i’s candidate node
8      Tree←CanNode
9      temp←CanNode
10     Del(Inti,CanNode)
11    end if
12   end while
13  while !empty(Cani) do
14    for all residual candidate nodes r∈Cani
15    Path(r)← find a shortest path to Treei using the Dijkstra algorithm
16      if shortestpath > Path(r)
17         shortestpath←Path(r)
18      end if
19    end for
20   Tree←shortestpath
21   temp←shortestpath
22   Del(Cani,shortestpath)
23   while !empty(temp) do
24   go back to steps 7–11
25   end while
26  end while
27 Optr← Optimal routing from i to the sink node using Algorithm 2
28  return Tree{1,2,…M}
29 end for