You have a network where each node knows only its parent and its children and can send messages to its parent and children.
-
Implement a sendMessage interface that allows reliable delivery between adjacent nodes.
-
Using only message passing, design an algorithm to count the total number of nodes in the network; state the assumptions (tree vs. general graph) and analyze message/time complexity.
-
Design a protocol to return the path:
(a) from any node to the root, and
(b) between two arbitrary nodes.
-
The network can experience failures (message loss, duplication, reordering, or node crashes). Explain how you would handle failures with timeouts, retries, acknowledgments, idempotent operations, and termination detection; discuss correctness and complexity.