A Simple Min-Cut Algorithm Joseph Vessella Rutgers-Camden 1.

Slides:



Advertisements
Similar presentations
Two Segments Intersect?
Advertisements

Single Source Shortest Paths
Comp 122, Spring 2004 Greedy Algorithms. greedy - 2 Lin / Devi Comp 122, Fall 2003 Overview  Like dynamic programming, used to solve optimization problems.
“Devo verificare un’equivalenza polinomiale…Che fò? Fò dù conti” (Prof. G. Di Battista)
EMIS 8374 Vertex Connectivity Updated 20 March 2008.
1 Lecture 5 (part 2) Graphs II Euler and Hamiltonian Path / Circuit Reading: Epp Chp 11.2, 11.3.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
CSL758 Instructors: Naveen Garg Kavitha Telikepalli Scribe: Manish Singh Vaibhav Rastogi February 7 & 11, 2008.
Chapter 23 Minimum Spanning Trees
Tirgul 12 Algorithm for Single-Source-Shortest-Paths (s-s-s-p) Problem Application of s-s-s-p for Solving a System of Difference Constraints.
CPSC 411, Fall 2008: Set 9 1 CPSC 411 Design and Analysis of Algorithms Set 9: More Graph Algorithms Prof. Jennifer Welch Fall 2008.
HW2 Solutions. Problem 1 Construct a bipartite graph where, every family represents a vertex in one partition, and table represents a vertex in another.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 13 Minumum spanning trees Motivation Properties of minimum spanning trees Kruskal’s.
Karger’s Min-Cut Algorithm Amihood Amir Bar-Ilan University, 2009.
Minimum Spanning Trees Definition Algorithms –Prim –Kruskal Proofs of correctness.
Shortest Paths Definitions Single Source Algorithms –Bellman Ford –DAG shortest path algorithm –Dijkstra All Pairs Algorithms –Using Single Source Algorithms.
1 7-MST Minimal Spanning Trees Fonts: MTExtra:  (comment) Symbol:  Wingdings: Fonts: MTExtra:  (comment) Symbol:  Wingdings:
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
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
Graphs – Shortest Path (Weighted Graph) ORD DFW SFO LAX
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.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
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.
Introduction to Algorithms L ECTURE 14 (Chap. 22 & 23) Greedy Algorithms I 22.1 Graph representation 23.1 Minimum spanning trees 23.1 Optimal substructure.
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.
Introduction to Algorithms Jiafen Liu Sept
CSE 2331 / 5331 Topic 12: Shortest Path Basics Dijkstra Algorithm Relaxation Bellman-Ford Alg.
A deterministic near-linear time algorithm for finding minimum cuts in planar graphs Thank you, Steve, for presenting it for us!!! Parinya Chalermsook.
Presenter : Kuang-Jui Hsu Date : 2011/3/24(Thur.).
1 Prim’s algorithm. 2 Minimum Spanning Tree Given a weighted undirected graph G, find a tree T that spans all the vertices of G and minimizes the sum.
and 6.855J March 6, 2003 Maximum Flows 2. 2 Network Reliability u Communication Network u What is the maximum number of arc disjoint paths from.
Minimum- Spanning Trees
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSCE 411 Design and Analysis of Algorithms Set 9: More Graph Algorithms Prof. Jennifer Welch Spring 2012 CSCE 411, Spring 2012: Set 9 1.
Prof. Swarat Chaudhuri COMP 382: Reasoning about Algorithms Fall 2015.
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.
TIRGUL 10 Dijkstra’s algorithm Bellman-Ford Algorithm 1.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Midwestern State University Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm 1.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Introduction to Algorithms
Minimum Spanning Trees
Lecture 12 Algorithm Analysis
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
CS 583 Analysis of Algorithms
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Lecture 12 Algorithm Analysis
Problem Solving 4.
Lecture 13 Algorithm Analysis
Minimum Spanning Trees
Lecture 13 Algorithm Analysis
Minimum Spanning Tree.
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
Introduction to Algorithms: Greedy Algorithms (and Graphs)
Lecture 12 Algorithm Analysis
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Chapter 23: Minimum Spanning Trees: A graph optimization problem
Minimum Spanning Trees
Presentation transcript:

A Simple Min-Cut Algorithm Joseph Vessella Rutgers-Camden 1

The Problem Input: Undirected graph G =( V, E ) Edges have non-negative weights Output: A minimum cut of G 2

Cut Example Weight of this cut: 11 Weight of min cut: 4 3 Cut: set of edges whose removal disconnects G Min-Cut: a cut in G of minimum cost

s-t Cut Example Weight of this a - d cut: 11 Weight of min a - d cut: 4 4 s - t cut: cut with s and t in different partitions s = a and t = d

Naive Solution Check every possible cut Take the minimum Running time: O(2 n ) 5

Previous Work Ford-Fulkerson, 1956 Input: Directed Graph with weights on edges and two vertices s and t Output: Directed min cut between s and t 6

Possible Solution Make edges bidirected Fix an s, try all other vertices as t Return the lowest cost solution Running time: O( n x n 3 ) = O( n 4 ) 7

Previous Work Hao & Orlin, 1992, O( nm log( n ²/ m )) Nagamochi & Ibaraki, 1992, O( nm + n ²log( n )) Karger & Stein (Monte Carlo), 1993, O( n ²log 3 ( n )) Stoer & Wagner, JACM 1997, O( nm + n ²log( n )) 8

The Algorithm MinCutPhase( G, w ): a ← arbitrary vertex of G A ← ( a ) While A ≠ V v ← vertex most tightly connected to A A ← A U ( v ) s and t are the last two vertices (in order) added to A Return cut( A-t, t ) 9

Most Tightly Connected Vertex MTCV is the vertex whose sum of edge weights into A is max. 10

The Algorithm MinCutPhase( G, w ): a ← arbitrary vertex of G A ← ( a ) While A ≠ V v ← vertex most tightly connected to A A ← A U ( v ) s and t are the last two vertices (in order) added to A Return cut( A-t, t ) 11

Example 12 A : ( a ) A : ( a, b )

Example 13 A : ( a, b ) A : ( a, b, c )

Example 14 A : ( a, b, c ) A : ( a, b, c, d )

Example 15 A : ( a, b, c, d ) A : ( a, b, c, d, e )

Example 16 A : ( a, b, c, d, e ) A : ( a, b, c, d, e, f )

Example 17 s = e and t = f

Example Merge( G, e, f ): G ← G \{ e, f } U { ef } For v ∈ V, v ≠ { ef } w( ef, v ) is sum of w( e, v ) and w( f, v ) in orig. graph 18

The Algorithm MinCutPhase( G, w ): a ← arbitrary vertex of G A ← ( a ) While A ≠ V v ← vertex most tightly connected to A A ← A U ( v ) s and t are the last two vertices (in order) added to A Return cut( A-t, t ) 19

Key Result Theorem: MinCutPhase returns a min s - t cut 20

Implications What if min cut of G separates s and t ? 21

Implications What if min cut of G separates s and t ? Then min s - t cut is also a min cut of G 22

Implications What if min cut of G separates s and t ? Then min s - t cut is also a min cut of G What if min cut of G does not separate s and t ? 23

Implications What if min cut of G separates s and t ? Then min s - t cut is also a min cut of G What if min cut of G does not separate s and t ? Then s and t are in the same partition of min cut 24

The Algorithm MinCut( G,w): w(minCut) ← ∞ While | V | > 1 s - t -phaseCut ← MinCutPhase( G, w ) if w( s - t -phaseCut) < w(minCut) minCut ← s - t -phaseCut Merge( G, s, t ) Return minCut 25

Merge( G, e, f ) Merge( G, e, f ): G ← G \{ e, f } U { ef } For v ∈ V, v ≠ { ef } w( ef, v ) is sum of w( e, v ) and w( f, v ) in orig. graph 26

The Algorithm MinCut( G,w): w(minCut) ← ∞ While | V | > 1 s - t -phaseCut ← MinCutPhase( G, w ) if w( s - t -phaseCut) < w(minCut) minCut ← s - t -phaseCut Merge( G, s, t ) Return minCut 27

Example We already did one MinCutPhase 28 s = e and t = f

The Algorithm MinCut( G,w): w(minCut) ← ∞ While | V | > 1 s - t -phaseCut ← MinCutPhase( G, w ) if w( s - t -phaseCut) < w(minCut) minCut ← s - t -phaseCut Merge( G, s, t ) Return minCut 29

Example 30 A: (a)A: (a,b)

Example 31 A: (a,b)A: (a,b,c)

Example 32 A: (a,b,c)A: (a,b,c,d)

Example 33 A : ( a, b, c, d ) s = d and t = ef

Example 34 A: (a,b,c,d)

Example 35 A: (a)A: (a,b)

Example 36 A: (a,b)A: (a,b,c)

Example 37 A : ( a, b, c ) s = c and t = efd

Example 38 A: (a)A: (a,b)

Example 39 A : ( a, b ) s = b and t = cefd

Example 40 A: (a)

Example 41 A : ( a ) s = a and t = cefdb

Example We found the min cut of G as 4 when we were in the following MinCutPhase 42

The Algorithm MinCut( G,w): w(minCut) ← ∞ While | V | > 1 s - t -phaseCut ← MinCutPhase( G, w ) if w( s - t -phaseCut) < w(minCut) minCut ← s - t -phaseCut Merge( G, s, t ) Return minCut 43

The Key MinCut( G ) = Minimum of all s - t cuts in graph 44

Correctness Merge removes many redundant cuts We only consider when merged vertices are on same side of cut By end of MinCut( G ), we consider min cuts between all pairs of vertices 45

Correctness 46 MinCutPhase( G, w ): a ← arbitrary vertex of G A ← ( a ) While A ≠ V v ← vertex most tightly connected to A A ← A U ( v ) s and t are the last two vertices (in order) added to A Return cut( A-t, t )

Correctness 47 Theorem: ( A - t, t ) is always a min s - t cut Proof: We want to show that w( A - t, t ) ≤ w( C ) for any arbitrary s - t cut C

Notation A ← ( a, b, c, d, e, f ) A v : set of vertices added to A before v A d ← { a, b, c } 48 C v : cut of A v U { v } induced by C C: arbitrary s - t cut

Notation 49 A: ( a, b, c, d, e, f ) CeCe C

Active Vertex vertex in A in the opposite partition of C from the one before it 50 A : ( a, b, c, d, e, f ) C

Correctness Lemma: For all active vertices v, w( A v, v ) ≤ w( C v ) 51

Correctness Since t is always active and C t = C w( A t, t ) ≤ w( C ) 52 Thus MinCutPhase returns a min s - t cut Theorem: ( A - t, t ) is always a min s - t cut Proof: By the lemma, for an active vertex v w( A v, v ) ≤ w( C v )

Correctness Lemma: For all active vertices v, w( A v, v ) ≤ w( C v ) Proof: Induction on the no. of active vertices, k Base case: k = 1, claim is true 53 A: ( a, b, c, d ) CdCd w( A d, d ) = w( C d )

Correctness IH: Assume inequality holds true up to u v : first active vertex after u w( A v, v ) = w( A u, v ) + w( A v - A u, v ) 54 += u = d and v = f A : ( a, b, c, d, e, f )

Correctness ≤ w( C u ) + w( A v - A u, v ) (by IH) ≤ w( C v ) 55 w( A v, v ) = w( A u, v ) + w( A v - A u, v ) ≤ w( A u, u ) + w( A v - A u, v ) ( u is MTCV)

Correctness Edges crossing ( A v - A u, v ) cross C Contribute to C v but not C u 56 u = d and v = f A : ( a, b, c, d, e, f ) C = C f (A v - A u, v) CdCd

Summary Lemma: For all active vertices v, w( A v, v ) ≤ w( C v ) Theorem: ( A - t, t ) is always a min s - t cut 57

Running Time MinCutPhase( G, a ): a ← arbitrary vertex of G A ← ( a ) While A ≠ V v ← vertex most tightly connected to A A ← A U ( v ) s and t are the last two vertices (in order) added to A Return cut( A-t, t ) 58

Running Time MinCutPhase( G, a ): a ← arbitrary vertex of G A ← ( a ) While A ≠ V v ← vertex most tightly connected to A A ← A U ( v ) s and t are the last two vertices (in order) added to A Return cut( A-t, t ) 59

Running Time Vertices not in A : priority queue with key key( v ) = w( A, v ) Can extract MTCV in log( n ) When v added to A, for each neighbor u of v key( u ) = key( u ) + w( u, v ) So, we update the priority queue once per edge and get O( m + n log( n )) per MinCutPhase 60

The Algorithm MinCut( G,w): w(minCut) ← ∞ While | V | > 1 s - t -phaseCut ← MinCutPhase( G, w ) if w( s - t -phaseCut) < w(minCut) minCut ← s - t -phaseCut Merge( G, s, t ) Return minCut 61

Running Time MinCut calls MinCutPhase n times Get overall time of O( nm + n 2 log( n )) 62

Reference M. Stoer and F. Wagner. A Simple Min-Cut Algorithm, JACM,

Thank You! 64