1 / 15

Minimum Spanning Tree (MST)

a. 7. 2. d. 2. 5. 5. 4. f. b. 1. g. 1. 4. 3. 7. 4. c. e. Minimum Spanning Tree (MST). Problem Select edges in a connected and undirected graph to. form a tree that connects all the vertices ( spanning tree ). minimize the total edge weight of the spanning tree.

topaz
Download Presentation

Minimum Spanning Tree (MST)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. a 7 2 d 2 5 5 4 f b 1 g 1 4 3 7 4 c e Minimum Spanning Tree (MST) Problem Select edges in a connected and undirected graph to form a tree that connects all the vertices (spanning tree). minimize the total edge weight of the spanning tree. Total weight of tree edges: 14

  2. Applications of MST Telephone wiring (use as little wire as possible) Electronic circuit board design Cancer imaging (MSTs describe arrangements of nuclei in skin cells) Biomedical image analysis (detect actin fibers in cell images) Astronomy (find clusters of quasars and Seyfert galaxies) Finding road networks in satellite and aerial imagery

  3. Cheapest edge that maintains the invariant A Greedy Strategy Generic-MST(G, w) A = { } // Invariant: A is a subset of some MST whileA does not form a spanning tree do find an edge (u, v) that is safefor A A = A {(u, v)} // A remains a subset of some MST return A How to find a safe edge?

  4. a 7 d 2 2 5 4 5 b f g 1 1 4 3 4 7 c e Cut Acutof G = (V, E) is a partition (S, V – S) of V. Ex.S = {a, b, c, f}, V – S = {e, d, g} Edges {b, d}, {a, d}, {b, e}, {c, e} all cross the cut. The remaining edges do not cross the cut.

  5. The cut (S, V – S) respectsA but not A (edge (b, d) crosses the cut). 1 2 Respected by a Cut A = { (a, b), (d, g), (f, b), (a, f) } A = A { (b, d) } Ex. S = {a, b, c, d} 1 2 1 a 7 d 2 2 5 4 5 b f g 1 4 1 3 4 7 c e

  6. Light Edge is the edge that crosses a cut with the minimum weight. Ex. S = {a, b, c, d} 7 a d 2 2 5 4 5 b f g 1 3 1 4 light edge 4 7 c e Edge {b, e} has weight 3, “lighter” than the other edges {a, d}, {b, d}, and {c, e} that also cross the cut.

  7. Light Edge Is Safe! TheoremLet (S, V – S) be any cut of G(V, E) that respects a subset A of E, which is included in some MST for G. Let (u, v) be a light edge crossing (S, V – S). Then (u, v) is safe for A; that is, A {(u, v)} is also included in some MST. 4 v 2 S 2 V –S 6 u A includes all red edges.

  8. T  { (u, v) } contains a cycle. There exists an edge (x, y)  T that crosses the cut (S, V – S). The new spanning tree T ' = T – { (x, y) }  { (u, v) } has total weight  the total weight of T. Hence T ' is an MST also. A A { (u, v) } T', i.e., (u, v) is safe for A. 4 v 2 S y x 2 V –S 6 u Why Light Edge Is Safe? Proof Suppose T is an MST (consisting of red edges) that includes A. Suppose the light edge (u, v)  T. We have

  9. CorollaryLet A be a subset of E that is included in some MST of G, and C be a connected component in the forest G = <V, A>. If (u, v) is a light edge connecting C to some other component in G , then (u, v) is safe for A. A A Proof The edge (u, v) is a light edge for the cut (C, V – C) which respects A. By the previous theorem (u, v) is safe for A. v 4 8 w 7 u A includes the five red edges. C

  10. Kruskal’s algorithm Prim’s algorithm Finding a Safe Edge Let A be a subset of edges included in some MST. A is aforest. The safe edge added to A has least weight among all edges connecting its two components. A is atree. The safe edge is a light edge connecting a vertex in A to one not in A.

  11. Kruskal’s Algorithm - an Example 7 a d 2 2 5 4 5 b f g 1 4 3 1 7 c e 4 Total weight of the MST: 14

  12. Kruskal’s Algorithm - Description MST-Kruskal(G, w) A = { } for each vertex v in V doMake-Set(v) sort the edges of E by nondecreasing weight w // O(E lg E) for each edge (u, v) in E, in order of nondecreasing weight do ifFind-Set(u) Find-Set(v) thenA = A + {(u, v)} Union(u, v) returnA

  13. lg* V = k such that 0 < lg lg … lg V ≤ 1 k Running time of the algorithm is O(E lg E) = O(E lg V) Kruskal’s Algorithm - Analysis Sorting takes O(E lg E) time. (V)Make-Setoperations (E)Find-Setoperations (V)Unionoperationns Total time O(E lg*V) (if properly implemented)

  14. f c f c d h e d h e g b g b {b, c, e, h} + {f, d, g} {b, c, e, h} {f, d, g} Union(e, g) Implementation of Disjoint-Set Forest Each member points only to its parent Find-Set(d) = f Find-Set(b) = c

  15. Running Time of Set Operations Make-Set(c) c ClaimA sequence of m Make-Set, Union, and Find-Set operations, n of which are Make-Set, can be performed in worst-case time O(m lg* n). (See Sections 22.3 & 22.4 for more on Disjoint-Set operations)

More Related