Presentation is loading. Please wait.

# Minimum Spanning Trees

## Presentation on theme: "Minimum Spanning Trees"— Presentation transcript:

Minimum Spanning Trees
GHS Algorithm

Weighted Graph

Minimum weight spanning tree
(MST) The sum of the weights is minimized For MST : is minimized

Spanning tree fragment:
Any sub-tree of a MST

Minimum weight outgoing edge
(MWOE) The adjacent edge to the fragment with the smallest weight that does not create a cycle

Two important properties for building MST
Property 1: The union of a fragment and the MWOE is a fragment Property 2: If the weights are unique then the MST is unique

Property 1: The union of a fragment and the MWOE is a fragment Proof: Basic idea Examine if the new fragment is part of a MST

Fragment MWOE Spanning tree If then is fragment

Fragment MWOE Spanning tree If then is fragment

Fragment MWOE Spanning tree If then add to and delete

Fragment MWOE Spanning tree If then add to and delete

Fragment MWOE Spanning tree Since otherwise, wouldn’t be MST

Fragment MWOE Spanning tree thus is fragment END OF PROOF

Property 2: If the weights are unique then the MST is unique Proof: Basic Idea: Suppose there are two MST Then there is another MST of smaller weight Contradiction!

Suppose there are two MST

Take the smallest weight edge
not in intersection

Cycle in RED MST

Cycle in RED MST Not in BLUE MST (since blue tree is acyclic)

Cycle in RED MST Since is not in intersection, (the weight of is the smallest)

Delete and add in RED MST
Cycle in RED MST Delete and add in RED MST We obtain a new tree with smaller weight Contradiction! END OF PROOF

Prim’s Algorithm Start with a node as an initial fragment Repeat Augment fragment with the MWOE Until no other edge can be added to (Assume unique IDs)

Fragment

Fragment MWOE

Fragment MWOE

Fragment MWOE

Fragment

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

Kruskal’s Algorithm Initially, each node is a fragment Repeat Find the smallest MWOE of all fragments Merge the two fragments adjacent to Until there is one fragment (Assume unique IDs)

Initially, every node is a fragment

Find the smallest MWOE

Merge the two fragments

Find the smallest MWOE

Merge the two fragments

Resulting MST

Kruskal’s algorithm gives an MST
Theorem: Kruskal’s algorithm gives an MST Proof: Use Properties 1 and 2 repeatedly Property 2 guarantees that the merged trees are fragments END OF PROOF

GHS Algorithm Distributed version of Kruskal’s Algorithm Initially, each node is a fragment Repeat in parallel: (A Synchronous Phase) Each fragment finds its MWOE Merge fragments adjacent to MWOE’s Until there is one fragment

Phase 0: Initially, every node is a fragment
Every node is a root of a fragment

Phase 1: Find the MWOE for each fragment

Phase 1: Merge the fragments
Root Root Root Root symmetric MWOE Asymmetric MWOE The new root is adjacent to a symmetric MWOE

Phase 1: New fragments

Phase 2: Find the MWOE for each fragment

Phase 2: Merge the fragments
Root Root

Phase 2: New fragments

Phase 3: Find the MWOE for each fragment

Phase 3: Merge the fragments
Root

Phase 3: New fragment FINAL MST

Rules for selecting a Root in fragment
MWOE

Rules for selecting a Root in fragment
Merged Fragment root Higher ID Node on MWOE

Rules for selecting a Root in fragment
Merging more than 2 fragments

Rules for selecting a Root in fragment
Merged Fragment Root Higher ID Node on symmetric MWOE asymmetric

In merged fragments there is exactly one symmetric MWOE
Remark: In merged fragments there is exactly one symmetric MWOE two zero Impossible Impossible Creates a fragment with two MWOE Creates a fragment with no MWOE

The new root broadcasts to the new fragment
is the symmetric MWOE of the merged fragments The new root broadcasts to the new fragment is the identity of the new fragment

At the end of a phase each fragment
has its own unique identity. Root Root Root Root End of phase 1

At the end of a phase each fragment
has its own unique identity. Root Root End of phase 2

At the beginning of each phase each node in fragment finds its MWOE

Then each node reports its MWOE to the fragment root with convergecast
(the global minimum survives in propagation) MWOE MWOE MWOE MWOE

The root selects the minimum MWOE

To discover its own MWOE, each node
broadcasts its identity to neighbors

Then it knows which edges are outgoing,
And selects the MWOE among them outgoing MWOE outgoing

Complexity Smallest Fragment size (#nodes) Phase

Maximum possible fragment size
Number of nodes Maximum phase:

Time to convergecast MWOE to root:
Time of a phase: Time to convergecast MWOE to root: (maximum fragment size is ) Time to connect new fragments: (Each fragment sends one message on its MWOE) Time of root to broadcast identity: Total phase time:

Algorithm Time Total time = Phase time X #phases = Lower bound:

Messages for nodes to find MWOE:
Messages in a phase: Messages for nodes to find MWOE: (on each edge 2 messages) Messages to convergecast to root: (maximum fragment size is ) Messages to connect new fragments: (Each fragment sends one message on its MWOE) Messages to broadcast identity: Total phase messages:

Algorithm messages Total messages = Phase messages X #phases Can be improved to

Asynchronous Version of GHS Algorithm
Simulates the synchronous version Every fragment has a level

Fragment Fragment MWOE If then merges to (cost of merging proportional to )

The combined level is New fragment MWOE

Fragment Fragment MWOE If then merges with (cost of merging proportional to )

The combined level is New fragment MWOE

(cost of merging would be proportional to
for every small fragment, inefficient!!) Fragment Fragment MWOE If then waits until previous Rules apply

Similar presentations

Ads by Google