Flow Networks Alon Efrat Slides courtesy of Charles Leiserson with small changes by Carola Wenk. Flow networks. Flow networks CS 445

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

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

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

5. Network flow. Network flow. Maximum flow problem. Ford-Fulkerson algorithm. Min-cost flow. Network flow 5-1

Max-flow and min-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

1. Find a basis for the row space of each of the following matrices. Your basis should consist of rows of the original matrix.

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

Max-flow and min-cut

4.8 Improper Integrals

Maximum Flow. Flow Graph

CSC 373: Algorithm Design and Analysis Lecture 9

Network Flow. Data Structures and Algorithms Andrei Bulatov

Graphs III - Network Flow

Algorithm Design and Analysis

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

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

e t dt e t dt = lim e t dt T (1 e T ) = 1

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

LAPLACE TRANSFORMS. 1. Basic transforms

Graduate Algorithms CS F-18 Flow Networks

The Residual Graph. 11 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.

1 Motivation and Basic Definitions

Maximum Flow and Minimum Cut

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

Network Flows: Introduction & Maximum Flow

A Kalman filtering simulation

Contraction Mapping Principle Approach to Differential Equations

Main Reference: Sections in CLRS.

Algorithm Design and Analysis

Lecture 2: Network Flow. c 14

0 for t < 0 1 for t > 0

Soviet Rail Network, 1955

1 The Network Flow Problem

Today: Max Flow Proofs

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

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

Soviet Rail Network, 1955

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)

Matching. Slides designed by Kevin Wayne.

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

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

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

graph of unit step function t

Positive and negative solutions of a boundary value problem for a

Minimum Squared Error

Average & instantaneous velocity and acceleration Motion with constant acceleration

Minimum Squared Error

( ) ( ) ( ) ( ) ( ) ( y )

ENGR 1990 Engineering Mathematics The Integral of a Function as a Function

REAL ANALYSIS I HOMEWORK 3. Chapter 1

INTEGRALS. Exercise 1. Let f : [a, b] R be bounded, and let P and Q be partitions of [a, b]. Prove that if P Q then U(P ) U(Q) and L(P ) L(Q).

Solutions to assignment 3

Transformations. Ordered set of numbers: (1,2,3,4) Example: (x,y,z) coordinates of pt in space. Vectors

PHYSICS 1210 Exam 1 University of Wyoming 14 February points

15/03/1439. Lecture 4: Linear Time Invariant (LTI) systems

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

Section P.1 Notes Page 1 Section P.1 Precalculus and Trigonometry Review

Motion. Part 2: Constant Acceleration. Acceleration. October Lab Physics. Ms. Levine 1. Acceleration. Acceleration. Units for Acceleration.

2. VECTORS. R Vectors are denoted by bold-face characters such as R, V, etc. The magnitude of a vector, such as R, is denoted as R, R, V

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

3. Renewal Limit Theorems

Forms of Energy. Mass = Energy. Page 1. SPH4U: Introduction to Work. Work & Energy. Particle Physics:

Chapter Direct Method of Interpolation

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

can be viewed as a generalized product, and one for which the product of f and g. That is, does

IX.1.1 The Laplace Transform Definition 700. IX.1.2 Properties 701. IX.1.3 Examples 702. IX.1.4 Solution of IVP for ODEs 704

Reminder: Flow Networks

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

Chapter 2: Evaluative Feedback

On Line Supplement to Strategic Customers in a Transportation Station When is it Optimal to Wait? A. Manou, A. Economou, and F.

Physic 231 Lecture 4. Mi it ftd l t. Main points of today s lecture: Example: addition of velocities Trajectories of objects in 2 = =

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

Bounding the Locality of Distributed Routing Algorithms

ON NEW INEQUALITIES OF SIMPSON S TYPE FOR FUNCTIONS WHOSE SECOND DERIVATIVES ABSOLUTE VALUES ARE CONVEX

IX.1.1 The Laplace Transform Definition 700. IX.1.2 Properties 701. IX.1.3 Examples 702. IX.1.4 Solution of IVP for ODEs 704

Differential Geometry: Revisiting Curvatures

Price Discrimination

Addition & Subtraction of Polynomials

Introduction to SLE Lecture Notes

5.1-The Initial-Value Problems For Ordinary Differential Equations

September 20 Homework Solutions

Introduction to Congestion Games

Algorithmic Discrete Mathematics 6. Exercise Sheet

EECE 301 Signals & Systems Prof. Mark Fowler

(b) 10 yr. (b) 13 m. 1.6 m s, m s m s (c) 13.1 s. 32. (a) 20.0 s (b) No, the minimum distance to stop = 1.00 km. 1.

How to Prove the Riemann Hypothesis Author: Fayez Fok Al Adeh.

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

Phys 110. Answers to even numbered problems on Midterm Map

Fall 2014 David Wagner 10/31 Notes. The min-cut problem. Examples

Hermite-Hadamard-Fejér type inequalities for convex functions via fractional integrals

Lecture 4 Notes (Little s Theorem)

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

Closure Properties of Regular Languages

16 Max-Flow Algorithms

2.1 Position. 2.2 Rest and Motion.

CSE 521: Design & Analysis of Algorithms I

P441 Analytical Mechanics - I. Coupled Oscillators. c Alex R. Dzierba

Jonathan Turner Exam 2-10/28/03

Transcription:

CS 445 Flow Nework lon Efr Slide corey of Chrle Leieron wih mll chnge by Crol Wenk Flow nework Definiion. flow nework i direced grph G = (V, E) wih wo diingihed erice: orce nd ink. Ech edge (, ) E h nonnegie cpciy c(, ). If (, ) E, hen c(, ) = 0. Exmple: 3 3 2 3 2 3 2 3 2 Flow nework Definiion. poiie flow on G i fncion p : V V R ifying he following: Cpciy conrin: For ll, V, 0 p(, ) c(, ). Flow conerion: For ll V {, }, p (, ) p(, ) = 0. V V The le of flow i he ne flow o of he orce: p (, ) p(, ). V V

poiie flow flow on nework cpciy :3 0: :3 :2 :2 Flow conerion Flow ino i 2 + = 3. Flow o of i 0 + + 2 = 3. The le of hi flow i 0 + 2 = 3. The mximm-flow problem Mximm-flow problem: Gien flow nework G, find flow of mximm le on G. 0: 0:3 :2 3:3 The le of he mximm flow i 4. pplicion: Biprie Mching. B grph G(V,E) i clled biprie if V cn be priioned ino wo e V= B, nd ech edge of E connec erex of o erex of B. mching i e of edge M of E, where ech erex of i djcen o mo one erex of B, nd ice er.

Mching nd flow problem 0: dd erex, nd connec i o ech erex of. dd erex, nd connec ech erex of B o. The cpciy of ll edge i. Find mx flow. me i i n ineger flow, o he flow of ech edge i eiher 0 or. Ech edge of G h crrie flow i in he mching. Ech edge of G h doe no crry flow i no in he mching. Clim: The edge beween nd B h crry flow form mching. B Greedy i bopiml. 0: 0: 0: 0: B me we he lredy ome edge in (pril ) mching M. In order o incree he crdinliy of he mching we migh need o fir remoe from M ome edge (omehow coneriniie?) Thinking gin bo he mching flow problem, i men h we migh need o remoe flow from edge h crrenly crry flow. Flow cncellion Wiho lo of generliy, poiie flow goe eiher from o, or from o, b no boh. :2 :3 0:2 Ne flow from o in boh ce i. The cpciy conrin nd flow conerion re preered by hi rnformion.

noionl implificion IDE: Work wih he ne flow beween wo erice, rher hn wih he poiie flow. Definiion. (ne) flow on G i fncion f : V V R ifying he following: Cpciy conrin: For ll, V, f (, ) c(, ). Flow conerion: For ll V {, }, f (, ) = 0. V Skew ymmery: For ll, V, f (, ) = f (, ). Skew ymmery: Eqilence of definiion Ne flow. poiie flow. Theorem. The wo definiion re eqilen. Proof. ( ) Le f (, ) = p(, ) p(, ). Cpciy conrin: Since p(, ) c(, ) nd p(, ) 0, we he f (, ) c(, ). Flow conerion: f (, ) = ( p (, ) - p (, )) V V = p (, ) - p (, ) V V In priclr, if V {, }, hen f (, )=0 V f (, ) = p(, ) p(, ) = (p(, ) p(, )) = f (, ). Proof (conined) Obining he poiie flow from he ne flow ( ) Define p(, ) = f (, ) if f(, ) > 0, 0 if f(, ) 0. Cpciy conrin: By definiion, p(, ) 0. Since f (, ) c(, ), i follow h p(, ) c(, ). Flow conerion: If f (, ) > 0, hen f (, ) < 0 o p(,)=0. p(, ) p(, ) = f (, ). If f (, ) 0, hen p(, ) p(, ) = f (, ) = f (, ) by kew ymmery. Therefore, V V p (, ) p(, ) = f (, ) V

Reidl nework Definiion. Le f be flow on G = (V, E). reidl cpciie c f (, ) = c(, ) f (, ) The reidl nework G f (V, E f ), nd, E f re ll edge whoe reidl cpciy >0 Exmple: G f : 4 0:4 Lemm. E E f 2 E. Recll f (, ) = p(, ) p(, ). 4:4 :4 4 3 gmening ph Definiion. ny ph from o in G f i n gmening ph in G wih repec o f. I h boleneck c f (p):=min{ c f (,) (,) on p } The flow le cn be increed long n gmening ph p by dding c f (p) o he ne flow of ech edge long p. Thi i clled ph gmenion. I incree f by c f (p). 0:5 0:6 0:2 0:0 0: b c d Sr wih δ=0, δ:5 δ:6 δ:2 δ:0 δ: lowly incree b c d when δ=0, 5 6 2 0 G f : b c d c f (p) = fer gmenion :5 :6 :2 0 b c d gmening ph-more ccrely Definiion. ny ph p from o in G f i n gmening ph in G wih repec o f. c f (p):=min{ c f (,) (,) p } (,) p e f(,) += c f (p) ; f(,) -= c f (p) Thi i clled ph gmenion. Exmple: 3:5 2:6 7:2 b 2 4 5 G f : b c f (p) = 2 3 2 7 fer gmenion 5:5 4:6 9:2 b Noe flow conerion i preered.

gmening ph noher exmple Definiion. ny ph p from o in G f i n gmening ph in G wih repec o f. c f (p):=min{ c f (,) (,) p } (,) p e f(,) += c f (p) ; f(,) -= c f (p) Thi i clled ph gmenion. (No ll edge of nework re hown) 3:5 2:6-5:2 2:5 b c d 5:5 c f (p) = 2 G f : fer gmenion 2 3 5:5 4 7 2 b c 2 4:6-3:2 b 3:5 c 0:3 d d 3 2 4:5 f =0 Ford-Flkeron mx-flow lgorihm Sr: f [, ] 0 for ll, V While () { conrc G f if n gmening ph p in G f exi hen gmen f by c f (p) //ny ph wold do ele exi } 0:0 0:0 0: G f : 0:0 0:0 0 0:0 c f (p)= 0 0 G f : 0 0:0 0 f = 0 0 9 0 9 G f : 0 G f : G f: c f (p)= 9 0 9 9 9 9 9 8 9 2 8 9 2 0 0 0: f =2 0 0 2:0 0 0 2:0 f =3 2:0 2:0 0: f =4 2:0 2:0

noher exmple - Mching Sr from hi biprie grph b 2 b 2 B Cree hi nework flow problem f =0 0: 0: b 0: G : 0: 0: 0: 0: 2 b 2 B Reidl nework b G f : 2 b 2 Find ph p. G : G f: G : Mching Con f = b 0: 0: 0: 0: 2 b 2 B. b 2 b 2 B. 0: b 2 b 2 f =2 Correcne of FF lgorihm We will nex how h when FF-lgorihm ermine, i i bece i h fond mximm flow. The proof lo proide ddiionl informion bo he nework (wi for i)

C Definiion. c (S, T) of flow nework G =(V, E) i priion of V ino wo e S, T, ch h S nd T. 0: 0:3 :3 0:2 S T 3:3 C Definiion. c (S, T) of flow nework G =(V, E) i priion of V ino wo e S, T, ch h S nd T. 0: 0:3 :3 0:2 3:3 S T More exmpl of c. (, V,- ) (V-, ) Flow cro c Definiion. If f i flow on G, hen he flow cro he c, denoed f (S, T) = S T f(,) 0: 0:3 :3 0:2 S T 3:3 S={,} f (S, T) = (2 + 2) + ( 2 + + 2) = 4

noher chrcerizion of flow le Recll: f =f(,v)= V f(,) Lemm. For ny flow f nd ny c (S, T), we he f = f (S, T). Proof. Omied Mening h yo don need o know he proof, b yo do need o know hi lemm Conclion: The flow ino he ink eql he flow from he orce f(,v)=f(v.) Flow ino he ink 0: 0:3 :3 -:2 3:3 f = f (, V) = 4 f (V, ) = 4 Cpciy of c Definiion. The cpciy of c (S, T) i c(s, T)= S T c(,) S 0: 0:3 :3 0:2 T 3:3 c(s, T) = (3 + 2) + ( + 2 + 3) =

Upper bond on he mximm flow le Theorem. The le of ny flow no lrger hn he cpciy of ny c: f c(s,t). Proof: Recll h for he flow f o be legi, we m he f(,) c(,) for eery pir of erice (,). Hence f = f ( S, T ). = f (, ) S T S T = c( S, T ) c(, ) Mx-flow, min-c heorem Theorem. The following re eqilen:. f = c(s, T) for ome c (S, T). 2. f i mximm flow. 3. f dmi no gmening ph. Proof. () (2): Since f c(s, T) for ny c (S, T) (by he heorem from few lide bck), he mpion h f = c(s, T) implie h f i mximm flow. (2) (3): If here were n gmening ph, he flow le cold be increed, conrdicing he mximliy of f. (3) (): Define S = { V here exi ph in G f from o }, Le T = V S. Since f dmi no gmening ph, here i no ph from o in G f. Hence, S nd S, So Τ. Th (S, T) i c. Conider ny erice S nd T. ph in G f S T Conider S, T. We m he c f (, ) = 0, ince if c f (, ) > 0, hen S, no T med. Th, f (, ) = c(, ), ince c f (, ) = c(, ) f (, ). Smming oer ll S nd T yield f (S, T) = c(s, T), nd ince f = f (S, T), he heorem follow.

Noe h hi proof i conrcie I find c which form boleneck (noe h here migh be oher boleneck c) If we decree he cpciy of NY edge long hi c, i wold decree he mx flow. The Theorem lo implie h FF lgorihm i rel in mx flow. Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G f wr f exi do gmen f by c f (p) Cn be low: 0 9 0 9 0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0:0 9 0:0 9 0: 0:0 9 0:0 9

Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0:0 9 0:0 9 0: 0:0 9 0:0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0:0 9 0:0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0:0 9 0:0 9 0 9

Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0 9 0: 0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0 9 0: 0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Rnime: Le f* be he le of mximm flow, nd me i i n inegrl le. The iniilizion ke O( E ) There re mo f* ierion of he loop Find n gmening ph wih DFS in O( V + E ) ime Ech gmenion ke O( V ) ime O( E f* ) in ol

Ford-Flkeron nd mching Recll we expreed he mximm mching problem nework flow, b we cn expre he mx flow mching, only if he flow i n ineger flow. Howeer, hi i lwy he ce once ing F&F lgorihm: The flow long ech edge i eiher 0 or. G : 0: 0: 0: 0: B. Rnime nlyi of F&F-lgorihm pplied o biprie mching We w h in ech ierion of F&F lgorihm, f incree by le. Le f* be he mximm le. How lrge cn f* be? Clim: f* min{, B } (why?) Rnime i O( E min{, B } )=O( E V ) Cn be done in O( E /2 V ) (Dinic lgorihm) Edmond-Krp lgorihm Edmond nd Krp noiced h mny people implemenion of Ford-Flkeron gmen long bredh-fir gmening ph: ph wih mlle nmber of edge in G f from o. Thee implemenion wold lwy rn reliely f. Since bredh-fir gmening ph cn be fond in O( E ) ime, heir nlyi, foce on bonding he nmber of flow gmenion. (In independen work, Dinic lo ge polynomil-ime bond.)

Rnning ime of Edmond-Krp One cn how h he nmber of flow gmenion (i.e., he nmber of ierion of he while loop) i O( V E ). Bredh-fir erch rn in O( E ) ime ll oher bookkeeping i O( V ) per gmenion. The Edmond-Krp mximm-flow lgorihm rn in O( V E 2 ) ime. Be o de The ympoiclly fe lgorihm o de for mximm flow, de o King, Ro, nd Trjn, rn in O(V E log E/(V lg V) V) ime. If we llow rnning ime fncion of edge weigh, he fe lgorihm for mximm flow, de o Goldberg nd Ro, rn in ime O(min{V 2/3, E /2 } E lg (V 2 /E + 2) lg C), where C i he mximm cpciy of ny edge in he grph.