| Input: a data aggregation tree and threshold , |
| /* be vertex set in tree , be depth of the tree , be stage number */ |
| Output: A maximal independent dominating set |
| Let denote the dominating set constructed at stage and be initially set to null |
| (1) begin |
| (2) |
| (3) While |
| (4) Choose a vertex |
| (5) |
| (6) |
| (7) End while |
| (8) Choose a vertex of degree ; |
| (9) be an independent set * |
| (10) while such that and all children of inclusion in do |
| (11) Let be the parent of ; |
| (12) ; |
| (13) partner; |
| (14) end |
| (15) while such that do |
| (16) Choose a child of such that ; |
| (17) ; |
| (18) end |
| (19) Let be a maximal independent set of with and ; |
| (20) Increment stage number |
| (21) Until depth of the tree is greater than or the stage number is threshold |
| (22) end |