1 / 98

The Minimum Spanning Tree Problem

The Minimum Spanning Tree Problem. Distributing Prim’s and Kruskal’s Algorithm. Weighted Graph G=(V,E,w), |V|=n, |E|=m. For the sake of simplicity, we assume that weights are positive integers. Spanning tree. Any tree T=(V,E’) (connected acyclic graph) spanning all the nodes of G. (MST).

mmeyers
Download Presentation

The Minimum Spanning Tree Problem

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. The Minimum Spanning Tree Problem Distributing Prim’s and Kruskal’s Algorithm

  2. Weighted Graph G=(V,E,w), |V|=n, |E|=m For the sake of simplicity, we assume that weights are positive integers

  3. Spanning tree Any tree T=(V,E’) (connected acyclic graph) spanning all the nodes of G

  4. (MST) Minimum-weight spanning tree A spanning tree s.t. the sum of its weights is minimized: For MST : is minimized In general, the MST is not unique.

  5. MST fragment: Any (connected) sub-tree of a MST

  6. Minimum-weight outgoing edge (MOE) of a fragment Fragment An edge incident to a single node of the fragment and having smallest weight (notice it does not create any cycles in the fragment)

  7. Two important properties for building a MST The union of a MST fragment and any of its MOE is a fragment of some MST (so called blue rule). Property 1: Property 2: If the edge weights are distinct then the MST is unique

  8. The union of a MST fragment FT and any of its MOE is a fragment of some MST. Property 1: Proof: • Remind that in general the MST is not unique. Then, distinguish two cases: • the MOE belongs to T • the MOE does not belong to T • In both cases, we can prove the claim.

  9. Case 1: Fragment MOE MST T

  10. Trivially, if then is a fragment of the MSTT Fragment MOE MST T

  11. Case 2: Fragment MOE MST T

  12. If then add to and remove x (any edge of T forming a cycle with x and exiting from F) Fragment MST T

  13. Fragment Obtain T’ and since But w(T ’)  w(T), since T is an MST  w(T’)=w(T), i.e., T’ is an MST

  14. Fragment MST T’ thus is a fragment of MST T ’ END OF PROOF

  15. Property 2: If the edge weights are distinct then the MST is unique Proof: Basic Idea: Suppose there are two MSTs Then we prove that there is another spanning tree of smaller weight  contradiction!

  16. Suppose there are two MSTs

  17. Take the smallest-weight edge not in the intersection, and assume w.l.o.g. it is blue

  18. Cycle in RED MST

  19. Cycle in RED MST e’: any red edge not in BLUE MST ( since blue tree is acyclic)

  20. Cycle in RED MST Since is not in the intersection, (weights are distinct and the weight of e is the smallest among edges not in the intersection)

  21. Cycle in RED MST Delete and add in RED MST  we obtain a new tree with smaller weight  contradiction! END OF PROOF

  22. Overview of MST distributed algos • There exist algorithms only when nodes have unique ids. We will evaluate them according to their message (and time) complexity. Upcoming results follow: • Distributed Prim: • Asynchronous (uniform): O(n2) messages • Synchronous (uniform): O(n2) messages, andO(n2) rounds • Distributed Kruskal (so-called Gallagher-Humblet-Sprira (GHS) algorithm) (distinct weights): • Synchronous (non-uniform and synchronous start): O(m+n log n)messages, and O(nlog n) rounds • Asynchronous (uniform): O(m+n log n) messages

  23. Prim’s Algorithm (sequential version) Start with a node as an initial fragment, say F, and repeatedly apply the blue rule F={rV(G)} Repeat Augment fragment F with a MOE Until no other edge can be added to F

  24. Fragment F r

  25. Fragment r MOE

  26. Augmented fragment F r

  27. Fragment F MOE r

  28. Augmented fragment F r

  29. Fragment F MOE r

  30. Final MST r

  31. Theorem: Prim’s algorithm gives an MST Proof: Use Property 1 repeatedly END OF PROOF

  32. Prim’s algorithm (distributed version) • Works with both asynchronousand synchronous non-anonymous, uniform models (and with non-distinct weights) • Algorithm (asynchronous high-level version): • Let vertex r be the root as well as the first fragment (notice that r should be provided by a leader election algorithm, and this is why we ask for non-anonymity, although the actual algorithm will not make use of ids) • REPEAT • rbroadcasts a message on the current fragment to search for a MOE of the fragment (i.e., each vertex in the fragment searches for its local (i.e., incident) MOE) • Starting from the leaves of the fragment, apply the following bottom-up procedure: each leaf reports its local MOE (if any) to its parent, while each internal node reports to its parent the minimum between its local MOE and the MOEs received by its children (in other words, it reports the MOE of its appended subfragment, i.e., the minimum out of the local MOEs of itself and of all its descendants (ties are broken arbitrarily)); • the MOE of the fragment is then selected by r and added to the fragment, by sending an add-edge message on the appropriate path • finally, the root is notified the edge has been added • UNTIL the fragment spans all the nodes

  33. Local description of asynchronous Prim • Each processor stores: • The status of any of its incident edges, which can be either of {basic, branch, reject} • Its own status, which can be either {in, out} of the fragment • Parent channel (route towards the root) • Children channels • Local MOE • MOE for each children channel • MOE channel (route towards the MOE of its appended subfragment)

  34. Type of messages in asynchronous Prim • Search_MOE: coordination message initiated by the root • Test: check the status of a basic edge • Reject, Accept: response to Test • Report(weight): report to the parent node the MOE of the appended subfragment • Add_edge: say to the node adjacent to the fragment’s MOE to add it (i.e., change its status from basic to branch) • Connect: perform the union of the found MOE to the fragment (this changes the status of the other end-node from out to in) • Connected: notify the root that connection has taken place O(n2) Message complexity?

  35. Sample execution: The root sends a Search_MOE message, and the message floods along the fragment, so that each node in fragment starts looking for its local MOE

  36. To discover its local MOE, each node sends a Test message over its basic edges in increasing order of weight, until it receives an Accept. Rejected tests turn to reject the status of the corresponding edge. Test Accept Test Reject

  37. Then it knows its local MOE (notice this can be void) Local MOE

  38. Then, if a node is a leaf, it sends a Report with its MOE (if any) to its parent, while if a node has children, it waits for a Report from each child, and then selects a global minimum between its local MOE and these reported MOEs, which will be reported to its parent; in this way, each internal node stores and reports the MOE of its appended subfragment Local MOE Local MOE Local MOE Local MOE Local MOE

  39. The root selects the minimum among received MOEs and sends along the appropriate path an Add_edge message, which will become a Connect message at the proper node MOE

  40. Added node changes its status to in, and connecting edge becomes branch. Finally, a Connected message is sent back along the appropriate path up to the root, which then resumes the Search_MOE procedure branch in

  41. Synchronous Prim • It will work in O(n2) rounds…think to it by yourself…

  42. Kruskal’s Algorithm (sequential version) Initially, each node is a fragment Repeat • Find the smallest MOE e of all current fragments • Merge the two fragments adjacent to e Until there is only one fragment left

  43. Initially, every node is a fragment

  44. Find the smallest MOE

  45. Merge the two fragments

  46. Find the smallest MOE

  47. Merge the two fragments

  48. Merge the two fragments

  49. Resulting MST

  50. Theorem: Kruskal’s algorithm gives an MST Proof: Use Property 1, and observe that no cycle is created (indeed, we always select a MOE). END OF PROOF

More Related