Maximum Flow. Flow Graph

Similar documents
Graduate Algorithms CS F-18 Flow Networks

CSC 373: Algorithm Design and Analysis Lecture 9

1 The Network Flow Problem

Solutions to assignment 3

ALG 5.3 Flow Algorithms:

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

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

Graphs III - Network Flow

CS3510 Design & Analysis of Algorithms Fall 2017 Section A. Test 3 Solutions. Instructor: Richard Peng In class, Wednesday, Nov 15, 2017

Lecture 2: Network Flow. c 14

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

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

1 Motivation and Basic Definitions

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

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)

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

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

Max-flow and min-cut

Maximum Flow and Minimum Cut

Max-flow and min-cut

Network Flows: Introduction & Maximum Flow

Algorithmic Discrete Mathematics 6. Exercise Sheet

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

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

Main Reference: Sections in CLRS.

Today: Max Flow Proofs

Matching. Slides designed by Kevin Wayne.

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

Soviet Rail Network, 1955

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

Algorithm Design and Analysis

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

CSE 521: Design & Analysis of Algorithms I

Jonathan Turner Exam 2-10/28/03

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

The solution is often represented as a vector: 2xI + 4X2 + 2X3 + 4X4 + 2X5 = 4 2xI + 4X2 + 3X3 + 3X4 + 3X5 = 4. 3xI + 6X2 + 6X3 + 3X4 + 6X5 = 6.

A LOG IS AN EXPONENT.

0 for t < 0 1 for t > 0

Randomized Perfect Bipartite Matching

LAPLACE TRANSFORMS. 1. Basic transforms

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

Reminder: Flow Networks

Network Flows UPCOPENCOURSEWARE number 34414

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

Chapter Introduction. 2. Linear Combinations [4.1]

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

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

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

4.8 Improper Integrals

Three Dimensional Coordinate Geometry

graph of unit step function t

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

Robust Network Coding for Bidirected Networks

Sph3u Practice Unit Test: Kinematics (Solutions) LoRusso

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

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

5.1-The Initial-Value Problems For Ordinary Differential Equations

Network Flow. Data Structures and Algorithms Andrei Bulatov

1.0 Electrical Systems

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

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

Soviet Rail Network, 1955

16 Max-Flow Algorithms and Applications

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

Chapter 2: Evaluative Feedback

Control Systems -- Final Exam (Spring 2006)

Algorithm Design and Analysis

Minimum Squared Error

Minimum Squared Error

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.

Positive and negative solutions of a boundary value problem for a

Chapter 7: Solving Trig Equations

Bisimulation, Games & Hennessy Milner logic p.1/32

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

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

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

18 Extensions of Maximum Flow

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

EECE 301 Signals & Systems Prof. Mark Fowler

S Radio transmission and network access Exercise 1-2

Global alignment in linear space

Properties of Logarithms. Solving Exponential and Logarithmic Equations. Properties of Logarithms. Properties of Logarithms. ( x)

September 20 Homework Solutions

8.1. a) For step response, M input is u ( t) Taking inverse Laplace transform. as α 0. Ideal response, K c. = Kc Mτ D + For ramp response, 8-1

PHYSICS 1210 Exam 1 University of Wyoming 14 February points

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

two values, false and true used in mathematical logic, and to two voltage levels, LOW and HIGH used in switching circuits.

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

Mathematics 805 Final Examination Answers

Section 3.5 Nonhomogeneous Equations; Method of Undetermined Coefficients

CS 170 DISCUSSION 10 MAXIMUM FLOW. Raymond Chan raychan3.github.io/cs170/fa17.html UC Berkeley Fall 17

Designing A Fanlike Structure

The fundamental mass balance equation is ( 1 ) where: I = inputs P = production O = outputs L = losses A = accumulation

Discussion Session 2 Constant Acceleration/Relative Motion Week 03

Solving Evacuation Problems Efficiently. Earliest Arrival Flows with Multiple Sources

Solutions to Assignment 1

Chapter 8 The Complete Response of RL and RC Circuits

dt = C exp (3 ln t 4 ). t 4 W = C exp ( ln(4 t) 3) = C(4 t) 3.

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

Reinforcement Learning

Transcription:

Mximum Flow Chper 26 Flow Grph A ommon enrio i o ue grph o repreen flow nework nd ue i o nwer queion ou meril flow Flow i he re h meril move hrough he nework Eh direed edge i ondui for he meril wih ome ed piy Verie re onneion poin u do no olle meril Flow ino verex mu equl he flow leving he verex, flow onervion 1

Smple Nework Nework Node Ar Flow ommuniion elephone exhnge, ompuer, ellie le, fier opi, mirowve rely voie, video, pke irui ge, regier, proeor wire urren mehnil join rod, em, pring he, energy hydruli reervoir, pumping ion, lke pipeline fluid, oil finnil ok, ompnie rnion money rnporion irpor, ril yrd, ree inereion highwy, riled, irwy roue freigh, vehile, penger hemil ie ond energy Flow Conep Soure verex where meril i produed Sink verex where meril i onumed For ll oher verie wh goe in mu go ou Flow onervion Gol: deermine mximum re of meril flow from oure o ink 2

Forml Mx Flow Prolem Grph G=(V,E) flow nework Direed, eh edge h piy (u,v) 0 Two peil verie: oure, nd ink For ny oher verex v, here i ph v Flow funion f : V V R Cpiy onrin: For ll u, v V: f(u,v) (u,v) Skew ymmery: For ll u, v V: f(u,v) = f(v,u) Flow onervion: For ll u V {, }: 2/15 5/1 0/9 2/5 /19 3/3 v V v V f ( u, v) f ( u, V ) 0, or f ( v, u) f ( V, u) 0 Cnellion of flow We would like o void wo poiive flow in oppoie direion eween he me pir of verie Suh flow nel (mye prilly) eh oher due o kew ymmery 2/15 5/19 2/15 5/19 2/9 5/5 0/9 3/5 5/1 2/3 5/1 2/3 3

Mx Flow We wn o find flow of mximum vlue from he oure o he ink Denoed y f Luky Puk Diriuion Nework Mx Flow, f = 19 Or i i? Be we n do? Ford-Fulkeron mehod Conin everl lgorihm: Reidue nework Augmening ph Find ph p from o (ugmening ph), uh h here i ome vlue x > 0, nd for eh edge (u,v) in p we n dd x uni of flow f(u,v) + x (u,v) Augmening Ph? /15 8/ /19 2/ 9 5/5 6/1 8/11 d 3/3

Reidul Nework To find ugmening ph we n find ny ph in he reidul nework: Reidul piie: f (u,v) = (u,v) f(u,v) i.e. he ul piy minu he ne flow from u o v Ne flow my e negive Reidul nework: G f =(V,E f ), where E f = {(u,v) V V : f (u,v) > 0} Oervion edge in E f re eiher edge in E or heir reverl: E f 2 E Su-grph Wih (u,v) nd f(u,v) 5/15 0/1 5/6 Reidul Su-Grph 19 5 1 Reidul Grph Compue he reidul grph of he grph wih he following flow: /15 2/ 8/ 9 5/5 /19 6/1 8/11 d 3/3 5

Reidul Cpiy nd Augmening Ph Finding n Augmening Ph Find ph from o in he reidul grph The reidul piy of ph p in G f : f (p) = min{ f (u,v): (u,v) i in p} i.e. find he minimum piy long p Doing ugmenion: for ll (u,v) in p, we ju dd hi f (p) o f(u,v) (nd ur i from f(v,u)) Reuling flow i vlid flow wih lrger vlue. Reidul nework nd ugmening ph 6

The Ford-Fulkeron mehod Ford-Fulkeron(G,,) 1 for eh edge (u,v) in G.E do 2 f(u,v) f(v,u) 0 3 while here exi ph p from o in reidul nework G f do f = min{ f (u,v): (u,v) i in p} 5 for eh edge (u,v) in p do 6 f(u,v) f(u,v) + f 7 f(v,u) -f(u,v) 8 reurn f The lgorihm ed on hi mehod differ in how hey hooe p in ep 3. If hoen poorly he lgorihm migh no ermine. Exeuion of Ford-Fulkeron (1) Lef Side = Reidul Grph Righ Side = Augmened Flow 7

Exeuion of Ford-Fulkeron (2) Lef Side = Reidul Grph Righ Side = Augmened Flow Cu Doe he mehod find he minimum flow? Ye, if we ge o he poin where he reidul grph h no ph from o A u i priion of V ino S nd T = V S, uh h S nd T The ne flow (f(s,t)) hrough he u i he um of flow f(u,v), where S nd T Inlude negive flow k from T o S The piy ((S,T)) of he u i he um of piie (u,v), where S nd T The um of poiive piie Minimum u u wih he mlle piy of ll u. f = f(s,t) i.e. he vlue of mx flow i equl o he piy of min u. /15 6/1 2/ 8/ 8/11 9 5/5 /19 3/3 Cu piy = 2 Min Cu piy = 21 d 8

Mx Flow / Min Cu Theorem 1. Sine f (S,T) for ll u of (S,T) hen if f = (S,T) hen (S,T) mu e he min u of G 2. Thi implie h f i mximum flow of G 3. Thi implie h he reidul nework G f onin no ugmening ph. If here were ugmening ph hi would onrdi h we found he mximum flow of G 1 2 3 1 nd from 2 3 we hve h he Ford Fulkeron mehod find he mximum flow if he reidul grph h no ugmening ph. Wor Ce Running Time Auming ineger flow Eh ugmenion inree he vlue of he flow y ome poiive moun. Augmenion n e done in O(E). Tol wor-e running ime O(E f* ), where f* i he mx-flow found y he lgorihm. Exmple of wor e: Augmening ph of 1 Reuling Reidul Nework Reuling Reidul Nework 9

Edmond Krp Tke hore ph (in erm of numer of edge) n ugmening ph Edmond-Krp lgorihm How do we find uh hore ph? Running ime O(VE 2 ), eue he numer of ugmenion i O(VE) Skipping he proof here Even eer mehod: puh-relel, O(V 2 E) runime Muliple Soure or Sink Wh if you hve prolem wih more hn one oure nd more hn one ink? Modify he grph o ree ingle uperoure nd uperink x 15 1 15 1 e g 11 11 9 5 d f 9 5 h 3 3 y i j 15 1 15 1 e g 11 11 9 5 d f 9 5 h 3 3 k l

Appliion Biprie Mhing Exmple given ommuniy wih n men nd m women Aume we hve wy o deermine whih ouple (mn/womn) re ompile for mrrige E.g. (Joe, Sun) or (Fred, Sun) u no (Frnk, Sun) Prolem: Mximize he numer of mrrige No polygmy llowed Cn olve hi prolem y reing flow nework ou of iprie grph Biprie Grph A iprie grph i n undireed grph G=(V,E) in whih V n e priioned ino wo e V 1 nd V 2 uh h (u,v) E implie eiher u V 1 nd v V 12 or vie ver. Th i, ll edge go eween he wo e V 1 nd V 2 nd no wihin V 1 nd V 2. 11

Model for Mhing Prolem Men on lefmo e, women on righmo e, edge if hey re ompile A B C D Men X Y Z Women A B C D A mhing X Y Z A X B Y C Z D Opiml mhing Soluion Uing Mx Flow Add uperoue, uperink, mke eh undireed edge direed wih flow of 1 A X A X B C D Y Z B C D Y Z Sine he inpu i 1, flow onervion preven muliple mhing 12