Advanced Algorithms Piyush Kumar (Lecture 4: MaxFlow MinCut Applications) Welcome to COT5405.

Slides:



Advertisements
Similar presentations
Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Advertisements

Min-Max Relations, Hall’s Theorem, and Matching-Algorithms Graphs & Algorithms Lecture 5 TexPoint fonts used in EMF. Read the TexPoint manual before you.
15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
Introduction to Markov Random Fields and Graph Cuts Simon Prince
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
EMIS 8374 Vertex Connectivity Updated 20 March 2008.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 8 Network models.
Foreground/Background Image Segmentation. What is our goal? To label each pixel in an image as belonging to either the foreground of the scene or the.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 19.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Lectures on Network Flows
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Advanced Algorithms Piyush Kumar (Lecture 2: Max Flows) Welcome to COT5405 Slides based on Kevin Wayne’s slides.
7.7 Extensions to Max Flow. 2 Circulation with Demands Circulation with demands. n Directed graph G = (V, E). n Edge capacities c(e), e  E. n Node supply.
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
Maximum Flow Applications
Applications of Network Flow Problem. 7.5 Bipartite Matching.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
CSEP 521 Applied Algorithms
Advanced Algorithms Piyush Kumar (Lecture 5: Weighted Matching) Welcome to COT5405 Based on Kevin Wayne’s slides.
Advanced Algorithms Piyush Kumar (Lecture 5: Weighted Matching) Welcome to COT5405 Based on Kevin Wayne’s slides.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 26.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 22 Network.
1 Linear Programming & Flows Instructor: yedeshi
Applications of the Max-Flow Min-Cut Theorem. S-T Cuts SF D H C A NY S = {SF, D, H}, T={C,A,NY} [S,T] = {(D,A),(D,C),(H,A)}, Cap [S,T] =
Advanced Algorithms Piyush Kumar (Lecture 5: Preflow Push) Welcome to COT5405.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
Chapter 7 April 28 Network Flow.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
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.
10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 21 Network.
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Prof. Swarat Chaudhuri COMP 382: Reasoning about Algorithms Fall 2015.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Markov Random Fields in Vision
CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Algorithm Design and Analysis
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Lecture 22 Network Flow, Part 2
Chapter 5. Optimal Matchings
3.3 Applications of Maximum Flow and Minimum Cut
Edmonds-Karp Algorithm
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Network Flow and Connectivity in Wireless Sensor Networks
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
and 6.855J March 6, 2003 Maximum Flows 2
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Lecture 22 Network Flow, Part 2
Piyush Kumar (Lecture 3: Preflow Push)
Presentation transcript:

Advanced Algorithms Piyush Kumar (Lecture 4: MaxFlow MinCut Applications) Welcome to COT5405

Announcements The project list is out, make sure you have a copy. Homework 1 is due NOW. Preliminary Programming assignment 1 is attached on the back of the homework solutions Project Partner / Top 5 choices Due –Before Wednesday morning (9:00am) –Send it to me by . –Who doesn’t have a partner yet (and wants one)? – your choices to : –Fill up the choice sheet now if you can.

Today Complete Preflow Push Discuss Programming assignment 1 –Preliminary Deadline: 26th Bipartite matching/Hall’s theorem Application of MaxFlow MinCut –Image segmentation –Edge Disjoint paths

Applications Max Flow Min Cut

Matching. –Input: undirected graph G = (V, E). –M  E is a matching if each node appears in at most edge in M. –Max matching: find a max cardinality matching. Bipartite Matching

Bipartite matching. –Input: undirected, bipartite graph G = (L  R, E). –M  E is a matching if each node appears in at most edge in M. –Max matching: find a max cardinality matching ' 3' 5' 2 4 2' 4' matching 1-2', 3-1', 4-5' RL

Bipartite Matching Bipartite matching. –Input: undirected, bipartite graph G = (L  R, E). –M  E is a matching if each node appears in at most edge in M. –Max matching: find a max cardinality matching ' 3' 5' 2 4 2' 4' RL max matching 1-1', 2-2', 3-3' 4-4'

Max flow formulation. –Create digraph G' = (L  R  {s, t}, E' ). –Direct all edges from L to R, and assign infinite (or unit) capacity. –Add source s, and unit capacity edges from s to each node in L. –Add sink t, and unit capacity edges from each node in R to t. Bipartite Matching s ' 3' 5' t 2 4 2' 4' 1 1  RL G'

Theorem. Max cardinality matching in G = value of max flow in G'. Pf.  –Given max matching M of cardinality k. –Consider flow f that sends 1 unit along each of k paths. –f is a flow, and has cardinality k. ▪ Bipartite Matching: Proof of Correctness s ' 3' 5' t 2 4 2' 4' 11  ' 3' 5' 2 4 2' 4' G' G

Theorem. Max cardinality matching in G = value of max flow in G'. Pf.  –Let f be a max flow in G' of value k. –Integrality theorem  k is integral and can assume f is 0-1. –Consider M = set of edges from L to R with f(e) = 1. each node in L and R participates in at most one edge in M |M| = k: consider cut (L  s, R  t) ▪ Bipartite Matching: Proof of Correctness ' 3' 5' 2 4 2' 4' G s ' 3' 5' t 2 4 2' 4' 11  G'

Def. A matching M  E is perfect if each node appears in exactly one edge in M. Q. When does a bipartite graph have a perfect matching? Structure of bipartite graphs with perfect matchings. –Clearly we must have |L| = |R|. –What other conditions are necessary? –What conditions are sufficient? Perfect Matching

Notation. Let S be a subset of nodes, and let N(S) be the set of nodes adjacent to nodes in S. Lemma. If a bipartite graph G = (L  R, E), has a perfect matching, then |N(S)|  |S| for all subsets S  L. Perfect Matching No perfect matching: S = { 2, 4, 5 } N(S) = { 2', 5' } ' 3' 5' 2 4 2' 4' L R Pf. Each node in S has to be matched to a different node in N(S).

Marriage Theorem. [Frobenius 1917, Hall 1935] Let G = (L  R, E) be a bipartite graph with |L| = |R|. Then, G has a perfect matching or there is exists S  L such that |N(S)| < |S|. Marriage Theorem Pf: When there is no perfect matching, Use max-flow min-cut theorem on a bipartite graph, to find the cut(A’,B’) < n. Let A = L ∩ A’ Claim 1: N(A)  A’ Claim 2: |R ∩ A’| >= N(A) Claim 3: c(A’,B’) = |L ∩ B’ | + |R ∩ A’| < n

Which max flow algorithm to use for bipartite matching? –Generic augmenting path: O(m val(f*) ) = O(mn). –Capacity scaling: O(m 2 log C ) = O(m 2 ). –Shortest augmenting path: O(m n 1/2 ). Non-bipartite matching. –Structure of non-bipartite graphs is more complicated, but well-understood. [Tutte-Berge, Edmonds-Galai] –Blossom algorithm: O(n 4 ). [Edmonds 1965] –Best known: O(m n 1/2 ). [Micali-Vazirani 1980] Bipartite Matching: Running Time

Image Segmentation

Image segmentation

Image Segmentation Image segmentation. –Central problem in image processing. –Divide image into coherent regions. Ex: To recognize a hand (or face/iris/fingerprint) from the background. (And find out if the person is known to the system)

Image Segmentation Foreground / background segmentation. –Label each pixel in picture as belonging to foreground or background. –V = set of pixels, E = pairs of neighboring pixels. –a i  0 is likelihood pixel i in foreground. –b i  0 is likelihood pixel i in background. –p ij  0 is separation penalty for labeling one of i and j as foreground, and the other as background. Goals. –Accuracy: if a i > b i in isolation, prefer to label i in foreground. –Smoothness: if many neighbors of i are labeled foreground, we should be inclined to label i as foreground. –Find partition (A, B) that maximizes: foreground background

Image Segmentation Formulate as min cut problem. –Maximization. –No source or sink. –Undirected graph. Turn into minimization problem. –Maximizing is equivalent to minimizing –or alternatively

Image Segmentation Formulate as min cut problem. –G' = (V', E'). –Add source to correspond to foreground; add sink to correspond to background –Use two anti-parallel edges instead of undirected edge. st p ij ij ajaj G' bibi

Image Segmentation Consider min cut (A, B) in G'. – A = foreground. –Precisely the quantity we want to minimize. G' st ij A if i and j on different sides, p ij counted exactly once p ij bibi ajaj

Edge Disjoint paths

Disjoint path problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s-t paths. Def. Two paths are edge-disjoint if they have no edge in common. Ex: communication networks. s Edge Disjoint Paths t

Disjoint path problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s-t paths. Def. Two paths are edge-disjoint if they have no edge in common. Ex: communication networks. s Edge Disjoint Paths t

Max flow formulation: assign unit capacity to every edge. Theorem. Max number edge-disjoint s-t paths equals max flow value. Pf.  –Suppose there are k edge-disjoint paths P 1,..., P k. –Set f(e) = 1 if e participates in some path P i ; else set f(e) = 0. –Since paths are edge-disjoint, f is a flow of value k. ▪ Edge Disjoint Paths st

Max flow formulation: assign unit capacity to every edge. Theorem. Max number edge-disjoint s-t paths equals max flow value. Pf.  –Suppose max flow value is k. –Integrality theorem  there exists 0-1 flow f of value k. –Consider edge (s, u) with f(s, u) = 1. by conservation, there exists an edge (u, v) with f(u, v) = 1 continue until reach t, always choosing a new edge –Produces k (not necessarily simple) edge-disjoint paths. ▪ Edge Disjoint Paths st can eliminate cycles to get simple paths if desired

Menger’s theorem In every directed graph with nodes s and t, the maximum number of edge-disjoint s- t paths is equal to the minimum number of edges whose removal separates s from t. Special case of MaxFlow MinCut theorem. We cud use this theorem instead of the MaxFlow MinCut theorem in the proof of Hall’s theorem.

References R.K. Ahuja, T.L. Magnanti, and J.B. Orlin. Network Flows. Prentice Hall, (Reserved in Dirac) K. Mehlhorn and S. Naeher. The LEDA Platform for Combinatorial and Geometric Computing. Cambridge University Press, pagesThe LEDA Platform for Combinatorial and Geometric Computing