| Algorithm 2. Maximum Data Greedy Scheduling and the Maximum Remaining Energy Routing Algorithm. | |
| 1: | Initialize: The complete list N of sensor nodes and the number of sensor nodes n, the list D of demand nodes, the quantity of data DD that must be transmitted, and the number of demand nodes ndn, list S of support nodes, the quantity of data SD available for support, and the number of support nodes nsn. |
| 2: | Sort D according to DD and S according to SD in descending order |
| 3: | If ndn > 0, nsn > 0 and support nodes exist within a three- or four-jump distance, then |
| 4: | For each Di, I ∈ ndn and Sj, j ∈ nsn, do |
| 5: | If Di and Sj lie within three or four jumps distance, then |
| 6: | If DDi ≥ SDj then |
| 7: | DDi = DDi − SDj |
| 8: | SDj = 0 |
| 9: | Else |
| 10: | DDi = 0 |
| 11: | SDj = SDj − DDi |
| 12: | End if |
| 13: | Find all routes from Di to Sj |
| 14: | Select the route having the greatest remaining energy |
| 15: | Record the route and the amount of data transmitted |
| 16: | End if |
| 17: | End for |
| 18: | End if |