CSCI 256 Data Structures and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.

Slides:



Advertisements
Similar presentations
Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
Advertisements

Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Bioinformatics III1 We will present an algorithm that originated by Ford and Fulkerson (1962). Idea: increase the flow in a network iteratively until it.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 19.
CSCI 256 Data Structures and Algorithm Analysis Lecture 18 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
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.
CS138A Network Flows Peter Schröder. CS138A Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 4 Tuesday, 2/19/02 Graph Algorithms: Part 2 Network.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network.
Feasible Flow Network : A digraph with a nonnegative capacity c(e) on each edge e and a distinguished source node s and sink node t. Flow: A flow f assign.
Network Flow & Linear Programming Jeff Edmonds York University Adapted from NetworkFlow.ppt.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Lecture 5 Wednesday, 10/4/06 Graph Algorithms: Part 2.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Flow Networks Formalization Basic Results Ford-Fulkerson Edmunds-Karp Bipartite Matching Min-cut.
MAX FLOW CS302, Spring 2013 David Kauchak. Admin.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 11, 2014.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
10. Lecture WS 2006/07Bioinformatics III1 V10: Network Flows V10 follows closely chapter 12.1 in on „Flows and Cuts in Networks and Chapter 12.2 on “Solving.
Maximum Flow. p2. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity u.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
Chapter 7 April 28 Network Flow.
15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.
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.
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.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 23.
CSCE 3110 Data Structures & Algorithm Analysis Graphs (I) Reading: Chap.9, Weiss.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Markov Random Fields in Vision
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
CS4234 Optimiz(s)ation Algorithms
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Network Flow 2016/04/12.
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Network Flow and Connectivity in Wireless Sensor Networks
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Algorithms (2IL15) – Lecture 7
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Lecture 22 Network Flow, Part 2
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

CSCI 256 Data Structures and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some by Iker Gondra

Cuts Def: An s-t cut is a partition (A, B) of V with s  A and t  B Def: The capacity of a cut (A, B) is: s t Capacity = = 30 A

Cuts Def: An s-t cut is a partition (A, B) of V with s  A and t  B Def: The capacity of a cut (A, B) is: s t A Capacity = = 62

Minimum Cut Problem Min s-t cut problem: Find an s-t cut of minimum capacity s t A Capacity = = 28

Find a Minimum Cut u st v 40 10

Find a Minimum Cut s t a b c d e f g h

Interesting point We’ll see -- problem of finding min cut is solved using FF technique Definition: the net flow across the cut = sum of the flows out of A minus the sum of the flows into A ( written as f out (A) –f in (A) )

Flows and Cuts Flow value lemma: Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s: s t Value = 24 4 A

Flows and Cuts Flow value lemma: Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s: s t Value = = A

Flows and Cuts Flow value lemma: Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s: s t Value = = 24 4 A

Let us see how to prove the flow value lemma Proof: v(f) =  f(e) =  f(e) -  f(e) (def and s is source) e out of s e out of s e into s = f out (s) - f in (s) (definition) =  ( f out (v) - f in (v) ) conservation: nodes in A except s are internal v in A =  (  f(e) -  f(e) ) (definition) v in A e out of v e into v =  f(e) -  f(e) = f out (A) –f in (A) e out of A e into A (reason for second-last equality: if e has both ends in A, f(e) appears once with a + and once with a – and they cancel; if e has tail in A it appears with a +; if it has its head in A it appears with a minus).

Flows and Cuts Flow value lemma: Let f be any flow, and let (A, B) be any s-t cut. Then Proof: previous slide Thus by watching the amount of flow f sends across a cut we can measure the value of the flow – it is the amount out minus the amount in.

Relationship of Flows and Cuts We shall show: Let f be any flow, and let (A, B) be any s- t cut. Then the value of the flow is at most the capacity of the cut Cut capacity = 30  Flow value  30 s t Capacity = 30 A

Flows and Cuts Flow/Cut Lemma : Let f be any flow. Then, for any s-t cut (A, B) we have v(f)  cap(A, B) Proof: = v(f) = f out (A) - f in (A) flow value lemma (and definition) ≤ f out (A) =  f(e) definition e out of A ≤  c(e) capacity condition e out of A = c(A,B) definition The corollary below follows from the flow/cut lemma – do you see why??? (Focus on the two any’s in the statement of the lemma)

Certificate of Optimality Corollary: Let f be any flow, and let (A, B) be any cut. If v(f) = cap(A, B), then f is a max flow and (A, B) is a min cut Value of flow = 28 Cut capacity = 28  Flow value  s t A

The Ford-Fulkerson Algorithm terminates when the flow f has no s-t path in G f This is the property needed to prove its maximality

Max-Flow = Min Cut Theorem: If f is an s-t flow such that there is no s-t path in G f, then there is an s-t cut (A*,B*) for which v(f) = c(A*,B*). Consequently, f has the maximum value of any flow in G and (A*,B*) has the minimum capacity of any s-t cut. Proof: The second statement is the above corollary; so all we need to do is prove the first statement. Assume we have an s-t flow such that there is no s-t path in G f.Here is how to find (A*,B*): Let A* denote the set of nodes {v} such that there is an s-v path in G f. Let B* = V - A*.; then:

Proof of Max-Flow Min-Cut Theorem 1. (A*, B*) is a cut (Why?? --- well s is in A* and t must be in B* as there is no s-t path in G f ) 2. If e=(u,v) is an edge in G with u in A* and v in B*, then f(e) = c(e) (Why?? If not, e is a forward in edge in G f and thus there would be an s-v path in G f – impossible as v is in B*) 3. In a similar manner we can show that if e’ = (u’, v’) is an edge in G with u’ in B* and v’ in A*, then f(e’) = 0 (if not consider the backward edge (v’,u’) in G f ; it gives rise to an s-u’ path in G f (via s-v’-u’) – impossible as u’ is in B*) From 2 and 3 we conclude that all edges e out of A* are completely saturated with flow (i.e., f(e) = c(e)) while all edges e into A* are completely unused (i.e., f(e) = 0).

Proof of Max-Flow Min-Cut Theorem Thus: v(f) = f out (A*) – f in (A*) flow value lemma ((A*, B*) is a cut) = Σ f(e) - Σ f(e) definition e out of A* e into A* = Σ c(e) - 0 previous slide justifies this e out of A* = c(A*,B*) definition

Max-Flow Min-Cut Theorem Ford-Fulkerson algorithm finds a flow where the residual graph G f is disconnected, thus we can’t increase the flow any more; hence FF finds a maximum flow. If we want to find a minimum cut, we begin by finding a maximum flow. Then using the G f obtained by FF, perform a BFS to determine the set of nodes A* that s can reach. If B* = V–A*, (A*,B*) is a cut of minimum capacity.