Www.monash.edu.au 1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.

Slides:



Advertisements
Similar presentations
COMP 482: Design and Analysis of Algorithms
Advertisements

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.
15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
Max Flow: Shortest Augmenting Path
Network Optimization Models: Maximum Flow Problems
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.
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.
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.
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.
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.
Chapter 26 Maximum Flow How do we transport the maximum amount data from source to sink? Some of these slides are adapted from Lecture Notes of Kevin.
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.
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)
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
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.
Taken from Kevin Wayne’s slides (Princeton University) COSC 3101A - Design and Analysis of Algorithms 13 Maximum Flow.
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.
Algorithm Design and Analysis (ADA)
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 and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
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.
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.
Prof. Swarat Chaudhuri COMP 382: Reasoning about Algorithms Fall 2015.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Approximation Algorithms Duality My T. UF.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Edmunds-Karp Algorithm: Choosing Good Augmenting Paths
COMP 382: Reasoning about Algorithms
Network Flow 2016/04/12.
Network Flow and applications
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.
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
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of the Copyright Act 1968 (the Act). The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act. Do not remove this notice.

FIT2004 Algorithms & Data Structures L15: Flow Problems Prepared by: Bernd Meyer April 2007

3 Maximum Flow and Minimum Cut Max flow and min cut. –MaxFlow: determine the maximum possible flow from a source node a to a sink node b in some capacity-limited transport network –Min cut is dual to max flow. –Fundamental problems in combinatorial optimization. Many other problems reduce to max flow –scheduling (airlines, trains etc.) –transportation problems –matching problems –network routing –etc.

4 single commodity transport network. directed graph G = (V, E), no parallel edges. s = source, t = sink. c(e) = capacity of edge e. Flow Networks s t capacity source sink

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

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

7 Find an s-t cut of minimum capacity. Minimum Cut Problem s t A Capacity = = 28

8 An s-t flow is a function that satisfies: –(capacity) For each e  E: –(conservation) For each v  V – {s, t}: The value of a flow f is: Flows Value = capacity flow s t

9 An s-t flow is a function that satisfies: –(capacity) For each e  E: –(conservation) For each v  V – {s, t}: The value of a flow f is: Flows Value = capacity flow s t

10 Find s-t flow of maximum value. Maximum Flow Problem capacity flow s t Value = 28

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

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

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

14 Flows and Cuts Weak duality. Let f be any flow, and let (A, B) be any s-t cut. The value of the flow is at most the capacity of the cut. Cut capacity = 30  Flow value  30 s t Capacity = 30 A

15 Certificate of Optimality Corollary. Let f be any flow, let (A, B) be any s-t 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

16 Towards a Max Flow Algorithm Greedy algorithm. –Start with f(e) = 0 for all edge e  E. –Find an s-t path P where each edge has f(e) < c(e). –Augment flow along path P. –Repeat until you get stuck. s 1 2 t Flow value = 0

17 Towards a Max Flow Algorithm Greedy algorithm. –Start with f(e) = 0 for all edge e  E. –Find an s-t path P where each edge has f(e) < c(e). –Augment flow along path P. –Repeat until you get stuck. s 1 2 t Flow value = 20

18 Towards a Max Flow Algorithm greedy = 20 s 1 2 t opt = 30 s 1 2 t This is only a local optimum!

19 Residual Graph Original edge: e = (u, v)  E. –Flow f(e), capacity c(e). Residual edge. –"Undo" flow sent. –e = (u, v) and e R = (v, u). –Residual capacity: Residual graph: G f = (V, E f ). –Residual edges with positive residual capacity. –E f = {e : f(e) 0}. uv 17 6 capacity uv 11 residual capacity 6 flow

20 Example /2 0/3 0/1 0/5 0/30/4 Augmenting path: 1→2 →3 →6 flow/capacity

/2 0/3 0/1 2/5 0/30/4 Augmenting path: 1 →4 →3←2 →5 →6 Example 1 (cont.)

Augmenting path: 1 →4 →3←2 →5 →6 Example 1 (cont., Residual Graph) 2

/2 1/3 1/1 1/5 1/31/4 max flow value = 3 Example 1 (maximum flow)

24 Augmenting Path Algorithm Augment(f, P) { b  bottleneck(P) foreach e  P { if (e  E) f(e)  f(e) + b else f(e R )  f(e) - b } return f } Ford-Fulkerson(G, s, t) { foreach e  E f(e)  0 G f  residual graph while (there exists augmenting path P) { f  Augment(f, P) update G f } return f } forward edge reverse edge

25 Augmenting Path Theorem Augmenting path theorem. Flow f is a max flow iff there are no augmenting paths. Max-flow min-cut theorem. [Ford-Fulkerson 1956] The value of the max flow is equal to the value of the min cut.

26 Ford-Fulkerson: Exponential Number of Augmentations Q. Is generic Ford-Fulkerson algorithm polynomial in input size? (m, n, and log C) A. No. If max capacity is C, then algorithm can take C iterations. s 1 2 t C C C C 1 s 1 2 t C C X 1 C C X X X X X 1 1 X X X 1 0 1

27 Choosing Good Augmenting Paths Use care when selecting augmenting paths. –Some choices lead to exponential algorithms. –Clever choices lead to polynomial algorithms. Goal: –Can find augmenting paths efficiently. –Few iterations. Choose augmenting paths with: [Edmonds-Karp 1972, Dinitz 1970] –Max bottleneck capacity but can we find this cheaply? –Sufficiently large bottleneck capacity. –Shortest augmenting path (fewest edges)

28 Capacity Scaling Intuition. Choosing path with highest bottleneck capacity increases flow by max possible amount. –Don't worry about finding exact highest bottleneck path. –Maintain scaling parameter . –Let G f (  ) be the subgraph of the residual graph consisting of only arcs with capacity at least . 110 s 4 2 t GfGf 110 s 4 2 t G f (100)

29 Capacity Scaling Scaling-Max-Flow(G, s, t, c) { foreach e  E f(e)  0   smallest power of 2 greater than or equal to C G f  residual graph while (   1) { G f (  )   -residual graph while (there exists augmenting path P in G f (  )) { f  augment(f, P) update G f (  ) }    / 2 } return f }

30 Capacity Scaling: Running Time The scaling max-flow algorithm finds a max flow in O(m log C) augmentations. It can be implemented to run in O(m 2 log C) time.