Main Reference: Sections in CLRS.

Similar documents
1 Motivation and Basic Definitions

Graphs III - Network Flow

Network Flow. Data Structures and Algorithms Andrei Bulatov

Algorithms and Data Structures 2011/12 Week 9 Solutions (Tues 15th - Fri 18th Nov)

The Residual Graph. 12 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Max Flow, Min Cut COS 521. Kevin Wayne Fall Soviet Rail Network, Cuts. Minimum Cut Problem. Flow network.

Soviet Rail Network, 1955

The Residual Graph. 11 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Flow networks, flow, maximum flow. Some definitions. Edmonton. Saskatoon Winnipeg. Vancouver Regina. Calgary. 12/12 a.

Flow networks. Flow Networks. A flow on a network. Flow networks. The maximum-flow problem. Introduction to Algorithms, Lecture 22 December 5, 2001

Today: Max Flow Proofs

Network Flows: Introduction & Maximum Flow

CSC 364S Notes University of Toronto, Spring, The networks we will consider are directed graphs, where each edge has associated with it

Maximum Flow and Minimum Cut

Matching. Slides designed by Kevin Wayne.

! Abstraction for material flowing through the edges. ! G = (V, E) = directed graph, no parallel edges.

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

CSE 521: Design & Analysis of Algorithms I

CS 473G Lecture 15: Max-Flow Algorithms and Applications Fall 2005

Soviet Rail Network, 1955

Problem Set If all directed edges in a network have distinct capacities, then there is a unique maximum flow.

Algorithmic Discrete Mathematics 6. Exercise Sheet

Algorithm Design and Analysis

Network flows. The problem. c : V V! R + 0 [ f+1g. flow network G = (V, E, c), a source s and a sink t uv not in E implies c(u, v) = 0

Algorithm Design and Analysis

Randomized Perfect Bipartite Matching

MAXIMUM FLOW. introduction Ford-Fulkerson algorithm maxflow-mincut theorem

6/3/2009. CS 244 Algorithm Design Instructor: t Artur Czumaj. Lecture 8 Network flows. Maximum Flow and Minimum Cut. Minimum Cut Problem.

Admin MAX FLOW APPLICATIONS. Flow graph/networks. Flow constraints 4/30/13. CS lunch today Grading. in-flow = out-flow for every vertex (except s, t)

Greedy. I Divide and Conquer. I Dynamic Programming. I Network Flows. Network Flow. I Previous topics: design techniques

CMPS 6610/4610 Fall Flow Networks. Carola Wenk Slides adapted from slides by Charles Leiserson

Network Flows UPCOPENCOURSEWARE number 34414

16 Max-Flow Algorithms and Applications

They were originally developed for network problem [Dantzig, Ford, Fulkerson 1956]

4/12/12. Applications of the Maxflow Problem 7.5 Bipartite Matching. Bipartite Matching. Bipartite Matching. Bipartite matching: the flow network

26.1 Flow networks. f (u,v) = 0.

18 Extensions of Maximum Flow

Maximum Flow. Contents. Max Flow Network. Maximum Flow and Minimum Cut

Maximum Flow 5/6/17 21:08. Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

Introduction to Congestion Games

Algorithms. Algorithms 6.4 MAXIMUM FLOW

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 Wayne.

Please Complete Course Survey. CMPSCI 311: Introduction to Algorithms. Approximation Algorithms. Coping With NP-Completeness. Greedy Vertex Cover

Reminder: Flow Networks

6.8 Laplace Transform: General Formulas

Flow Networks. Ma/CS 6a. Class 14: Flow Exercises

April 3, The maximum flow problem. See class notes on website.

Introduction to SLE Lecture Notes

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 11/22/17 6:11 AM

Basic Tools CMSC 641. Running Time. Problem. Problem. Algorithmic Design Paradigms. lg (n!) (lg n)! (lg n) lgn n.2

CS261: A Second Course in Algorithms Lecture #1: Course Goals and Introduction to Maximum Flow

23 Maximum Flows and Minimum Cuts

Laplace Transform. Inverse Laplace Transform. e st f(t)dt. (2)

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 11/22/17 6:11 AM

7.5 Bipartite Matching. Chapter 7. Network Flow. Matching. Bipartite Matching

3/3/2015. Chapter 7. Network Flow. Maximum Flow and Minimum Cut. Minimum Cut Problem

Maximum Flow in Planar Graphs

Maximum Flow 3/3 4/6 1/1 4/7 3/3. s 3/5 1/9 1/1 3/5 2/2. 1/18/2005 4:03 AM Maximum Flow 1

Selfish Routing. Tim Roughgarden Cornell University. Includes joint work with Éva Tardos

Average Case Lower Bounds for Monotone Switching Networks

The Primal Simplex Approach to the QoS Routing Problem

Exponential Sawtooth

, the. L and the L. x x. max. i n. It is easy to show that these two norms satisfy the following relation: x x n x = (17.3) max

Today s topics. CSE 421 Algorithms. Problem Reduction Examples. Problem Reduction. Undirected Network Flow. Bipartite Matching. Problem Reductions

CHAPTER 7: SECOND-ORDER CIRCUITS

Network Flow Applications

Lecture 26. Lucas and Stokey: Optimal Monetary and Fiscal Policy in an Economy without Capital (JME 1983) t t

EECE 301 Signals & Systems Prof. Mark Fowler

Stability in Distribution for Backward Uncertain Differential Equation

20/20 20/20 0/5 0/5 20/20 20/20 5/5 0/5 0/5 5/5 0/20 25/30 20/20 30/30 20/20 0/5 5/5 20/20 0/5 0/5 15/20 15/25 20/20 10/10

Graph Theory: Network Flow

Ford Fulkerson algorithm max-flow min-cut theorem. max-flow min-cut theorem capacity-scaling algorithm

Selfish Routing and the Price of Anarchy. Tim Roughgarden Cornell University

TP B.2 Rolling resistance, spin resistance, and "ball turn"

16 Max-Flow Algorithms

introduction Ford-Fulkerson algorithm

u(t) Figure 1. Open loop control system

Ford-Fulkerson Algorithm for Maximum Flow

Wrap up: Weighted, directed graph shortest path Minimum Spanning Tree. Feb 25, 2019 CSCI211 - Sprenkle

Price of Stability and Introduction to Mechanism Design

Math 2142 Exam 1 Review Problems. x 2 + f (0) 3! for the 3rd Taylor polynomial at x = 0. To calculate the various quantities:

introduction Ford-Fulkerson algorithm

Topics in Combinatorial Optimization May 11, Lecture 22

Warm Up. Correct order: s,u,v,y,x,w,t

23.5. Half-Range Series. Introduction. Prerequisites. Learning Outcomes

Temporal Logic Replication for Dynamically Reconfigurable FPGA Partitioning

Basic Circuit Elements Professor J R Lucas November 2001

Explicit form of global solution to stochastic logistic differential equation and related topics

CHAPTER 6: FIRST-ORDER CIRCUITS

Syntactic Complexity of Suffix-Free Languages. Marek Szykuła

7.5 Bipartite Matching. Chapter 7. Network Flow. Matching. Bipartite Matching

Survivable Routing Meets Diversity Coding

Rectilinear Kinematics

CMU-Q Lecture 3: Search algorithms: Informed. Teacher: Gianni A. Di Caro

Efficient Algorithms for Computing Disjoint QoS Paths

18.03SC Unit 3 Practice Exam and Solutions

Designing Information Devices and Systems I Spring 2019 Lecture Notes Note 17

Flow Network. The following figure shows an example of a flow network:

Transcription:

Maximum Flow Reied 09/09/200 Main Reference: Secion 26.-26. in CLRS. Inroducion Definiion Muli-Source Muli-Sink The Ford-Fulkeron Mehod Reidual Nework Augmening Pah The Max-Flow Min-Cu Theorem The Edmond-Karp algorihm Max Biparie Maching Odd and End

Maximum Flow Main Reference: Secion 26.-26. in CLRS. Gien a direced graph, G = (V, E) : flow nework Source (producer) and deinaion. Inernal Node are warehoue Edge co are capaciie Maximum amoun ha can be hipped oer edge All good hipped ino a warehoue mu leae he warehoue Goal: Ship Maximum amoun (flow) from o. 2

6 2 20 0 9 7 2 A Flow Nework wih capaciie /6 0 / 6/2 /9 6/7 8/20 6/ / 2 9/ A flow wih alue /6 0 / 2/2 /9 7/7 /20 8/ / 2 / A max-flow: alue i 9

A flow nework i a graph G = (V, E). Source V,, ink V,. Eery edge (u, ) E ha capaciy, c(u, ) 0. Aume ha for eery V here i a pah from o and from o. A FLOW i a funcion f : V V R aifying: Capaciy Conrain: u,, V, f(u, ) c(u, ). Skew Symmery: u,, V, f(u, ) = f(, u). Flow Coneraion: u V {, }, V f(u, ) = 0. The VALUE of flow i f = V f(, ).. MAXIMUM-FLOW PROBLEM: Gien G, c,,, find f ha maximize f.

Muli-Source Muli-Sink Problem The baic Max-Flow problem aume ha here i only one ource, and one ink. Suppoe ha here are muliple ource, 2,..., k and muliple ink, 2,..., l. The definiion of a flow remain he ame excep ha he Flow Coneraion propery now become u V {, 2,..., k,, 2,..., l }, V f(u, ) = 0 and our goal i o maximize f = k i= V f( i, ). Thi problem can be reduced o he original one by inroducing a uperource 0, a uperink 0 and edge i ( 0, i ) and j ( j, 0 ), all of which hae capaciy.

A muli-ource muli-ink problem and i equialen ingle-ource ingle-ink erion. 0 2 2 8 6 20 2 7 2 8 0 2 2 8 6 20 2 7 2 8 6

Manipulaing Flow Le X, Y V. We define f(x, Y ) = x X y Y f(x, y). The flow-coneraion conrain hen ju ay u V {, }, f(u, V ) = 0. Lemma: (Proof in Homework) X V, f(x, X) = 0. X, Y V, f(x, Y ) = f(y, X). X, Y, Z V wih X Y = f(x Y, Z) = f(x, Z) + f(y, Z) and f(z, X Y ) = f(z, X) + f(z, Y ) 7

Flow f wa defined a amoun ha leae ource. We now ee ha hi i he ame a amoun ha ener ink.. f = f(, V ) definiion = f(v, V ) f(v, V ) preiou page = f(v, V ) preiou page = f(v, V ) preiou page = f(v, ) + f(v, V ) preiou page = f(v, ) flow coneraion 8

In eery opimizaion problem we hae o deal wih he queion: How can we proe ha our oluion i opimal (maximal/minimal)? A common echnique (for max problem) i o find a good upper-bound on he co of an opimal oluion and hen how ha our oluion aifie ha bound. A CUT S, T of G i a pariion of he erice V = S T, S T =, S, and T. The flow acro he cu i f(s, T). The capaciy of a cu i C(S, T) = x S,y T c(x, y). Noe ha for any cu, f(s, T) c(s, T). 9

/6 0 / 2/2 /9 7/7 /20 8/ / S T 2 / Cu (S, T): S = {,, 2 }, T = {,, }. The flow alue i f = 9 and C(S, T) = 26. Noe ha F C(S, T). 0

Lemma: If S, T i any cu, f any flow hen f C(S, T). Proof: f = f(, V ) = f(, V ) + f(s, V ) = f(s, V ) = f(s, V ) f(s, S) = f(s, V S) = f(s, T) c(s, T) We will now deelop he Ford-Fulkeron mehod for finding max-flow. When FF erminae i proide a flow f and a cu S, T uch ha f = C(S, T), o f i maximal.

The Ford-Fulkeron Mehod I ieraie. Sar wih flow f = 0, ( u,, f(u, ) = 0) A each ep Conruc a reidual nework G f of f indicaing how much capaciy remain o be ued. Find an augmening pah - pah p in G f along which flow can be puhed. puhe f uni of flow along p. Creae new flow f = f + f. Sop when here i no - pah in curren G f. Le S be he e of node reachable from in G f and T = V S. A concluion of FF algorihm, f = c(s, T) o f i opimal. 2

Reidual nework Gien flow f, he reidual nework G f coni of he edge along which we can (ill) puh more flow. The amoun ha can (ill) be puhed acro(u, ) i called he reidual capaciy c f (u, ). c f (u, ) = c(u, ) f(u, ). If here i flow from u o hen f(u, ) > 0 and c f (u, ) i he remaining capaciy on (u, ). If here i flow from o u hen f(u, ) < 0 and c f (u, ) = c(u, ) + f(, u) i he capaciy of (u, ) plu amoun of exiing flow ha can be puhed backward from u o. The Reidual nework G f i G f = (V, E f ) where E f = { (u, ) V V : c f (u, ) > 0 }

/6 0 / 2/2 9 7/7 9/20 2/ / 2 A flow / 2 2 9 2 9 7 I reidual nework

Lemma: Le f be a flow in G = (V, E) and G f i reidual nework. Le f be a flow in G f. Define f+f a (f+f )(u, ) = f(u, )+f (u, ). Then f + f i a flow in G wih alue f + f = f + f. Augmening pah p i a imple - pah in G f. The reidual capaciy of a.p. p i c f (p) = min{c f (u, ) : (u, ) on p}. Le p be an augmening pah in G f and define f p (u, ) = c f (p) if (u, ) i on p c f (p) if (, u) i on p 0 oherwie Lemma: If f i a flow and p an a.p.in G f hen: f p i a flow in G g wih f p = c f (p) > 0. f = f +f p i a flow in G wih f = f + f p > f.

/6 8/ 0 / 2/2 /9 / 2 7/7 /20 / 8 2 2 7 /6 2/ 0 / 2/2 9 / 2 7/7 9/20 / 2 2 9 2 9 7 An iniial flow f. I reidual nework G f and an augmening pah f in G f. The flow f + f and i reidual nework. 6

Opimaliy Theorem: (Max-Flow Min-Cu Theorem) Le f be a flow. Then he following hree condiion are equialen:. f i a maximum flow in G. 2. G f conain no augmening pah. f = C(S, T) for ome (S, T) cu. Proof: () (2): If G f conained an augmening pah p hen f + f p > f o f could no be maximal. (2) (): Le S = {u V : pah from o in G f }. T = V S. Then f(s, T) = f(s,v ) f(s,s) = f(s, V ) = f(, V )+f(s, V ) = f. Now noe ha u S, T, f(u, ) = c(u, ) ince oherwie c f (u, ) > 0 and S. Thu C(S, T) = f(s, T) = f. () (): We preiouly aw ha eery flow f mu aify f C(S, T) o if f = C(S, T), f mu be opimal. 7

The Ford-Fulkeron Mehod Sar wih flow f 0, ( u,, f(u, ) = 0) Conruc reidual nework G f. If G f conain no augmening pah, op (f i opimal by MFMC heorem). Oherwie.. Find an augmening pah ( pah) p in G f 2. Le f p be he flow in G f ha puhe c f (p) uni of flow along p.. Le f = f + f p be new flow in G. 8

6 2 9 20 0 7 /6 /2 /9 20 0 7 / 2 2 / 2 8 0 7 20 /6 /2 7/0 /9 7/7 7/20 / 2 0 2 / 8 7 7 /6 2/2 0 / /9 7/7 /20 / 2 8/ 2 / 8 2 2 7 /6 2/ 2/2 0 / 7/7 2 9 / 9/20 / 2 2 2 9 7 9 9

Running Time & Finiene The FF mehod i no a compleely defined algorihm ince i doen pecify how o chooe he augmening pah. In fac, if he capaciie are irraional, i i poible ha a bad way of chooing he a.p. will lead o a nonerminaing algorihm ha will neer op (i will keep on adding cheaper and cheaper augmening pah). See ecion 6. of he PS book for example. If he capaciie are all ineger hen each c p will be an ineger o he algorihm mu erminae afer f ep, where f i a max-flow. Mainaining he graph G and G f and he flow f uing adjacency li while uing DFS or BFS o find a - pah, he algorihm can hen be implemened o run in O( f E ) ime. Noe: Thi can be normalized o work if he capaciie are raional. 20

Sar wih flow f 0, O( E ) Conruc reidual nework G f. O( E ) If G f conain no augmening pah, op (f i opimal by MFMC heorem). Oherwie. Can be repeaed O( f ) ime.. Find an augmening pah p in G f O( E ) 2. Le f p be he flow in G f ha puhe c f (p) uni of flow along p.. Le f = f + f p be new flow in G. O( E ) 2

A pahological example in which each augmening pah only increae flow alue by uni.,000,000,000,000 u,000,000,000,000,000,000 999,999 u,000,000 999,999 999,999 999,999 u 999,999 999,999 999,999 999,998 u 999,999 999,998 999,998 999,998 u 999,998 999,998 22

The Edmond-Karp Algorihm Alway chooe an augmening pah of minimum-lengh in G f (where each edge ha uni lengh). Thi can be done in O(E) ime uing BFS. Theorem: The EK alg perform a mo O(V E) pah-augmenaion, o he E.K. alg run in O(V E 2 ) ime. Le δ f (u, ) denoe hore-pah diance from u o in G f. The proof of he Theorem i a conequence of he following wo lemma: Lemma: V {, }, δ f (, ) doe no decreae afer a flow augmenaion. Lemma: Edge (u, ) i criical on a.p. p if c f (u, ) = c f (p). Suppoe when running he E.K. algorihm ha (u, ) i criical for a.p. p in G f, and i laer criical again for anoher a.p. p in G f. Then δ f (, u) δ f (, u) + 2. 2

Applicaion: Max Biparie Maching A graph G = (V, E) i biparie if here exi pariion V = L R wih L R = and E L R. A Maching i a ube M E uch ha V a mo one edge in M i inciden upon. The ize of a maching i M, he number of edge in M. A Maximum Maching i maching M uch ha eery oher maching M aifie M M. Problem: Gien biparie graph G, find a maximum maching. 2

A biparie graph wih 2 maching L R L R 2

Our approach will be o wrie he Max Biparie Maching problem a a Max-Flow problem. Our flow nework will be G = (V, E ) where V = V {, } and E = {(, u) : u L} {(u, ) : u L, R and (u, ) E} {(, ) : R} We alo aign (u, ) E, c(u, ) =. Lemma: If f i an ineger alued flow in G hen here i a maching M of G wih f = M. Similarly, if M i a maching of G hen here i an ineger alued flow f wih f = M. Thi almo ell u ha Max-Flow ole our problem. The difficuly i ha i poible ha he max-flow migh no hae ineger alue (i i poible ha f migh be an ineger bu ome f(u, ) migh no be ineger). 26

A biparie graph and i aociaed flow nework. A maching and aociaed flow are illuraed L R L R 27

Theorem: Le G = (V, E ) be a flow nework in which c i inegral. Then he max-flow f found by he F.F. mehod ha he propery ha u,, f(u, ) i ineger alued. The proof i by inducion on he ep in he FF mehod. A each ep he curren flow f i ineger o he reidual capaciie are all ineger. Thi implie ha he a.p. found ha c f (p) inegral o he new flow f + f creaed i alo inegral. The heorem guaranee ha if G i he flow nework correponding o a biparie maching problem hen max flow alue f i he alue of a maximum maching. The flow found by he FF algorihm can be modified o yield he max maching. The FF algorihm run on hi pecial graph will ake O(V E) ime (why?). 28

Odd and End A faer implemenaion of he FF mehod ue he idea of blocking flow deeloped by Dinic. Thi approach find many augmening pah a once. A oally differen approach o he Max-Flow algorihm i he puh-relabel mehod (ee CLRS for deail). Thi can run in O( V ) ime a comapred o he O( V E 2 ) of FF. We will ee laer ha he max-flow problem can be wrien a a linear program. The FF mehod i eenial a pecial cae of he primal-dual algorihm for oling combinaorial LP. 29