Download presentation
Presentation is loading. Please wait.
1
Chapter 23 Minimum Spanning Tree
2
A minimum spanning tree (MST) for a connected graph
MST not unique: replace (b,c) by (a,h)
3
Theorem 23.1 Let G(V,E) be a connected, undirected graph. For every e in E, w(e) is its (real-valued) ‘weight’. Let A be a subset of E that is included in some MST for G. Let (S,V-S) be any cut of G that respects A. [A cut (S,V-S) of G respects A if no edge of A crosses the cut.] Let (u,v) be a light edge crossing (S,V-S) [w(u,v) is minimal among the edges crossing S,V-S]. Then, A UNION {(u,v)} is included in some MST for G.
4
2 views of a cut (S,V-S) (d,c): unique lightest edge that crosses the cut
5
Proof of Theorem 23.1 S: black vertices. V-S: white vertices.
Edges shown are in T, which is an MST. Other edges in G, are not shown. Shaded edges are in A. Suppose that T does not contain the light edge (u,v). (x,y) is an edge in unique path from u to v that the cut (S,V-S) does not respect. The edge (u,v) can replace the edge (x,y) so that the total weight of T does not increase and it is still a tree. QED
6
Kruskal’s algorithm Sort edge by increasing weight. Initially T is empty. Add next edge (u,v) to T, unless there is already a path from u to v in T. [How to determine that?]
7
Data structures and complexity
Union-Find Enough for current algorithm: how to do Union & Find in O(log n) time each? Complexity: O(m log n)
8
Kruskal’s algorithm (cont’d)
9
Prim’s algorithm T is empty. Put some vertex in T. Among the vertices not in T, pick one that has a light a vertex in T and add it to T. [How to determine that?] Repeat.
10
Data structures and complexity
Extract-min Decrease-key Complexity: O(m log n). Cab be enhanced to O(m + n log n)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.