Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
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.
The Maximum Network Flow Problem. CSE Network Flows.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 The Max Flow Problem. 2 Flow networks Flow networks are the problem instances of the max flow problem. A flow network is given by 1) a directed graph.
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.
The max flow problem
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
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.
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.
Maximum Flow Chapter 26.
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
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 Problem (Thanks to Jim Orlin & MIT OCW)
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Flow Networks & Flows.
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
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.
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.
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.
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:
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
Instructor Neelima Gupta Edited by Divya Gaur(39, MCS '09) Thanks to: Bhavya(9), Deepika(10), Deepika Bisht(11) (MCS '09)
The Maximum Network Flow Problem
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Network Flow What is a network? Flow network and flows
The Maximum Network Flow Problem
Maximum Flow Chapter 26.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
CS4234 Optimiz(s)ation Algorithms
Algorithms and Networks Hans Bodlaender
Richard Anderson Lecture 23 Network Flow
Lecture 22 Network Flow, Part 2
Max Flow – Min Cut Problem
Network Flow and Connectivity in Wireless Sensor Networks
Introduction to Maximum Flows
Flow Networks Topics Flow Networks Residual 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
Flow Networks General Characteristics Applications
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
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:

Max Flow – Min Cut Problem

Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material flow through conduit) Liquid flow through pipes Parts through assembly line Current through electrical network, etc

Flow Networks Directed graph G = (V, E) Only one Source(s) and one Sink(t) Weight on each edge = Capacity of the edge if (u, v)  E then Capacity is non-negative, i.e. c(u, v) ≥ 0 if (u, v)  E then Capacity is assumed zero, i.e. c(u, v) = 0

Flow Networks and Flows flow(f) in Flow Network(G) is a real-valued function f: V x V → R f(u, v) is flow from vertex u to vertex v. flow f(u, v) can be positive, negative or zero Constraints on flow : 1. Capacity constraint : f(u, v) ≤ c(u, v), for all u, v  V 2. Skew symmetry constraint : f(u, v) = - f(v, u)

Flow Networks and Flows (Contd.) 3. Flow conservation constraint : Total net flow at vertex must equal 0. ∑ j f(i, j) - ∑ k f(k, i) = 0 for all i  V – {s, t} flow in equals flow out i j1j1 j3j3 j2j2 k3k3 k2k2 k1k1 jnjn k4k4

Maximum Flow We refer a flow f as maximum if it is feasible and maximize ∑ k f(s, k). Where f(s, k) is flow out of source s. Problem: Objective: To find a maximum flow s t 2 1 (6/10) (7/8) (1/1) (5/6) (8/10) (flow/capacity)

Multiple source – Multiple sink Network Convert this problem to single source - single sink. s3s3 s4s4 s5s5 s2s2 s1s1 t3t3 t2t2 t1t Factories Warehouses

Conversion to flow Network Add a super – source with infinite weighted edges emanting out to original sources Add a super – sink with edges of infinite weight from original sinks s3s3 s4s4 s5s5 s2s2 s1s1 t3t3 t2t2 t1t Super-source Factories Warehouses Super-sink s t        

Another Example : Find a feasible match Assign persons to tasks such that each task is assigned to a person and each person is assigned to a task in feasible manner personstasks

Transformation to maximum flow problem personstasks s t

Ford-Fulkerson Algorithm for Max Flow Key ingredients:- Residual Networks Augmenting Paths Cut Limitations :- Flow should be integral or rational On each iteration residual capacity should be integral

The Residual Network s 1 2 t (8/10) (7/8) (1/1) (6/10) (5/6) s 1 2 t uv f (u, v) / c (u, v) uv c (u, f) – f (u, v) f (u, v) Flow Network Residual Network (flow / capacity) Residual capacity r (u,v)

Augmenting Paths An augmenting path is a path from s to t in the residual network. The Residual capacity of augmented path P is  P  = min {r(i, j): (i, j)  P} Augmentation along P Add  P  in each arc along P in  flow network Modify residual capacities in residual network r(u, v) = r(u, v) -  P  and  r(v, u) = r(v, u) +  P  for u, v  P s 1 2 t s 1 2 t

Cut An (S,T)-cut in a flow network G = (V,E) is a partition of vertices V into two disjoint subsets S and T such that s  S, t  T e.g., S = { s, 1 } and T = { 2, t }. The capacity of a cut (S,T) is CAP(S,T) =  u  S  v  T c(u,v) s 1 2 t (9/10) (8/8) (1/1) (7/10) (6/6)

The Ford Fulkerson Maximum Flow Method Begin x := 0; create the residual network G(x); while there is some directed path from s to t in G(x) do begin let P be a path from s to t in G(x);  :=  (P); send  units of flow along P; update the residual capacities; end end {the flow x is now maximum}.

Proof of Correctness of the Algorithm Assume that all data are integral. Lemma: At each iteration all residual capacities are integral. Proof: By assumption it is true at beginning. Assume it is true after the first k-1 augmentations, and consider augmentation k along path P. The residual capacity  of P is the smallest residual capacity on P, which is integral. After updating, we modify residual capacities by 0, or , and thus residual capacities stay integral.

Proof of finiteness of Algorithm Proof: The capacity of each augmenting path is at least 1. The augmentation reduces the residual capacity of some arc (s, j) and does not increase the residual capacity of (s, i) for any i. So, the sum of the residual capacities of arcs out of s keeps decreasing, and is bounded below by 0. Number of augmentations is O(nU), where U is the largest capacity in the network.

Indication of Optimum Flow There is no augmenting path in the residual network. s 1 2 t (9/10) (8/8) (1/1) (7/10) (6/6) s 1 2 t

Indication of Optimum Flow (Contd.) Flow across the network is equal to the capacity of some cut (Max Flow Min Cut Theorem) s 1 2 t (9/10) (8/8) (1/1) (7/10) (6/6)

Weak Duality Theorem for the Max Flow Problem Theorem: If f is any feasible flow and if (S,T) is an (s,t)-cut, then the flow | f | from source to sink in the network is at most CAP(S,T). Proof: We define the flow across the cut (S,T) to be f(S,T) =  i  S  j  T f(i, j) -  i  S  j  T f(j, i) ST

Flows across different cuts s 1 2 t (9/10) (8/8) (1/1) (7/10) (6/6) s 1 2 t (9/10) (8/8) (1/1) (7/10) (6/6) s 1 2 t (9/10) (8/8) (1/1) (7/10) (6/6)  S  T  S/T cut If S = {s}, then the flow across (S, T) is = 15 If S = {s,1}, then the flow across (S, T) is = 15 If S = {s,2}, then the flow across (S, T) is – 1 = 15

More on Flows Across Cuts Claim: Let (S,T) be any s-t cut. Then f(S,T) = | f | = flow into t. Proof: Add the conservation of flow constraints for each node i  S - {s} to the constraint that the flow leaving s is |f|. The resulting equality is f(S,T) = |f|.   j f(i, j) -  k f(k, i) = 0 for each i  {S} - s   j f(s, j) = | f | ST

More on Flows Across Cuts Claim: The flow across (S,T) is at most the capacity of a cut. Proof: If i  S, and j  T, then f(i, j)  c(i, j). If i  T, and j  S, then f(i, j)  0. f(S,T) =  i  S  j  T f(i, j) -  i  S  j  T f(j, i) CAP(S,T) =  i  S  j  T c(i, j) -  i  S  j  T 0

Max Flow Min Cut Theorem Theorem: (Optimality conditions for max flows). The following are equivalent. 1. A flow x is maximum. 2. There is no augmenting path in G(x). 3. There is an s-t cutset (S, T) whose capacity is the flow value of x. Corollary: (Max-flow Min-Cut). The maximum flow value is the minimum value of a cut. Proof of Theorem: 1  2. (not 2  not 1) Suppose that there is an augmenting path in G(x). Then x is not maximum.

Max Flow Min Cut Theorem Contd. 3  1. Let v = F x (S, T) be the flow from s to t. By assumption, v = CAP(S, T). By weak duality, the maximum flow is at most CAP(S, T). Thus the flow is maximum. 2  3. Suppose there is no augmenting path in G(x). Claim: Let S be the set of nodes reachable from s in G(x). Let T = N\S. Then there is no arc in G(x) from S to T.

Thus i  S and j  T  f(i, j) = c(i, j) i  T and j  S  f(i, j) = 0. It follows that F x (S,T) =  i  S  j  T f(i, j) -  i  S  j  T f(j, i) =  i  S  j  T c(i, j) -  i  S  j  T 0 = CAP(S,T) There is no arc from S to T in G(x) Max Flow Min Cut Theorem Contd. ST Saturated Reachable from s Not Reachable from s.s.s.t.t0

27 Limitation of Algorithm : example 1 s 1 2 t MM M M 1 M >> 1 Termination even with integral flow and few nodes can take large no. of steps. Depends on path selection and capacity of flow network. Flow Network  Flow

28 After 1st augmentation s 1 2 t M-1M M Residual Network

29 After 2nd augmentation s 1 2 t M

30 After 3rd augmentation s 1 2 t M-2M-1 M-2 M

31 After 2M augmentations s 1 2 t M M M M 1

32 s3 4 t m r mm Flow Network 1 2 m m m 1 1 m >> 1 1/2 < r < 1 Limitation of Algorithm (Non termination for irrational flow)

33 Flow in Flow Network Residual Network 3 4 r tS After 1st augmentation

34 Flow in Flow Network Residual Network r r 3 4 r r 3 4 r 1 2 After 2nd augmentation

35 Flow in Flow Network Residual Network 1-r 3 4 r r r 3 r 1 2 After 3rd augmentation

36 Flow in Flow NetworkResidual Network 3 4 2r r 1 1-r After 4th augmentation

37 Residual Network Flow in Flow Network 3 4 2r r 1-r After 5th augmentation

Non termination in irrational flow aiai a i a i - a i+1 = a i+2 a i+1 - (a i - a i+1 ) = a i+3 And this goes on …………….

39 Summary and Extensions 1. Augmenting path theorem 2. Ford-Fulkerson Algorithm 3. Duality Theory. 4. Computational Speedups.