Richard Anderson Lecture 10 Minimum Spanning Trees

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science for Some.
Advertisements

Minimum Spanning Trees Definition Two properties of MST’s Prim and Kruskal’s Algorithm –Proofs of correctness Boruvka’s algorithm Verifying an MST Randomized.
Minimum Spanning Tree CSE 331 Section 2 James Daly.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Minimum Spanning Trees Definition Algorithms –Prim –Kruskal Proofs of correctness.
CSE 421 Algorithms Richard Anderson Dijkstra’s algorithm.
Network Optimization Problems: Models and Algorithms This handout: Minimum Spanning Tree Problem.
Minimum-Cost Spanning Tree weighted connected undirected graph spanning tree cost of spanning tree is sum of edge costs find spanning tree that has minimum.
DAST 2005 Tirgul 14 (and more) sample questions. DAST 2005 (reminder?) Kruskal’s MST Algorithm.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
CSE 326: Data Structures Spanning Trees Ben Lerner Summer 2007.
An Interval MST Procedure Rebecca Nugent w/ Werner Stuetzle November 16, 2004.
CSE 421 Algorithms Richard Anderson Lecture 10 Minimum Spanning Trees.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 11 Instructor: Paul Beame.
Minimum Spanning Trees
Lecture 28 CSE 331 Nov 5, HW 7 due today Q1 in one pile and Q 2+3 in another I will not take any HW after 1:15pm.
Lecture 27 CSE 331 Nov 6, Homework related stuff Solutions to HW 7 and HW 8 at the END of the lecture Turn in HW 7.
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.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Minimum Spanning Tree Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
9/10/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 8 Greedy Graph.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Graph Dr. Bernard Chen Ph.D. University of Central Arkansas.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Sets.
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.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
Introduction to Graph Theory
Chapter 9 Finding the Optimum 9.1 Finding the Best Tree.
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 4.
1 Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSCI 256 Data Structures and Algorithm Analysis Lecture 10 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 11.
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
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Kruskal’s Algorithm for Computing MSTs Section 9.2.
Introduction to Algorithms
Minimum Spanning Tree Chapter 13.6.
CSE373: Data Structures & Algorithms
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
CS 3343: Analysis of Algorithms
Data Structures & Algorithms Graphs
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Minimum-Cost Spanning Tree
Connected Components Minimum Spanning Tree
Lecture 24 CSE 331 Oct 27, 2017.
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
Data Structures – LECTURE 13 Minumum spanning trees
Chapter 23 Minimum Spanning Tree
Richard Anderson Lecture 11 Minimum Spanning Trees
Lecture 26 CSE 331 Nov 2, 2012.
Autumn 2015 Lecture 10 Minimum Spanning Trees
Minimum Spanning Tree Algorithms
Lecture 25 CSE 331 Oct 28, 2013.
Lecture 25 CSE 331 Oct 27, 2014.
Lecture 27 CSE 331 Nov 2, 2010.
CSE 373: Data Structures and Algorithms
Autumn 2016 Lecture 10 Minimum Spanning Trees
Minimum Spanning Trees (MSTs)
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Lecture 25 CSE 331 Oct 28, 2011.
Winter 2019 Lecture 10 Minimum Spanning Trees
CSE 332: Minimum Spanning Trees
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)
Presentation transcript:

Richard Anderson Lecture 10 Minimum Spanning Trees CSE 421 Algorithms Richard Anderson Lecture 10 Minimum Spanning Trees

Minimum Spanning Tree Undirected Graph G=(V,E) with edge weights 15 t 6 9 14 3 4 e 10 13 c s 11 20 5 17 2 7 g b 8 f 22 u 12 1 16 v

Greedy Algorithms for Minimum Spanning Tree [Prim] Extend a tree by including the cheapest out going edge [Kruskal] Add the cheapest edge that joins disjoint components [ReverseDelete] Delete the most expensive edge that does not disconnect the graph 4 b c 20 5 11 8 a d 7 22 e

Why do the greedy algorithms work? For simplicity, assume all edge costs are distinct

Edge inclusion lemma Let S be a subset of V, and suppose e = (u, v) is the minimum cost edge of E, with u in S and v in V-S e is in every minimum spanning tree of G Or equivalently, if e is not in T, then T is not a minimum spanning tree e S V - S

Proof Suppose T is a spanning tree that does not contain e e is the minimum cost edge between S and V-S Proof Suppose T is a spanning tree that does not contain e Add e to T, this creates a cycle The cycle must have some edge e1 = (u1, v1) with u1 in S and v1 in V-S T1 = T – {e1} + {e} is a spanning tree with lower cost Hence, T is not a minimum spanning tree S V - S e

Optimality Proofs Prim’s Algorithm computes a MST Kruskal’s Algorithm computes a MST Show that when an edge is added to the MST by Prim or Kruskal, the edge is the minimum cost edge between S and V-S for some set S.

Prim’s Algorithm S = { }; T = { }; while S != V choose the minimum cost edge e = (u,v), with u in S, and v in V-S add e to T add v to S

Prove Prim’s algorithm computes an MST Show an edge e is in the MST when it is added to T

Kruskal’s Algorithm Let C = {{v1}, {v2}, . . ., {vn}}; T = { } while |C| > 1 Let e = (u, v) with u in Ci and v in Cj be the minimum cost edge joining distinct sets in C Replace Ci and Cj by Ci U Cj Add e to T

Prove Kruskal’s algorithm computes an MST Show an edge e is in the MST when it is added to T

Reverse-Delete Algorithm Lemma: The most expensive edge on a cycle is never in a minimum spanning tree

Dealing with the assumption of no equal weight edges Force the edge weights to be distinct Add small quantities to the weights Give a tie breaking rule for equal weight edges

Application: Clustering Given a collection of points in an r-dimensional space, and an integer K, divide the points into K sets that are closest together

Distance clustering Divide the data set into K subsets to maximize the distance between any pair of sets dist (S1, S2) = min {dist(x, y) | x in S1, y in S2}

Divide into 2 clusters

Divide into 3 clusters

Divide into 4 clusters

Distance Clustering Algorithm Let C = {{v1}, {v2},. . ., {vn}}; T = { } while |C| > K Let e = (u, v) with u in Ci and v in Cj be the minimum cost edge joining distinct sets in C Replace Ci and Cj by Ci U Cj

K-clustering