1 Minimum Spanning Trees GHS Algorithm. 2 Weighted Graph.
-
Upload
colin-shaw -
Category
Documents
-
view
215 -
download
0
Transcript of 1 Minimum Spanning Trees GHS Algorithm. 2 Weighted Graph.
3
1
92
14
8
6
310 115
4
15
13
12
Minimum weight spanning tree
The sum of the weights is minimized
17
(MST)
For MST :T
Te
ewTw )()( is minimized
18
7
16
5
Minimum weight outgoing edge(MWOE)
The adjacent edge to the fragment with the smallest weight that does not create a cycle
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
6
Property 1:The union of a fragment and the MWOE is a fragment
Property 2:If the weights are uniquethen the MST is unique
Two important properties for building MST
7
Property 1:The union of a fragment and the MWOE is a fragment
Proof: Basic idea
Examine if the new fragmentis part of a MST
14
Property 2:If the weights are uniquethen the MST is unique
Proof: Basic Idea:
Suppose there are two MST
Then there is another MST of smaller weight
Contradiction!
20
e
Cycle in RED MST
e
)()( ewew
Delete and add in RED MST e e
We obtain a new tree with smaller weight
Contradiction! END OF PROOF
21
Prim’s Algorithm
Start with a node as an initial fragment
Augment fragment with the MWOE
Repeat
F
F
Until no other edge can be added to F
(Assume unique IDs)
28
Kruskal’s Algorithm
Initially, each node is a fragment
Find the smallest MWOE of all fragments
Merge the two fragments adjacent to
e
e
Repeat
Until there is one fragment
(Assume unique IDs)
35
Theorem: Kruskal’s algorithm gives an MST
Proof: Use Properties 1 and 2 repeatedly
END OF PROOF
Property 2 guarantees that the merged trees are fragments
36
GHS Algorithm
Distributed version of Kruskal’s Algorithm
Initially, each node is a fragment
Each fragment finds its MWOE
Merge fragments adjacent to MWOE’s
Repeat in parallel:
Until there is one fragment
(A Synchronous Phase)
37
Phase 0: Initially, every node is a fragment
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
Every node is a root of a fragment
39
1
92
14
8
6
310 115
4
15
13
12
17
Phase 1: Merge the fragments
18
Root
RootRoot
Root
Asymmetric MWOE
symmetric MWOE
The new root is adjacent to a symmetric MWOE
49
Rules for selecting a Root in fragment
Merging more than 2 fragments
1F2F
3F
5F
4F 6F
7Frootroot
root
root
root root
root
50
Rules for selecting a Root in fragment
Higher ID Node on symmetric MWOE
Merged Fragment
Root
asymmetric
51
In merged fragments there is exactly one symmetric MWOE
Remark:
Impossible Impossible
1F2F
4F3F
5F
6F
Creates a fragment with two MWOE
zero two
Creates a fragmentwith no MWOE
1F2F
4F3F
5F
6F
7F
8F
52
The new root broadcasts to the new fragment
e
)(ew
e is the symmetric MWOE of the merged fragments
)(ew
)(ew)(ew
)(ew )(ew)(ew
)(ew
)(ew is the identity of the new fragment
)(ew
)(ew
)(ew )(ew
)(ew)(ew)(ew
)(ew
53
At the end of a phase each fragmenthas its own unique identity.
1
92
14
8
6
310 115
4
15
13
12
17
18
Root Root
Root
Root
4
End of phase 1
5
1
2
7
16
4
4
1 1
2
2
2
2
2
5
5
54
At the end of a phase each fragmenthas its own unique identity.
End of phase 2
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16 Root
Root7
97 77
79
9
9 9
9
9
9
55
At the beginning of each phase each node in fragment finds its MWOE
MWOEMWOE
MWOE
MWOE
10
3
15
4
7
25
35 19 22
12
56
Then each node reports its MWOEto the fragment root with convergecast (the global minimum survives in propagation)
MWOEMWOE
MWOE
MWOE
10
3
15
4
7
25
35 19 22
12
193 22
73
103
3
59
10
15
3
Then it knows which edges are outgoing,And selects the MWOE among them
outgoing
outgoing
MWOE
62
Time to convergecast MWOE to root:
)(nO
)(nO
Time to connect new fragments: )1(O(Each fragment sends one message on its MWOE)
Time of root to broadcast identity:
Time of a phase:
(maximum fragment size is ))(nO
Total phase time: )(nO
64
Messages to broadcast identity:
Messages to convergecast to root:
)(nO
)(nO
Messages to connect new fragments: )(nO(Each fragment sends one message on its MWOE)
Messages in a phase:
(maximum fragment size is ))(nO
Total phase messages: |)|( EnO
Messages for nodes to find MWOE: |)(|EO(on each edge 2 messages)
65
Total messages = Phase messages X #phasesnlog|)|( EnO
)log|)|(( nEnO
Can be improved to
|)|log( EnnO
Algorithm messages
66
Asynchronous Version of GHS Algorithm
Simulates the synchronous version
Every fragment has a levelF )(FL
67
FragmentFragment
1F 2FMWOE
If then merges to )()( 21 FLFL 1F 2F
(cost of merging proportional to )1F
69
MWOE
FragmentFragment
1F 2F
If then merges with )()( 21 FLFL 1F 2F
(cost of merging proportional to )1F