MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)

Slides:



Advertisements
Similar presentations
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.
Advertisements

1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Bioinformatics III1 We will present an algorithm that originated by Ford and Fulkerson (1962). Idea: increase the flow in a network iteratively until it.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
The Maximum Network Flow Problem. CSE Network Flows.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
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
Lectures on Network Flows
1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.
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.
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.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
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.
Maximum Flow Chapter 26.
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
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.
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.
& 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.
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.
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.
Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 23.
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.
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,
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
The Maximum Network Flow Problem
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Maximum Flow Chapter 26.
Richard Anderson Lecture 23 Network Flow
Max Flow – Min Cut Problem
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
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
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Lecture 21 Network Flow, Part 1
Introduction to Maximum Flows
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Introduction to Maximum Flows
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)

What is Network Flow ? Flow network is a directed graph G=(V,E) such that each edge has a non-negative capacity c(u,v)≥0. Two distinguished vertices exist in G namely : Source (denoted by s) : In-degree of this vertex is 0. Sink (denoted by t) : Out-degree of this vertex is 0. Flow in a network is an integer-valued function f defined On the edges of G satisfying 0≤f(u,v)≤c(u,v), for every Edge (u,v) in E.

What is Network Flow ? Each edge (u,v) has a non-negative capacity c(u,v). If (u,v) is not in E assume c(u,v)=0. We have source s and sink t. Assume that every vertex v in V is on some path from s to t. Following is an illustration of a network flow: c(s,v1)=16 c(v1,s)=0 c(v2,s)=0 …

Conditions for Network Flow For each edge (u,v) in E, the flow f(u,v) is a real valued function that must satisfy following 3 conditions : Capacity Constraint : u,v V, f(u,v)  c(u,v) Skew Symmetry :  u,v V, f(u,v)= -f(v,u) Flow Conservation:  u V – {s,t}  f(s,v)=0 vV Skew symmetry condition implies that f(u,u)=0.

The Value of a Flow. The value of a flow is given by : The flow into the node is same as flow going out from the node and thus the flow is conserved. Also the total amount of flow from source s = total amount of flow into the sink t.

Example of a flow Capacity Flow s 1 2 t 10 , 9 8, 8 1, 10, 7 6, 6 Table illustrating Flows and Capacity across different edges of graph above: fs,1 = 9 , cs,1 = 10 (Valid flow since 10 > 9) fs,2 = 6 , cs,2 = 6 (Valid flow since 6 ≥ 6) f1,2 = 1 , c1,2 = 1 (Valid flow since 1 ≥ 1) f1,t = 8 , c1,t = 8 (Valid flow since 8 ≥ 8) f2,t = 7 , c2,t = 10 (Valid flow since 10 > 7) The flow across nodes 1 and 2 are also conserved as flow into them = flow out.

The Maximum Flow Problem In simple terms maximize the s to t flow, while ensuring that the flow is feasible. Given a Graph G (V,E) such that: xi,j = flow on edge (i,j) ui,j= capacity of edge (i,j) s = source node t = sink node Maximize v Subject To Σjxij - Σjxji = 0 for each i ≠s,t Σjxsj = v 0 ≤ xij ≤ uij for all (i,j)  E.

Cuts of Flow Networks A Cut in a network is a partition of V into S and T (T=V-S) such that s (source) is in S and t (target) is in T. 2 5 9 Cut 10 15 15 4 10 s 5 3 8 6 10 t 4 6 15 10 15 4 30 7

Capacity of Cut (S,T) Capacity = 30 2 5 s 3 6 t 4 7 9 Cut 10 15 15 4 8 6 10 t 4 6 15 10 15 Capacity = 30 4 30 7

Min Cut Min s-t cut (Also called as a Min Cut) is a cut of minimum capacity 2 9 5 Min s-t Cut 10 15 15 4 10 s 5 3 8 6 10 t 4 6 15 10 15 Capacity = 28 4 30 7

Flow of Min Cut (Weak Duality) Let f be the flow and let (S,T) be a cut. Then | f | ≤ CAP(S,T). In maximum flow, minimum cut problems forward edges are full or saturated and the backward edges are empty because of the maximum flow. Thus maximum flow is equal to capacity of cut. This is referred to as weak duality. Proof : S T 8 t s 7

Methods Max-Flow Min-Cut Theorem The Ford-Fulkerson Method The Preflow-Push Method

The Ford-Fulkerson Method Try to improve the flow, until we reach the maximum value of the flow The residual capacity of the network with a flow f is given by: The residual capacity (rc) of an edge (i,j) equals c(i,j) – f(i,j) when (i,j) is a forward edge, and equals f(i,j) when (i,j) is a backward edge. Moreover the residual capacity of an edge is always non-negative. s 1 2 t 10 , 9 8, 8 1, 10, 7 6, 6 s 1 2 t 3 8 6 9 7 Residual Network Original Network

The Ford-Fulkerson Method Begin x := 0; // x is the flow. 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 r's; end end {the flow x is now maximum}. Click To See Ford Fulkerson’s Algorithm In Action (Animation)

Augmenting Paths ( A Useful Concept ) Definition: An augmenting path p is a simple path from s to t on a residual network that is an alternating sequence of vertices and edges of the form s,e1,v1,e2,v2,...,ek,t in which no vertex is repeated and no forward edge is saturated and no backward edge is free. Characteristics of augmenting paths: We can put more flow from s to t through p. The edges of residual network are the edges on which residual capacity is positive. We call the maximum capacity by which we can increase the flow on p the residual capacity of p.

The Ford-Fulkerson’s Algorithm FORDFULKERSON(G,E,s,t) FOREACH e  E f(e)  0 Gf  residual graph WHILE (there exists augmenting path P) f  augment(f, P) update Gf ENDWHILE RETURN f AUGMENT(f,P) b  bottleneck(P) FOREACH e  P IF (e  E) // backwards arc f(e)  f(e) + b ELSE // forward arc f(eR)  f(e) - b RETURN f Click To See Ford Fulkerson’s Algorithm In Action (Animation)

Proof of correctness of the algorithm Lemma: At each iteration all residual capacities are integers. Proof: It’s true at the beginning. Assume it’s 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 the residual capacities by 0 or Δ, and thus residual capacities stay integers. Theorem: Ford-Fulkerson’s algorithm is finite Proof: The capacity of each augmenting path is atleast 1. The augmentation reduces the residual capacity of some edge (s,j) and doesn’t increase the residual capacity for some edge (s,i) for any i. So the sum of residual capacities of edges out of s keeps decr- easing, and is bounded below 0. Number of augmentations is O(nC) where C is the largest of the capacity in the network.

When is the flow optimal ? A flow f is maximum flow in G if : The residual network Gf contains no more augmented paths. | f | = c(S,T) for some cut (S,T) (a min-cut) Proof: Suppose there is an augmenting path in Gf then it implies that the flow f is not maximum, because there is a path through which more data can flow. Thus if flow f is maximum then residual n/w Gf will have no more augmented paths. (2) Let v=Fx(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.

The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem 15.082 and 6.855J (MIT OCW)

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 2 s 4 t 3 2 1 3 This is the original network, plus reversals of the arcs.

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 2 s 4 t 3 2 1 3 This is the original network, and the original residual network.

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 2 s 4 t 3 2 1 3 Find any s-t path in G(x)

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 1 2 s 4 t 1 2 3 2 1 1 1 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 1 2 s 4 t 1 2 3 2 1 1 1 3 Find any s-t path

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 1 1 1 s 4 t 1 1 2 3 2 2 1 1 1 1 1 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 1 1 1 s 4 t 1 1 2 3 2 2 1 1 1 1 1 3 Find any s-t path

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 1 1 1 s 4 t 1 2 2 1 3 2 1 1 1 1 1 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 1 1 1 s 4 t 2 1 1 2 2 3 1 1 1 1 1 3 Find any s-t path

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 1 1 1 s 4 t 2 1 1 2 2 1 1 1 1 2 1 1 2 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

Ford-Fulkerson Max Flow 4 2 5 1 3 1 1 2 1 1 1 s 4 t 1 2 1 2 1 2 1 1 2 1 2 1 3 Find any s-t path

Ford-Fulkerson Max Flow 4 3 2 5 1 1 2 3 1 1 1 1 s 4 t 2 1 1 2 1 2 1 1 2 1 1 2 3 Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.

Ford-Fulkerson Max Flow 3 4 2 5 1 1 2 3 1 1 1 1 s 4 t 1 2 1 2 1 2 1 1 2 1 2 1 3 There is no s-t path in the residual network. This flow is optimal

Ford-Fulkerson Max Flow 4 3 2 2 5 5 1 1 2 3 1 1 1 1 s s 4 4 t 2 1 2 1 1 2 1 1 1 2 1 2 3 3 These are the nodes that are reachable from node s.

Ford-Fulkerson Max Flow 1 2 s 4 5 3 t Here is the optimal flow