
Jeffrey Hellrung
Wednesday, April 11, 2007
Com Sci 280D, HW 1
1. Message complexity of a distributed algorithm is the number of messages per link spent (worst case)
until the algorithm reaches quiescence. The time complexity is the longest time an execution can last
if every message has to be delivered within a unit of time from the time it was sent (but this does not
mean that teh system is synchronous since some messages may be delivered in a small fraction of a
unit of time and some may be delivered after a full unit). DFS, as is, is almost a distributed algorithm,
so its message complexity is O(E), as well as its time complexity. Amend DFS for the distributed
setting so that there is some concurrency in its operation that reduces this time complexity to O(n).
It is nevertheless DFS as it produces a DFS tree (recall that not every tree is a DFS tree).
Solution
DFS works as before, except that each node keeps a set of possible children, originally initialized to
all its neighbors. Once DFS explores to a node i, a message is sent to each neighbor jin i’s set of
possible children to remove ifrom j’s set of possible children. DFS then explores, sequentially, the
subtrees down each of i’s possible children (the exploration of one subtree may, in fact, further reduce
the set of possible children of i). In this way, the invariant is always kept that a node’s set of possible
children corresponds to its neighbors who are not yet part of the DFS tree. Since each message sent
across a link not in the DFS tree is sent simultaneously with a message sent across a link which is part
of the DFS tree, the time complexity must be the number of messages sent across links in the DFS
tree, which is clearly O(n).
1