1 / 11

Basic Graph Algorithms

Basic Graph Algorithms. Based on slides provided by Prof. Jennifer Welch. Broadcast Over a Rooted Spanning Tree. Suppose processors already have information about a rooted spanning tree of the communication topology tree: connected graph with no cycles

Download Presentation

Basic Graph Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic Graph Algorithms Based on slides provided by Prof. Jennifer Welch

  2. Broadcast Over a Rooted Spanning Tree • Suppose processors already have information about a rooted spanning tree of the communication topology • tree: connected graph with no cycles • spanning tree: contains all processors • rooted: there is a unique root node • Implemented via parent and children local variables at each processor • indicate which incident channels lead to parent and children in the rooted spanning tree

  3. Broadcast Over a Rooted S.T. • root initially sends M to its children • when a processor receives M from its parent • sends M to its children • terminates (sets a local boolean to true) Exercise to transform this pseudocode into a state machine style description

  4. Complexity Analysis • Synchronous model: • time is depth of the spanning tree, which is at most n - 1 • number of messages is n - 1, since one message is sent over each spanning tree edge • Asynchronous model: • same time and messages

  5. Convergecast • Again, suppose a rooted spanning tree has already been computed by the processors • parent and children variables at each processor • Do the opposite of broadcast: • leaves send messages to their parents • non-leaves wait to get message from each child, then send combined info to parent

  6. f a b c d e c,f,h b,d f,h d e,g g h g h Convergecast solid arrows: parent-child relationships dotted lines: non-tree edges

  7. Finding a Spanning Tree Given a Root • Having a spanning tree is very convenient. • How do you get one? • Suppose a distinguished processor is known, to serve as the root. • Modify the flooding algorithm…

  8. Finding a Spanning Tree Given a Root • root sends M to all its neighbors • when non-root first gets M • set the sender as its parent • send "parent" msg to sender • send M to all other neighbors (if no other neighbors, then terminate) • when get M otherwise • send "reject" msg to sender • use "parent" and "reject" msgs to set children variables and know when to terminate (after hearing from all neighbors)

  9. c b b c a a d f f d e e g h g h Execution of Spanning Tree Alg. Both models: O(m) messages O(diam) time m = number of edges Asynchronous: not necessarily BFS tree Synchronous: always gives breadth-first search (BFS) tree

  10. Big O Notation • Consider f(n) and g(n) such thatf(n) and g(n) are non-negative for all n • f(n) is O(g(n) if there exists N, anda positive constant k such that,for all n > N f(n) ≤ k g(n)

  11. Spanning Tree Without a Specified Root • Read section 2.5

More Related