Presentation is loading. Please wait.

Presentation is loading. Please wait.

Minimum Spanning Trees

Similar presentations


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

1 Minimum Spanning Trees
GHS Algorithm

2 Weighted Graph

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

4 Spanning tree fragment:
Any sub-tree of a MST

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

6 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

7 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

8 Fragment MWOE Spanning tree If then is fragment

9 Fragment MWOE Spanning tree If then is fragment

10 Fragment MWOE Spanning tree If then add to and delete

11 Fragment MWOE Spanning tree If then add to and delete

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

13 Fragment MWOE Spanning tree thus is fragment END OF PROOF

14 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!

15 Suppose there are two MST

16 Take the smallest weight edge
not in intersection

17 Cycle in RED MST

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

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

20 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

21 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)

22 Fragment

23 Fragment MWOE

24 Fragment MWOE

25 Fragment MWOE

26 Fragment

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

28 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)

29 Initially, every node is a fragment

30 Find the smallest MWOE

31 Merge the two fragments

32 Find the smallest MWOE

33 Merge the two fragments

34 Resulting MST

35 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

36 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

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

38 Phase 1: Find the MWOE for each fragment

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

40 Phase 1: New fragments

41 Phase 2: Find the MWOE for each fragment

42 Phase 2: Merge the fragments
Root Root

43 Phase 2: New fragments

44 Phase 3: Find the MWOE for each fragment

45 Phase 3: Merge the fragments
Root

46 Phase 3: New fragment FINAL MST

47 Rules for selecting a Root in fragment
MWOE

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

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

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

51 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

52 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

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

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

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

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

57 The root selects the minimum MWOE

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

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

60 Complexity Smallest Fragment size (#nodes) Phase

61 Maximum possible fragment size
Number of nodes Maximum phase:

62 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:

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

64 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:

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

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

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

68 The combined level is New fragment MWOE

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

70 The combined level is New fragment MWOE

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


Download ppt "Minimum Spanning Trees"

Similar presentations


Ads by Google