minimum spanning trees
DESCRIPTION
Minimum Spanning Trees. GHS Algorithm. Weighted Graph. (MST). Minimum weight spanning tree. 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). - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/1.jpg)
1
Minimum Spanning Trees
GHS Algorithm
![Page 2: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/2.jpg)
2
Weighted Graph
1
92
14
8
6
310 115
7
164
15
13
12
6)( ew
17
![Page 3: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/3.jpg)
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
![Page 4: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/4.jpg)
4
Spanning tree fragment:
Any sub-tree of a MST
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
![Page 5: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/5.jpg)
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
![Page 6: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/6.jpg)
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
![Page 7: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/7.jpg)
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
![Page 8: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/8.jpg)
8
e)()( xwew
MWOE
Fragment
Spanning tree
If then is fragment
F
T
Te }{eF
![Page 9: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/9.jpg)
9
eMWOE
Fragment
Spanning tree
If then is fragment
}{eFF
T
Te }{eF
![Page 10: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/10.jpg)
10
ex )()( xwew
MWOE
Fragment
F
TSpanning tree
If Te then add to e Tand delete x
![Page 11: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/11.jpg)
11
ex )()( xwew
MWOE
Fragment
F
TSpanning tree
If Te then add to e Tand delete x
![Page 12: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/12.jpg)
12
ex )()( xwew
MWOE
Fragment
F
T Spanning tree
)()( TwTw Since otherwise,Twouldn’t be MST
![Page 13: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/13.jpg)
13
e)()( xwew
MWOE
Fragment
Spanning tree
thus is fragment
}{eFF
T
}{eF END OF PROOF
![Page 14: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/14.jpg)
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!
![Page 15: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/15.jpg)
15
Suppose there are two MST
![Page 16: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/16.jpg)
16
Take the smallest weight edge not in intersection
e
![Page 17: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/17.jpg)
17
e
Cycle in RED MST
![Page 18: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/18.jpg)
18
e
Cycle in RED MST
e
Not in BLUE MST
(since blue tree is acyclic)
)()( ewew
![Page 19: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/19.jpg)
19
e
Cycle in RED MST
e
)()( ewew Since is not in intersection,e
(the weight of is the smallest)e
![Page 20: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/20.jpg)
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
![Page 21: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/21.jpg)
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)
![Page 22: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/22.jpg)
22
1
92
14
8
6
310 115
4
15
13
12
Fragment F
17
18
7
16
![Page 23: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/23.jpg)
23
1
92
14
8
6
310 115
4
15
13
12
Fragment F
MWOE
17
18
7
16
![Page 24: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/24.jpg)
24
1
92
14
8
6
310 115
4
15
13
12
Fragment F
MWOE
18
7
16
![Page 25: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/25.jpg)
25
1
92
14
8
6
310 115
4
15
13
12
Fragment F
17
MWOE
18
7
16
![Page 26: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/26.jpg)
26
Fragment F
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
![Page 27: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/27.jpg)
27
Theorem: Prim’s algorithm gives an MST
Proof: Use Property 1 repeatedly
END OF PROOF
![Page 28: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/28.jpg)
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)
![Page 29: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/29.jpg)
29
1
92
14
8
6
310 115
4
15
13
12
17
Initially, every node is a fragment
18
7
16
![Page 30: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/30.jpg)
30
1
92
14
8
6
310 115
4
15
13
12
17
Find the smallest MWOE
18
7
16
![Page 31: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/31.jpg)
31
1
92
14
8
6
310 115
4
15
13
12
17
Merge the two fragments
18
7
16
![Page 32: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/32.jpg)
32
1
92
14
8
6
310 115
4
15
13
12
17
Find the smallest MWOE
18
7
16
![Page 33: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/33.jpg)
33
1
92
14
8
6
310 115
4
15
13
12
17
Merge the two fragments
18
7
16
![Page 34: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/34.jpg)
34
Resulting MST
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
![Page 35: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/35.jpg)
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
![Page 36: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/36.jpg)
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)
![Page 37: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/37.jpg)
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
![Page 38: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/38.jpg)
38
1
92
14
8
6
310 115
4
15
13
12
17
Phase 1: Find the MWOE for each fragment
18
7
16
![Page 39: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/39.jpg)
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
![Page 40: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/40.jpg)
40
1
92
14
8
6
310 115
4
15
13
12
17
Phase 1: New fragments
18
![Page 41: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/41.jpg)
41
1
92
14
8
6
310 115
4
15
13
12
17
18
Phase 2: Find the MWOE for each fragment
7
16
![Page 42: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/42.jpg)
42
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
Phase 2: Merge the fragments
Root
Root
![Page 43: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/43.jpg)
43
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
Phase 2: New fragments
![Page 44: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/44.jpg)
44
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
Phase 3: Find the MWOE for each fragment
![Page 45: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/45.jpg)
45
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
Phase 3: Merge the fragments
Root
![Page 46: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/46.jpg)
46
Phase 3: New fragment
1
92
14
8
6
310 115
4
15
13
12
17
18
7
16
FINAL MST
![Page 47: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/47.jpg)
47
Rules for selecting a Root in fragment
Fragment 1Fragment 2
root
rootMWOE
![Page 48: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/48.jpg)
48
Merged Fragment
root
Higher ID Node on MWOE
Rules for selecting a Root in fragment
![Page 49: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/49.jpg)
49
Rules for selecting a Root in fragment
Merging more than 2 fragments
1F2F
3F
5F
4F 6F
7Frootroot
root
root
root root
root
![Page 50: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/50.jpg)
50
Rules for selecting a Root in fragment
Higher ID Node on symmetric MWOE
Merged Fragment
Root
asymmetric
![Page 51: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/51.jpg)
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
![Page 52: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/52.jpg)
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
![Page 53: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/53.jpg)
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
![Page 54: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/54.jpg)
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
![Page 55: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/55.jpg)
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
![Page 56: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/56.jpg)
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
![Page 57: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/57.jpg)
57
The root selects the minimum MWOE
MWOE
10
3
15
4
7
25
35 19 22
12
3
![Page 58: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/58.jpg)
58
10
15
3
To discover its own MWOE, each node broadcasts its identity to neighbors
![Page 59: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/59.jpg)
59
10
15
3
Then it knows which edges are outgoing,And selects the MWOE among them
outgoing
outgoing
MWOE
![Page 60: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/60.jpg)
60
Smallest Fragment size (#nodes)Phase
0 1
1 2
3 4
i i2
Complexity
![Page 61: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/61.jpg)
61
Maximum phase: ni 2log
Maximum possible fragment size ni 2
Number ofnodes
![Page 62: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/62.jpg)
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
![Page 63: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/63.jpg)
63
Total time = Phase time X #phases =nlog)(nO
)log( nnO
Lower bound:
nn
log
Algorithm Time
![Page 64: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/64.jpg)
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)
![Page 65: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/65.jpg)
65
Total messages = Phase messages X #phasesnlog|)|( EnO
)log|)|(( nEnO
Can be improved to
|)|log( EnnO
Algorithm messages
![Page 66: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/66.jpg)
66
Asynchronous Version of GHS Algorithm
Simulates the synchronous version
Every fragment has a levelF )(FL
![Page 67: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/67.jpg)
67
FragmentFragment
1F 2FMWOE
If then merges to )()( 21 FLFL 1F 2F
(cost of merging proportional to )1F
![Page 68: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/68.jpg)
68
New fragment
1F 2FMWOE
)()( 21 FLFL
The combined level is )()( 2FLFL
![Page 69: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/69.jpg)
69
MWOE
FragmentFragment
1F 2F
If then merges with )()( 21 FLFL 1F 2F
(cost of merging proportional to )1F
![Page 70: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/70.jpg)
70
New fragment
1F 2FMWOE
The combined level is 1)()( 2 FLFL
)()( 21 FLFL
![Page 71: Minimum Spanning Trees](https://reader036.vdocument.in/reader036/viewer/2022062804/56814930550346895db66ed9/html5/thumbnails/71.jpg)
71
Fragment Fragment
1F 2FMWOE
If then waits until previousRules apply
)()( 21 FLFL 1F
(cost of merging would be proportional to for every small fragment, inefficient!!)
1F