Research Article
Energy-Efficient Adaptive Geosource Multicast Routing for Wireless Sensor Networks
Algorithm 3
Path serializing.
Input: node | Output: path | (1) if node == Null then | (2) return | (3) end if | (4) if node→right then | (5) PathSerializing(node→right) | (6) end if | (7) if IsBranch(node) then | (8) // if a node has more than two children | (9) if ID(node) ≠ ID(source node) then | (10) add(path, ID(node)) | (11) end if | (12) add(path, Delimiter) | (13) PathSerializing(node→left) | (14) else | (15) if IsLongPath(node) then | (16) // if there are more than three subsequent children | (17) // that is, child - grandchild - grandgrandchild … | (18) TmpNode = PathSerializingForUnicast(node) | (19) add(path, XCoordinate(TmpNode)) | (20) `add(path, YCoordinate(TmpNode)) | (21) node = TmpNode | (22) else | (23) add(path, ID(node)) | (24) end if | (25) PathSerializing(node→left) | (26) end if |
|