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.

Slides:



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

1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
Network Optimization Models: Maximum Flow Problems
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
1 Augmenting Path Algorithm s t G: Flow value = 0 0 flow capacity.
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.
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.
Section 4.2 Network Flows By Christina Touhey. The flow out of a equals the flow into z. Algorithm 1.Make vertex a: (0, ). 2.Scan the first vertex and.
1 Augmenting Path Algorithm s t G: Flow value = 0 0 flow capacity.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
3 t s the black numbers next to an arc is its capacity.
Network Flow & Linear Programming Jeff Edmonds York University Adapted from NetworkFlow.ppt.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
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 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Network Flow. Network flow formulation A network G = (V, E). Capacity c(u, v)  0 for edge (u, v). Assume c(u, v) = 0 if (u, v)  E. Source s and sink.
CS 4407, Algorithms University College Cork, Gregory M. Provan Network Optimization Models: Maximum Flow Problems In this handout: The problem statement.
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)
& 6.855J & ESD.78J Algorithm Visualization The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem.
The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem Thanks to Jim Orlin & MIT OCW.
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.
3 t s2s2 s1s the black number next to an arc is its capacity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSCI 256 Data Structures and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
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.
A directed graph G consists of a set V of vertices and a set E of arcs where each arc in E is associated with an ordered pair of vertices from V. V={0,
Network Flow.
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
Max-flow, Min-cut Network flow.
CS4234 Optimiz(s)ation Algorithms
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
Network Flow.
Max-flow, Min-cut Network flow.
Network Flow 2016/04/12.
Instructor: Shengyu Zhang
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
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
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
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 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.
Algorithms (2IL15) – Lecture 7
Network Flow CSE 373 Data Structures.
EE5900 Advanced Embedded System For Smart Infrastructure
Max Flow / Min Cut.
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
Network Flow.
Lecture 21 Network Flow, Part 1
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
Introduction to Maximum Flows
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Introduction to Maximum Flows
Network Flow.
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

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 each arc (i,j) such that for each node, except s and t, the total incoming flow is equal to the total outgoing flow (flow conservation), such that fij is at most the capacity uij on arc (i,j); The total amount of flow going out of s (which is equal to the total amount of flow coming into t ) is maximized

the black numbers next to an arc is its capacity 1 3 2 4 3 2 3 1 t 1 1 s 2 4 2 4 4 the black numbers next to an arc is its capacity

Set costs all other arcs at 0 The minimum cost flow circulation (Af=0) 1 3 2 4 3 2 3 1 t 1 1 s 2 4 2 4 4 Cts= -1 Set costs all other arcs at 0 The minimum cost flow circulation (Af=0) maximises the s-t flow

the black numbers next to an arc is its capacity 1 3 2 4 3 2 3 1 t 1 1 s 2 4 2 4 4 the black numbers next to an arc is its capacity Push flow over the path s-1-4-t The bottlenecks on this path are the edges {1,4} and {4,t}. So we can send flow 2 along this path

the black number next to an arc is its capacity 1 3 2 4 2 3 2 2 3 1 t 1 1 s 2 2 4 2 4 4 the black number next to an arc is its capacity the green number next to an arc is the flow on it We can push another extra flow of 1 on the path s-1-3-t. The bottleneck is now {s,1} with remaining capacity 1.

the black number next to an arc is its capacity 1 3 1 2 1 4 3 3 2 2 3 1 t 1 1 s 2 2 4 2 4 4 the black number next to an arc is its capacity the green number next to an arc is the flow on it Since {4,t} is on its capacity, the only path remaining through which we can send extra flow is s-2-4-3-t. Here {4,3} is the bottleneck and thus we can send extra flow of 1

the black number next to an arc is its capacity 1 3 1 2 2 4 3 3 2 2 3 1 t 1 1 1 s 2 2 1 4 2 1 4 4 the black number next to an arc is its capacity the green number next to an arc is the flow on it There are no s-t paths left on which we can send extra flow. So is this the maximal flow?

the residual graph blue arcs (i,j) are forward arcs (fij<uij) 1 3 1 1 2 2 2 4 3 3 2 2 3 3 1 1 t 1 1 1 1 s 2 2 1 3 4 2 1 3 4 4 blue arcs (i,j) are forward arcs (fij<uij) green arcs (j,i) are backward arcs (fij>0) the blue number is the residual capacity of a blue arc the green number is the capacity of a green arc the black number is the original capacity of the arc

the residual graph red arcs form an s-t-path in the residual graph 1 3 1 1 2 2 3 2 3 1 t 1 1 s 2 1 3 2 1 3 4 red arcs form an s-t-path in the residual graph and therefore a flow-augmenting path in the original network

the residual graph red arcs form an augmenting path 1 3 1 1 2 2 3 2 3 1 t 1 1 s 2 1 3 2 1 3 4 red arcs form an augmenting path Augment the flow by the minimum capacity of a red arc, i.e, 1

the residual graph Augment the flow by the minimum capacity of a 1 3 1 1 2 2 3 2 3 1 t 1 1 s 2 1 3 2 1 3 4 Augment the flow by the minimum capacity of a red arc, i.e, 1: - increase the flow by 1 on all arcs corresponding to forward red arcs - decrease the flow by 1 on all arcs corresponding to backward red arcs

the residual graph Augment the flow by the minimum capacity of a 1 3 2 3 1 3 3 1 1 1 t 1 1 s 2 2 2 2 2 2 4 Augment the flow by the minimum capacity of a red arc, i.e, 1: - increase the flow by 1 on all arcs corresponding to forward red arcs - decrease the flow by 1 on all arcs corresponding to backward red arcs Construct the new residual graph

An s-t cut is defined by a set S of the nodes with 1 3 2 4 2 2 3 1 t 1 1 s 2 4 2 4 4 An s-t cut is defined by a set S of the nodes with s in S and t not in S.

An s-t cut is defined by a set S of the nodes with 1 3 2 4 2 2 3 1 t 1 1 s 2 4 2 4 4 S={s,1,2} An s-t cut is defined by a set S of the nodes with s in S and t not in S.

An s-t cut is defined by a set S of the nodes with 1 3 2 4 2 2 3 1 t 1 1 s 2 4 2 4 4 S={s,1,2} An s-t cut is defined by a set S of the nodes with s in S and t not in S Size of cut S is the sum of the capacities on the arcs from S to N\S.

An s-t cut is defined by a set S of the nodes with 1 3 2 4 2 2 3 1 t 1 1 s 2 4 2 4 4 C(S)=u13+u14+u24= 2+2+4=8 An s-t cut is defined by a set S of the nodes with s in S and t not in S Size of cut S is the sum of the capacities on the arcs from S to N\S.

S1 1 3 2 4 2 2 3 1 t 1 1 s 2 4 2 4 4 C(S1)=us1+u24= 2+4=6

S2 S1 C(S1)=us1+u24= 2+4=6 C(S2)=u13+u43+u4t= 2+1+2=5 t s 1 3 2 4 2 2

S2 C(S2)=u13+u43+u4t= 2+1+2=5 Max Flow ≤ Min Cut t s 1 3 2 4 2 2 3 1 1

S2 C(S2)=u13+u43+u4t= 2+1+2=5 Max Flow ≤ Min Cut fs1+fs2 ≤ Min Cut ≤ 5

= the residual graph S2 fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 3 1 3 3 1 1 1 t 1 1 s 2 2 2 2 2 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 Max Flow = Min Cut

= the residual graph S2 fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 3 1 3 3 1 1 1 t 1 1 s 2 2 2 2 2 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 Max Flow = Min Cut Theorem: Max Flow = Min Cut

= Proof sketch of Max Flow=Min Cut S2 fs1+fs2=2+3=5 3 1 3 3 1 1 1 t 1 1 s 2 2 2 2 2 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 There is no s-t-path in the residual graph!!! S2={s,1,2,4} the set of nodes reachable from S

= Proof sketch of Max Flow=Min Cut S2 fs1+fs2=2+3=5 2 2 4 3 2 2 3 0 2 1 1 0 t 1 1 1 0 s 2 2 4 3 2 4 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2

= Proof sketch of Max Flow=Min Cut S2 fs1+fs2=2+3=5 2 2 4 3 2 2 3 0 2 1 1 0 t 1 1 1 0 s 2 2 4 3 2 4 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2 Full capacity of cut is used

= Proof sketch of Max Flow=Min Cut S2 fs1+fs2=2+3=5 2 2 4 3 2 2 3 0 2 1 1 0 t 1 1 1 0 s 2 2 4 3 2 4 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2 Full capacity of cut is used from {3,t} to {S2={s,1,2,4} f32 = 0 f34 = 0

= Proof sketch of Max Flow=Min Cut S2 fs1+fs2=2+3=5 2 2 4 3 2 2 3 0 2 1 1 0 t 1 1 1 0 s 2 2 4 3 2 4 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2 Full capacity of cut is used from {3,t} to {S2={s,1,2,4} f32 = 0 f34 = 0 nothing flows back across the cut

= Proof sketch of Max Flow=Min Cut S2 fs1+fs2=2+3=5 2 2 4 3 2 2 3 0 2 1 1 0 t 1 1 1 0 s 2 2 4 3 2 4 2 4 = fs1+fs2=2+3=5 C(S2)=u13+u43+u4t= 2+1+2=5 from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2 from {3,t} to {S2={s,1,2,4} f32 = 0 f34 = 0 Capacity of the cut is equal to the flow from s to t