Broadcast: Before 1
After 2
Spanning Tree ffl assume fixed spanning tree ffl asynchronous model 3
Processor State parent terminated children 4
Broadcast: Step One parent terminated children 5
Broadcast:Step Two parent terminated children 6
Correctness Question: Is this algorithm correct for ffl synchronous networks? ffl asynchronous networks? Question: If so, what is the message complexity? 7
Proof Claim: This algorithm has time complexity d, where d is the depth of the spanning tree. Proof: by induction parent terminated children Basis: t =1 ffl each child of pr receives M 8
Proof parent terminated children Induction step: ffl assume p i at distance t 1 receives M at round t 1. ffl by algorithm, each child of p i receives M in next round. 9
Correctness Claim This algorithm is correct in the synchronous model too. ffl argue by induction ffl basis: time at most 1 ffl induction step: time at most d 10
Convergecast: Before x 0 x 4 x 1 x 3 x 2 11
After max(x,..., x ) 0 4 12
Convergecast: Step One parent terminated children 13
Convergecast: Step Two parent terminated children 14
Theorem There is an asynchronous convergecast algorithm with ffl message complexity n 1, and ffl time complexity d, in the synchronous and asynchronous model, when a spanning tree of depth d is known in advance. Proof left as an exercise. 15
Flooding ffl no spanning tree ffl root sends to all neighbors 16
Flooding already seen ffl first time we've seen this message? 17
Flooding already seen ffl Send it out on all other links. 18
Flooding already seen ffl If you see the message again, ignore it. 19
Complexity ffl no node sends a message on a link more than once ffl no link transmit more than two copies ffl (can a link transmit two copies?) Max number of messages: why? 2m (n 1) Worst-case: n(n 1) 2 20
Spamming Trees Actually, flooding creates a spanning tree. ffl root at pr, the root node. ffl if p j receives M from p i for the first time, then p i is parent of p j. 21
Spanning Tree Algorithm already seen Dad! ffl when message received for the first time ffl set parent variable ffl respond with parent message 22
Spanning Tree Algorithm already seen ffl when message received subsequent times time ffl respond with reject message 23
Spanning Tree Algorithm ffl send messages to all other neighbors 24
Spanning Tree Algorithm ffl collect responses 25
Spanning Tree Algorithm ffl end up with spanning tree ffl each node has parent and children variables 26
Spanning Tree How do we know it works? ffl once a processor sets its parent variable, it never changes ffl set of children never decreases ffl eventually graph induced by parent and children stops changing ffl variables are consistent: if p i 's parent is p j, then p j 's children include p i. ffl still need to show that we have a tree rooted at pr. 27
Reachability ffl suppose some node not reachable from pr ffl network is connected ffl there exist p i and p j such that ffl p i and p j are linked by a channel ffl p i is reachable, and p j is not. ffl p j never set its parent variable. ffl but p i must have sent a message to p j ffl p j must have received the message and set its parent variable ffl contradiction 28
Acyclicity ffl suppose the graph contains a cycle ffl p i 1 ;p i2 ;:::;p i ;p k i 1 ffl if p i is a child of p j, ffl then p i received its message for the first time after p j does ffl so then p i received its message for the first time 1 after p does i 1 ffl contradiction 29
Theorem There is an asynchronous algorithm to find a spanning tree of a network with m edges and diameter D, given a distinguished node, in message complexity O(m) and time complexity O(d). The diameter of a graph is the longest shortest path between two nodes. Same claim holds for synchronous model. 30
Synchronous Tree Breadth-first search tree. 31
Asynchronous Tree No guarantees on tree structure. 32
Depth-First Search Tree unexplored unexplored ffl neighbors unexplored ffl receive request from neighbor 33
Depth-First Search Tree unexplored ffl set parent variable ffl remove parent from unexplored set ffl pick unexplored neighbor ffl remove from unexplored set ffl forward message 34
Depth-First Search Tree ffl reject subsequent requests 35
Depth-First Search Tree unexplored ffl when neighbor responds ffl move on to next unexplored neighbors 36
Depth-First Search Tree ffl when all neighbors explored ffl report to parent 37
Analysis ffl each processor sends M message once on each edge ffl each processor replies at most once ffl at most 4m messages sent ffl prove it! 38
Roots Algorithm depends on fixed root node to start out. How can we design a DFS tree that does not have a distinguished root? Hint ffl assume nodes have unique ids ffl assume ids are ordered 39
Roots Revisited ffl Everybody wakes up and tries to be the root. ffl send leader id as part of the message ffl if you get a message from a leader with a lower id, abandon earlier trees and join this one. ffl ignore messages from leaders with higher ids ffl eventually, the one true leader will take over ffl she will recognize when her tree is complete how? ffl no other node's tree will complete why? ffl message complexity O(mn). ffl time complexity O(m). 40