| Algorithm 3. Maximum Data Greedy Scheduling and the Diffusion Route Finding 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, the list S of support nodes, the quantity of data transmission SD available for support, and the number of support nodes nsn. |
| 2: | While ndn > 0 and nsn > 0, do |
| 3: | Sort D according to DD and S according to SD in descending order |
| 4: | If DDl ≥ SDl, then |
| 5: | DDl = DDl − SDl |
| 6: | SDl = 0 |
| 7: | nsn = nsn − 1 |
| 8: | Else |
| 9: | DDl = 0 |
| 10: | SDl = SDl − DDl |
| 11: | ndn = ndn − 1 |
| 12: | End if |
| 13: | While Sl has not been found, then |
| 14: | For all nodes lying one more jump away from Dl, do |
| 15: | If Sl is found in these nodes, then |
| 16: | Record the route |
| 17: | Break |
| 18: | End if |
| 19: | End for |
| 20: | End while |
| 21: | End while |