Minimum Spanning Tree (MST) form a tree that connects all the vertices (spanning tree). minimize the total edge weight of the spanning tree. Problem Select.

Slides:



Advertisements
Similar presentations
Comp 122, Spring 2004 Greedy Algorithms. greedy - 2 Lin / Devi Comp 122, Fall 2003 Overview  Like dynamic programming, used to solve optimization problems.
Advertisements

Greedy Algorithms Greed is good. (Some of the time)
Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm.
Minimum Spanning Tree CSE 331 Section 2 James Daly.
Chapter 23 Minimum Spanning Trees
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 13 Minumum spanning trees Motivation Properties of minimum spanning trees Kruskal’s.
CSE 780 Algorithms Advanced Algorithms Minimum spanning tree Generic algorithm Kruskal’s algorithm Prim’s algorithm.
Minimum Spanning Trees Definition Algorithms –Prim –Kruskal Proofs of correctness.
Lecture 18: Minimum Spanning Trees Shang-Hua Teng.
1 Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm.
Analysis of Algorithms CS 477/677
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 11 Instructor: Paul Beame.
Design and Analysis of Algorithms Minimum Spanning trees
Minimum Spanning Trees. a b d f g e c a b d f g e c.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Minimum Spanning Tree Algorithms. What is A Spanning Tree? u v b a c d e f Given a connected, undirected graph G=(V,E), a spanning tree of that graph.
1.1 Data Structure and Algorithm Lecture 13 Minimum Spanning Trees Topics Reference: Introduction to Algorithm by Cormen Chapter 13: Minimum Spanning Trees.
Design and Analysis of Computer Algorithm September 10, Design and Analysis of Computer Algorithm Lecture 5-2 Pradondet Nilagupta Department of Computer.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Definition: Given an undirected graph G = (V, E), a spanning tree of G is any subgraph of G that is a tree Minimum Spanning Trees (Ch. 23) abc d f e gh.
Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm Binary Search Trees1.
Algorithms: Design and Analysis Summer School 2013 at VIASM: Random Structures and Algorithms Lecture 3: Greedy algorithms Phan Th ị Hà D ươ ng 1.
MST Many of the slides are from Prof. Plaisted’s resources at University of North Carolina at Chapel Hill.
2IL05 Data Structures Fall 2007 Lecture 13: Minimum Spanning Trees.
Spring 2015 Lecture 11: Minimum Spanning Trees
UNC Chapel Hill Lin/Foskey/Manocha Minimum Spanning Trees Problem: Connect a set of nodes by a network of minimal total length Some applications: –Communication.
Minimum Spanning Trees and Kruskal’s Algorithm CLRS 23.
 2004 SDU Lecture 7- Minimum Spanning Tree-- Extension 1.Properties of Minimum Spanning Tree 2.Secondary Minimum Spanning Tree 3.Bottleneck.
1 Minimum Spanning Trees. Minimum- Spanning Trees 1. Concrete example: computer connection 2. Definition of a Minimum- Spanning Tree.
1 Greedy Algorithms and MST Dr. Ying Lu RAIK 283 Data Structures & Algorithms.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
1 Minimum Spanning Trees (some material adapted from slides by Peter Lee, Ananda Guna, Bettina Speckmann)
November 13, Algorithms and Data Structures Lecture XII Simonas Šaltenis Aalborg University
MST – KRUSKAL UNIT IV. Disjoint-Set Union Problem Want a data structure to support disjoint sets – Collection of disjoint sets S = {S i }, S i ∩ S j =
Chapter 23: Minimum Spanning Trees: A graph optimization problem Given undirected graph G(V,E) and a weight function w(u,v) defined on all edges (u,v)
F d a b c e g Prim’s Algorithm – an Example edge candidates choosen.
© 2007 Seth James Nielson Minimum Spanning Trees … or how to bring the world together on a budget.
 2004 SDU Lecture 6- Minimum Spanning Tree 1.The Minimum Spanning Tree Problem 2.Greedy algorithms 3.A Generic Algorithm 4.Kruskal’s Algorithm.
1 22c:31 Algorithms Minimum-cost Spanning Tree (MST)
© 2007 Seth James Nielson Minimum Spanning Trees … or how to bring the world together on a budget.
1 Week 3: Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm.
MST Lemma Let G = (V, E) be a connected, undirected graph with real-value weights on the edges. Let A be a viable subset of E (i.e. a subset of some MST),
Lecture 12 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Algorithm Design and Analysis June 11, Algorithm Design and Analysis Pradondet Nilagupta Department of Computer Engineering This lecture note.
Minimum Spanning Tree. p2. Minimum Spanning Tree G=(V,E): connected and undirected w: E  R, weight function a b g h i c f d e
November 22, Algorithms and Data Structures Lecture XII Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Greedy Algorithms General principle of greedy algorithm
Lecture ? The Algorithms of Kruskal and Prim
Introduction to Algorithms
Minimum Spanning Tree Chapter 13.6.
Minimum Spanning Trees
Minimum Spanning Trees
Lecture 12 Algorithm Analysis
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
Minimum-Cost Spanning Tree
Algorithms and Data Structures Lecture XII
Minimum-Cost Spanning Tree
Data Structures – LECTURE 13 Minumum spanning trees
Chapter 23 Minimum Spanning Tree
Minimum-Cost Spanning Tree
CS 583 Analysis of Algorithms
Kruskal’s Minimum Spanning Tree Algorithm
Lecture 12 Algorithm Analysis
Minimum Spanning Trees
Greedy Algorithms Comp 122, Spring 2004.
Lecture 12 Algorithm Analysis
Advanced Algorithms Analysis and Design
Chapter 23: Minimum Spanning Trees: A graph optimization problem
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Presentation transcript:

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

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

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

Cut A cut of 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. f d a b c e g

Respected by a Cut f d a b c e g Ex. S = {a, b, c, d} A = { (a, b), (d, g), (f, b), (a, f) } A = A  { (b, d) } The cut (S, V – S) respects A but not A (edge (b, d) crosses the cut). 12

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

Light Edge Is Safe! Theorem Let (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. S V – S u v A includes all red edges. 2

Why Light Edge Is Safe? S V – S u v 2 A y x A  { (u, v) }  T ', i.e., (u, v) is safe for A. Proof Suppose T is an MST (consisting of red edges) that includes A. Suppose the light edge (u, v)  T. We have 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.

Corollary Let A be a subset of E that is included in some MST of G, and C be a connected component in the forest G =. If (u, v) is a light edge connecting C to some other component in G, then (u, v) is safe for A. A A u v C 7 4 w 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. A includes the five red edges. 8

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

Kruskal’s Algorithm - an Example f d a b c e g Total weight of the MST: 14

Kruskal’s Algorithm - Description MST-Kruskal(G, w) A = { } for each vertex v in V do Make-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 if Find-Set(u)  Find-Set(v) then A = A + {(u, v)} Union(u, v) return A

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

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

Running Time of Set Operations c Make-Set(c) Claim A 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)