1 / 88

Minimum Spanning Trees

Minimum Spanning Trees. Gallagher-Humblet-Spira (GHS) Algorithm. Weighted Graph G=(V,E), |V|=n, |E|=m. Spanning tree. Any tree T=(V,E’) (connected acyclic graph) spanning all the nodes of G. (MST). Minimum-weight spanning tree. A spanning tree s.t. the sum of its weights is minimized:.

coleb
Download Presentation

Minimum Spanning Trees

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. Minimum Spanning Trees Gallagher-Humblet-Spira (GHS) Algorithm

  2. Weighted Graph G=(V,E), |V|=n, |E|=m

  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

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

  6. Minimum weight outgoing edge (MWOE) of a fragment Fragment An edge adjacent to the fragment with smallest weight and that does not create a cycle in the fragment

  7. Two important properties for building MST The union of a fragment and any of its MWOE 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 fragment FT and any of its MWOE is a fragment of some MST. Property 1: Proof: • Distinguish two cases: • the MWOE belongs to T • the MWOE does not belong to T • In both cases, we can prove the claim.

  9. Case 1: Fragment MWOE MST T

  10. Trivially, if then is a fragment of T Fragment MWOE MST T

  11. Case 2: Fragment MWOE MST T

  12. If then add to and remove x (an 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 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 there is another MST 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. Prim’s Algorithm (sequential version) Start with a node as an initial fragment Repeat Augment fragment with a MWOE Until no other edge can be added to

  23. Fragment

  24. Fragment MWOE

  25. Fragment MWOE

  26. Fragment MWOE

  27. Fragment

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

  29. Prim’s algorithm (distributed version) • Works by repeatedly applying the blue rule to a single fragment, to yield the MST for G • Works with both asynchronousand synchronous non-anonymous, uniform models (and also with non-distinct weights) • Algorithm (asynchronous high-level version): • Let vertex r be the root as well as the first fragment (notice that r may be provided by a leader election algo) • REPEAT • rbroadcasts a message on the current fragment to search for the MWOE of the fragment (each vertex in the fragment searches for its local (i.e., adjacent) MWOE) • convergecast (i.e., reverse broadcast towards r) the MWOE of the appended subfragment (i.e., the minimum of the local MWOEs of itself and its descendents) • the MWOE 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 there is only one fragment left

  30. 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} • Parent channel (route towards the root) • Children channels • Local MWOE • MWOE for each children channel • MWOE channel (route towards the MWOE of its appended subfragment)

  31. Type of messages in asynchronous Prim • Search_MWOE: 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 MWOE of the appended subfragment • Add_edge: say to the fragment node adjacent to the fragment’s MWOE to add it • Connect: perform the union of the found MWOE to the fragment (this changes the status of the corresponding end-node from out to in) • Connected: notify the root that connection has taken place Message complexity = O(n2)

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

  33. To discover its local MWOE, each node sends a Test message over its basic edge of min weight, until it receives an Accept Test Accept Test Reject

  34. Then it knows its local MWOE MWOE

  35. Then each node sends a Report with the MWOE of the appended subfragment to the root with convergecast(the global minimum survives in propagation) MWOE MWOE MWOE MWOE

  36. The root selects the minimum MWOE and sends along the appropriate path an Add_edge message, which will become a Connect message at the proper node MWOE

  37. Finally, a Connected message is sent back along the appropriate path to the root, which then resumes the Search_MWOE procedure

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

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

  40. Initially, every node is a fragment

  41. Find the smallest MWOE

  42. Merge the two fragments

  43. Find the smallest MWOE

  44. Merge the two fragments

  45. Merge the two fragments

  46. Resulting MST

  47. Theorem: Kruskal’s algorithm gives an MST Proof: Use Property 1, and observe that no cycle is created. END OF PROOF

  48. Synchronous GHS Algorithm • Distributed version of Kruskal’s Algorithm • Works by repeatedly applying the blue rule to multiple fragments • Works with non-uniform model, distinct weights, synchronous start Initially, each node is a fragment (Synchronous Phase) Repeat in parallel: • Each fragment – coordinated by a fragment rootnode - finds its MWOE • Merge fragments adjacent to MWOE’s Until there is only one fragment left

  49. Local description of syncr. GHS • Each processor stores: • The status of any of its incident edges, which can be either of {basic, branch, reject} • Identity of its fragment (the weigth of a core edge, i.e., an edge of the fragment adjacent to the root node – for single-node fragments, the proc. id ) • Root channel (route towards the root) • Branching-out channels • Local MWOE • MWOE for each branching-out edge • MWOE channel (route towards the MWOE of its appended subfragment)

  50. Type of messages • New_fragment(identity): coordination message sent by the root at the end of a phase • Test(identity): for checking the status of a basic edge • Reject, Accept: response to Test • Report(weight): for reporting to the parent node the MWOE of the appended subfragment • Merge: sent by the root to the node incident to the MWOE to activate union of fragments • Connect(My Id): sent by the node incident to the MWOE to perform the union

More Related