## 4 Our Proposed Algorithm
### A Novel Data-Gathering Scheme with Joint Routing and CS
The modified ant colony algorithm jointly considers the sensor node's residual energy and the path length, which will not only balance the whole network load, avoiding nodes near the sink node dying earlier, but will prolong the network lifetime. In this way, the transmission costs should be greatly decreased compared to hybrid CS. Figure 10 is taken as an example to describe the details of Algorithm 3. It can be seen from Figure 10 that the thick circle indicates a projection node, the thin circle is a sensor node, the arc with an arrow represents the routing from the projection node to the sink node, and the dashed line, solid line, dotted and dashed line, and thick line describe four different projection routings. Sensor nodes 6, 12, 26, and 39 are chosen as projection nodes in the networks. Suppose that node 39 is the projection node in projection 4 routing, which has non-zero coefficients 9, 11, 20, 28, 31, 32, 33, 34, 35, 38, 39 of row vector \(\phi_{4}\) in the measurement matrix. Here, projection node 39 wants to establish a tree using Algorithm 3. Above all, node 39 considers itself a tree with only one node. Select its neighbor nodes 33 and 34, which can be directly coupled with node 39 by a single hop in the following step. Next, node 33 retrieves candidate node 32 as its neighbor node, so node 32 is added to the tree, while node 34 finds node 28 is also its neighbor node; similarly, node 28 is involved in the tree. However, in the coming stage, there are no candidate nodes directly connected with the tree. Therefore, the \(Dijkstra\) algorithm is utilized to find the shortest path from the residual candidate nodes to the generated tree. Then nodes 31 and 38 are all joined to the tree, and nodes 35 and 36 are linked to node 28 by the shortest path. Again, nodes 20, 9, and 11 are involved in the tree using the MST algorithm. Finally, node 39 queries an optimal routing to the sink node for the projection node 39, which is \(39\to 33\to 25\to 18\to 8\to Sink\), rather than \(39\to 19\to 26\to 11\to 2\to Sink\) using the \(Dijkstra\) algorithm. The reason is that the modified ant colony chooses the next hop considering not only residual energy but also path length. So, node 33 chooses node 25, which has more residual energy compared with node 19. The same reasoning is applied to node 25 and node 18. Node 1 near the sink node forwards data many times from the other nodes, leading to considerable energy reduction. Therefore, in order to ease the burden on the network, node 8 chooses a direct path to the sink node, instead of node 1, although node 1 is actually the shortest path. Similarly, the routing constructed in projections 1, 2, and 3 is shown in Figure 10. At the sink node, sensor signal reconstruction is implemented by Algorithm 4. In the process of the sensor signal, the gOMP [28] recovery algorithm is utilized, where \(r_{it}\) denotes residual error, \(it\) is iteration. \(\varnothing\) represents the null set, \(a^{\prime}_{j}\) is \(jth\) of \(A\). \(\Lambda_{it}\) denotes the sets of indexes of \(it\) iteration. ```
Input:\(G(V,E)\) Output:\(Tree\{1,2,\ldots M\}\), \(Optr\)
1 randomly select \(M\) sensor nodes \(g_{1},g_{2},\ldots,g_{M}\) in the network probability \(\frac{M}{N}\), generate \(\Phi\)
2 for\(i=1:M\)
3 query candidate nodes \(Can_{i}(\phi_{ij}\
eq 0)\) of projection nodes \(i\)
4 initialization \(Tree_{i}\gets i\), \(temp_{i}\gets i\)
5 while!empty(temp)do
6\(CanNode\leftarrow Del(temp)\)
7 ifCanNode is!\(i\)'s candidate node
8\(Tree\leftarrow CanNode\)
9\(temp\gets CanNode\)
10\(Del(Int_{i},CanNode)\)
11 endif
12 endwhile
13 while!empty(\(Can_{i}\))do
14 forall residual candidate nodes \(r\in Can_{i}\)
15\(Path(r)\leftarrow\) find a shortest path to \(Tree_{i}\) using the \(Dijkstra\) algorithm
16 ifshortestpath\(>Path(r)\)
17\(shortestpath\gets Path(r)\)
```  
**Algorithm 3** Our proposed algorithm.