Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)

Slides:



Advertisements
Similar presentations
Graph Algorithms - 4 Algorithm Design and Analysis Victor AdamchikCS Spring 2014 Lecture 14Feb 14, 2014Carnegie Mellon University.
Advertisements

Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
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.
Graphs and Trees This handout: Trees Minimum Spanning Tree Problem.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
CSE 421 Algorithms Richard Anderson Lecture 10 Minimum Spanning Trees.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
1 Separator Theorems for Planar Graphs Presented by Shira Zucker.
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
Tirgul 13 Today we’ll solve two questions from last year’s exams.
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.
Introduction to Graph Theory
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
Midwestern State University Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm 1.
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.
Lecture 12-2: Introduction to Computer Algorithms beyond Search & Sort.
Graph Dr. Bernard Chen Ph.D. University of Central Arkansas.
Approximating Minimum Bounded Degree Spanning Tree (MBDST) Mohit Singh and Lap Chi Lau “Approximating Minimum Bounded DegreeApproximating Minimum Bounded.
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.
Minimum spanning trees (MST) Def: A spanning tree of a graph G is an acyclic subset of edges of G connecting all vertices in G. A sub-forest of G is an.
Introduction to Graph Theory
1 Chapter 4 Minimum Spanning Trees Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Spanning tree Lecture 4.
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 & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 11.
Trees.
Introduction to Algorithms
CSE373: Data Structures & Algorithms
Graph theory Definitions Trees, cycles, directed graphs.
COMP 6/4030 ALGORITHMS Prim’s Theorem 10/26/2000.
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
CS 3343: Analysis of Algorithms
1.3 Modeling with exponentially many constr.
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Minimum-Cost Spanning Tree
Connected Components Minimum Spanning Tree
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
CS 583 Analysis of Algorithms
Richard Anderson Lecture 11 Minimum Spanning Trees
Autumn 2015 Lecture 10 Minimum Spanning Trees
Minimum Spanning Tree Algorithms
1.3 Modeling with exponentially many constr.
Richard Anderson Autumn 2016 Lecture 7
Richard Anderson Lecture 10 Minimum Spanning Trees
Algorithms (2IL15) – Lecture 7
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
CSE 373: Data Structures and Algorithms
Text Book: Introduction to algorithms By C L R S
Autumn 2016 Lecture 10 Minimum Spanning Trees
CSE 417: Algorithms and Computational Complexity
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Winter 2019 Lecture 10 Minimum Spanning Trees
CSE 373: Data Structures and Algorithms
CSE 332: Minimum Spanning Trees
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Minimum-Cost Spanning Tree
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Minimum Spanning Trees
Presentation transcript:

Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II) CSE 421 Algorithms Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)

Interval Scheduling What is the expected size of the maximum independent set for random intervals What is the expected size of the maximum intersection for random intervals Method 1: Each interval assigned a random start position and random length from [0,1] Method 2: Random permutation of interval endpoints

Independent Set Maximum independent set only contains small intervals

Maximum Intersection Maximum intersection is at the middle

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 For simplicity, assume all edge costs are distinct

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 11 5 8 20 a d 7 22 e

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 e1 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 e

Reverse-Delete Algorithm Let e be the max cost edge whose removal does not disconnect the graph Let T be a spanning tree of G=(V, E – {e})

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

Shortest paths in directed graphs vs undirected graphs 2 d 2 d 1 1 a a 5 5 4 4 4 4 4 4 e e 1 1 c c s 2 s 2 3 3 3 3 2 2 6 g 6 g b b 3 3 7 7 f f

What about the minimum spanning tree of a directed graph? Must specify the root r Branching: Out tree with root r 2 d 2 d 1 1 a a 5 5 4 4 4 4 4 4 e e 1 1 c c r 2 r 2 3 3 3 3 2 2 6 g 6 g b b 3 3 7 7 f f Assume all vertices reachable from r Also called an arborescence

Finding a minimum branching 10 2 10 2 1 4 4 2 2 2 2 8 4 4

Finding a minimum branching Remove all edges going into r Normalize the edge weights, so the minimum weight edge coming into each vertex has weight zero 7 5 2 4 2 This does not change the edges of the minimum branching

Finding a minimum branching Consider the graph that consists of the minimum cost edge coming in to each vertex If this graph is a branching, then it is the minimum cost branching Otherwise, the graph contains one or more cycles Collapse the cycles in the original graph to super vertices Reweight the graph and repeat the process

Finding a minimum branching 10 2 10 8 1 6 1 2 1 4 4 2 2 2 2 8 4 4 4

Correctness Proof Lemma 4.38 Let C be a cycle in G consisting of edges of cost 0 with r not in C. There is an optimal branching rooted at r that has exactly one edge entering C. The lemma justifies using the edges of the cycle in the branching An induction argument is used to cover the multiple levels of compressing cycles r 1 4