Minimum Spanning Trees Easy. Terms Node Node Edge Edge Cut Cut Cut respects a set of edges Cut...
-
Upload
carol-hawkins -
Category
Documents
-
view
214 -
download
0
Transcript of Minimum Spanning Trees Easy. Terms Node Node Edge Edge Cut Cut Cut respects a set of edges Cut...
Minimum Spanning Minimum Spanning TreesTrees
EasyEasy
TermsTerms
NodeNode EdgeEdge CutCut
CutCut respects a set of respects a set of edgesedges Light EdgeLight Edge Minimum Spanning TreeMinimum Spanning Tree
Generic AlgorithmGeneric Algorithm
1.1. Start with an empty set of edges.Start with an empty set of edges.
2.2. Continuously add only edges that are part of Continuously add only edges that are part of a minimum spanning tree a minimum spanning tree
3.3. Stop when we have a minimum spanning Stop when we have a minimum spanning tree.tree.
Kruskal’s AlgorithmKruskal’s Algorithm
1.1. Find the smallest edge in the graph.Find the smallest edge in the graph.
2.2. If it connects two unconnected sets, add it.If it connects two unconnected sets, add it.
3.3. Repeat for each edge.Repeat for each edge.
What are the optimal data structures?What are the optimal data structures?
O( E lg V)O( E lg V) E = # edgesE = # edges V = # nodes (vertices)V = # nodes (vertices)
Prim’s AlgorithmPrim’s Algorithm
1.1. Start with a set of 1 nodes: V and empty set Start with a set of 1 nodes: V and empty set of edges Aof edges A
2.2. Pick a light edge and add it to A.Pick a light edge and add it to A.
3.3. Repeat until all nodes are in V.Repeat until all nodes are in V.
Best Data Structures?Best Data Structures? O(E lg V) or O(E+V lg V)O(E lg V) or O(E+V lg V)
Other AlgorithmsOther Algorithms
BorBorůůvka's algorithm, O( E lg V )vka's algorithm, O( E lg V )
Bernard Chazelle, O( E α(V)) Bernard Chazelle, O( E α(V))
Randomized, expected Randomized, expected OO((EE) ) Karger, Klein, and Tarjan
Distributed MSTDistributed MSTLAN 1
LAN 2
LAN 3
B1
B2
B3
B4