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

Similar documents
Soviet Rail Network, 1955

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

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

Soviet Rail Network, 1955

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

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.

Maximum Flow and Minimum Cut

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

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

Algorithm Design and Analysis

Today: Max Flow Proofs

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

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

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

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

CSE 521: Design & Analysis of Algorithms I

1 Motivation and Basic Definitions

Main Reference: Sections in CLRS.

Graphs III - Network Flow

Matching. Slides designed by Kevin Wayne.

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

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

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Algorithm Design and Analysis

Network Flow. Data Structures and Algorithms Andrei Bulatov

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.

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

Network Flows: Introduction & Maximum Flow

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

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

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

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

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

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

Network Flows UPCOPENCOURSEWARE number 34414

Randomized Perfect Bipartite Matching

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

Algorithmic Discrete Mathematics 6. Exercise Sheet

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

16 Max-Flow Algorithms and Applications

introduction Ford-Fulkerson algorithm

introduction Ford-Fulkerson algorithm

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

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)

Reminder: Flow Networks

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

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

23 Maximum Flows and Minimum Cuts

18 Extensions of Maximum Flow

Maximum Flow in Planar Graphs

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

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

Average Case Lower Bounds for Monotone Switching Networks

16 Max-Flow Algorithms

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

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

Introduction to SLE Lecture Notes

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

Dynamic Programming 11/8/2009. Weighted Interval Scheduling. Weighted Interval Scheduling. Unweighted Interval Scheduling: Review

Algorithm Design and Analysis

Mechtild Stoer * Frank Wagner** Abstract. fastest algorithm known. The runtime analysis is straightforward. In contrast to

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

Chapter 7. Network Flow. CS 350: Winter 2018

Introduction to Congestion Games

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

Network Flow Applications

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

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

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

7. NETWORK FLOW II. Soviet rail network (1950s) Max-flow and min-cut applications. "Free world" goal. Cut supplies (if cold war turns into real war).

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

CS Lunch This Week. Special Talk This Week. Soviet Rail Network, Flow Networks. Slides20 - Network Flow Intro.key - December 5, 2016

Ford-Fulkerson Algorithm for Maximum Flow

EECE 301 Signals & Systems Prof. Mark Fowler

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

6. DYNAMIC PROGRAMMING II

Today. Flow review. Augmenting paths. Ford-Fulkerson Algorithm. Intro to cuts (reason: prove correctness)

u(t) Figure 1. Open loop control system

Random Walk with Anti-Correlated Steps

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

, 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

To become more mathematically correct, Circuit equations are Algebraic Differential equations. from KVL, KCL from the constitutive relationship

Algorithms and Theory of Computation. Lecture 11: Network Flow

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

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

6. DYNAMIC PROGRAMMING II

Timed Circuits. Asynchronous Circuit Design. Timing Relationships. A Simple Example. Timed States. Timing Sequences. ({r 6 },t6 = 1.

Chapter 7: Inverse-Response Systems

Topics in Combinatorial Optimization May 11, Lecture 22

We just finished the Erdős-Stone Theorem, and ex(n, F ) (1 1/(χ(F ) 1)) ( n

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

cs/ee 143 Communication Networks

7. NETWORK FLOW II. Minimum cut application (RAND 1950s) Maximum flow application (Tolstoǐ 1930s) Max-flow and min-cut applications

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

Notes for Lecture 17-18

Graph Theory: Network Flow

Solutions for Assignment 2

Fitting Parameters in a Differential Equation With a Non-Analytical Solution

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

Transcription:

Conen Maximum Flow Conen. Maximum low problem. Minimum cu problem. Max-low min-cu heorem. Augmening pah algorihm. Capaciy-caling. Shore augmening pah. Princeon Univeriy COS Theory o Algorihm Spring Kevin Wayne Maximum Flow and Minimum Cu Max Flow Nework Max low and min cu. Two very rich algorihmic problem. Cornerone problem in combinaorial opimizaion. Beauiul mahemaical dualiy. Max low nework: G (V, E,,, u). (V, E) direced graph, no parallel arc. Two diinguihed node: ource, ink. u( capaciy o arc e. Nonrivial applicaion / reducion. Nework conneciviy. Biparie maching. Daa mining. Open-pi mining. Airline cheduling. Image proceing. Projec elecion. Nework reliabiliy. Securiy o aiical daa. Diribued compuing. Egaliarian able maching. Diribued compuing. Many many more... Baeball eliminaion. Capaciy

Flow An - low i a uncion : E R ha aiie: For each e E: ( u( (capaciy) For each v V {, }: (conervaion) e in o v e ou o v Flow An - low i a uncion : E R ha aiie: For each e E: ( u( (capaciy) For each v V {, }: (conervaion) e in o v e ou o v e in o v : w :( w, v) E ( w, v) e ou o v : w :( v, w) E ( v, w) MAX FLOW: ind - low ha maximize ne low ou o he ource. e ou o Capaciy Flow Capaciy Flow Value Flow Flow An - low i a uncion : E R ha aiie: For each e E: ( u( (capaciy) For each v V {, }: (conervaion) e in o v e ou o v MAX FLOW: ind - low ha maximize ne low ou o he ource. An - low i a uncion : E R ha aiie: For each e E: ( u( (capaciy) For each v V {, }: (conervaion) e in o v e ou o v MAX FLOW: ind - low ha maximize ne low ou o he ource. Capaciy Flow Value Capaciy Flow Value

Nework communicaion circui Node Nework elephone exchange, compuer, aellie gae, regier, proceor Arc cable, iber opic, microwave relay wire Flow voice, video, packe curren mechanical join rod, beam, pring hea, energy hydraulic reervoir, pumping aion, lake pipeline luid, oil inancial ock, currency ranacion money ranporaion airpor, rail yard, ree inerecion highway, railbed, airway roue reigh, vehicle, paenger chemical ie bond energy Cu An - cu i a node pariion (S, T) uch ha S, T. The capaciy o an - cu (S, T) i: u( : u( v, w). e ou o S ( v, w ) E v S, w T Min - cu: ind an - cu o minimum capaciy. Capaciy Cu An - cu i a node pariion (S, T) uch ha S, T. The capaciy o an - cu (S, T) i: u( : u( v, w). e ou o S ( v, w ) v S E, w T Min - cu: ind an - cu o minimum capaciy. Cu An - cu i a node pariion (S, T) uch ha S, T. The capaciy o an - cu (S, T) i: u( : u( v, w). e ou o S ( v, w ) v S E, w T Min - cu: ind an - cu o minimum capaciy. Capaciy Capaciy

Flow and Cu L. Le be a low, and le (S, T) be a cu. Then, he ne low en acro he cu i equal o he amoun reaching. Flow and Cu L. Le be a low, and le (S, T) be a cu. Then, he ne low en acro he cu i equal o he amoun reaching. e ou o S e in o S e ou o e ou o S e in o S e ou o Value Value L. Le be a low, and le (S, T) be a cu. Then, he ne low en acro he cu i equal o he amoun reaching. e ou o S Flow and Cu e in o S e ou o Flow and Cu Le be a low, and le (S, T) be a cu. Then, S e in o S e ou o Proo by inducion on S. Bae cae: S { }. Inducive hypohei: aume rue or S < k. conider cu (S, T) wih S k S S { v } or ome v,, S k- cap(s, T ). adding v o S increae cu capaciy by e ou o v e in o v. v v Value S Beore S Aer

Flow and Cu Max Flow and Min Cu L. Le be a low, and le (S, T) be a cu. Then, cap(s, T). Proo. e ou o S e ou o S u( e ou o S cap(s, T) e in o S S T Corollary. Le be a low, and le (S, T) be a cu. I cap(s, T), hen i a max low and (S, T) i a min cu. Corollary. Le be a low, and le (S, T) be a cu. I cap(s, T), hen i a max low and (S, T) i a min cu. Cu capaciy Flow value Max-Flow Min-Cu Theorem MAX-FLOW MIN-CUT THEOREM (Ford-Fulkeron, ): In any nework, he value o he max low i equal o he value o he min cu. "Good characerizaion." Proo IOU. Toward an Algorihm Find an - pah where each arc ha u( > ( and "augmen" low along he pah. Cu capaciy Flow value Flow value

Toward an Algorihm Toward an Algorihm Find an - pah where each arc ha u( > ( and "augmen" low along he pah. Repea unil you ge uck. Find an - pah where each arc ha u( > ( and "augmen" low along he pah. Repea unil you ge uck. Greedy algorihm ail. X X X Flow value Flow value Flow value Reidual Arc Reidual Graph and Augmening Pah Original graph G (V, E). Flow (. Arc e (v, w) E. Capaciy Reidual graph: G (V, E ). E {e : ( < u(} {e R : ( > }. u ( u( ( i i e E R e E v w Reidual graph: G (V, E ). Reidual arc e (v, w) and e R (w, v). "Undo" low en. Flow G Reidual capaciy v w G Reidual capaciy

Augmening Pah Augmening pah pah in reidual graph. Augmening Pah Augmening pah pah in reidual graph. Max low no augmening pah??? G X X X X X G Flow value G G Max-Flow Min-Cu Theorem Proo o Max-Flow Min-Cu Theorem Augmening pah heorem (Ford-Fulkeron, ): A low i a max low i and only i here are no augmening pah. MAX-FLOW MIN-CUT THEOREM (Ford-Fulkeron, ): he value o he max low i equal o he value o he min cu. We prove boh imulaneouly by howing he TFAE: (i) i a max low. (ii) There i no augmening pah relaive o. (iii) There exi a cu (S, T) uch ha cap(s, T). We prove boh imulaneouly by howing he TFAE: (i) i a max low. (ii) There i no augmening pah relaive o. (iii) There exi a cu (S, T) uch ha cap(s, T). (i) (ii) We how conrapoiive. Le be a low. I here exi an augmening pah, hen we can improve by ending low along pah. (iii) (i) Nex lide. (iii) (i) Thi wa he Corollary o Lemma.

Proo o Max-Flow Min-Cu Theorem Augmening Pah Algorihm We prove boh imulaneouly by howing he TFAE: (i) i a max low. (ii) There i no augmening pah relaive o. (iii) There exi a cu (S, T) uch ha cap(s, T). (ii) (iii) Le be a low wih no augmening pah. Le S be e o verice reachable rom in reidual graph. clearly S, and S by deiniion o Augmen (, P) b boleneck(p) FOREACH e P IF (e E) // orward arc ( ( + b ELSE // backward arc (e R ) ( - b RETURN FordFulkeron (V, E,, ) e ou o e ou o u( S cap(s, T) S e in o S S Original Nework T FOREACH e E ( reidual graph G WHILE (here exi augmening pah P) augmen(, P) updae G RETURN Running Time Chooing Good Augmening Pah Aumpion: all capaciie are ineger beween and U. Ue care when elecing augmening pah. Invarian: every low value ( and every reidual capaciie u ( remain an ineger hroughou he algorihm. Theorem: he algorihm erminae in a mo * nu ieraion. Corollary: i U, hen algorihm run in O(mn) ime. Inegraliy heorem: i all arc capaciie are ineger, hen here exi a max low or which every low value ( i an ineger. Noe: algorihm may no erminae on ome pahological inance (wih irraional capacii. Moreover, low value may no even converge o correc anwer.

Chooing Good Augmening Pah Ue care when elecing augmening pah. Chooing Good Augmening Pah Ue care when elecing augmening pah. X X X Chooing Good Augmening Pah Ue care when elecing augmening pah. Chooing Good Augmening Pah Ue care when elecing augmening pah. X X X ieraion poible.

Chooing Good Augmening Pah Capaciy Scaling Ue care when elecing augmening pah. Some choice lead o exponenial algorihm. Clever choice lead o polynomial algorihm. Goal: chooe augmening pah o ha: Can ind augmening pah eicienly. Few ieraion. Inuiion: chooing pah wih highe boleneck capaciy increae low by max poible amoun. Don worry abou inding exac highe boleneck pah. Mainain caling parameer. Le G ( ) be he ubgraph o he reidual graph coniing o only arc wih capaciy a lea. Edmond-Karp (): chooe augmening pah wih Max boleneck capaciy. (a pah) Suicienly large capaciy. (capaciy-caling) Fewe number o arc. (hore pah) G G () Capaciy Scaling Capaciy Scaling: Analyi Inuiion: chooing pah wih highe boleneck capaciy increae low by max poible amoun. Don worry abou inding exac highe boleneck pah. Mainain caling parameer. Le G ( ) be he ubgraph o he reidual graph coniing o only arc wih capaciy a lea. ScalingMaxFlow(V, E,, ) FOREACH e E, ( malle power o greaer han or equal o U WHILE ( ) G ( ) -reidual graph WHILE (here exi augmening pah P in G ( )) augmen(, P) updae G ( ) / RETURN L. I all arc capaciie are ineger, hen hroughou he algorihm, all low and reidual capaciy value remain ineger. Thu, G ( ) G, o upon erminaion i a max low. L. The ouer while loop repea + log U ime. Iniially U <U, and decreae by a acor o each ieraion. L. Le be he low a he end o a -caling phae. Then value o he maximum low i a mo + m. L. There are a mo m augmenaion per caling phae. Le be he low a he end o he previou caling phae. L * + m ( ). Each augmenaion in a -phae increae by a lea. Theorem. The algorihm run in O(m log (U) ) ime.

Capaciy Scaling: Analyi L. Le be he low a he end o a -caling phae. Then value o he maximum low i a mo + m. We how ha a he end o a -phae, here exi a cu (S, T) uch ha cap(s, T) + m. Chooe S o be he e o node reachable rom in G ( ). clearly S, and S by deiniion o S e ou o S e ou o S e ou o S cap(s, T) ( u( ) u( - e in o S m e in o S e ou o S e in o S S Original Nework T Chooing Good Augmening Pah Ue care when elecing augmening pah. Some choice lead o exponenial algorihm. Clever choice lead o polynomial algorihm. Goal: chooe augmening pah o ha: Can ind augmening pah eicienly. Few ieraion. Edmond-Karp (): chooe augmening pah wih Max boleneck capaciy. (a pah) Suicienly large capaciy. (capaciy-caling) Fewe number o arc. (hore pah) Shore Augmening Pah Inuiion: chooing pah via breadh ir earch. Eay o implemen. may implemen by coincidence! Find augmening pah wih ewe number o arc. FOREACH e E ( reidual graph G ShoreAugmeningPah(V, E,, ) WHILE (here exi augmening pah) ind uch a pah P by BFS augmen(, P) updae G RETURN Shore Augmening Pah: Overview o Analyi L. Throughou he algorihm, he lengh o he hore pah never decreae. Proo ahead. L. Aer a mo m hore pah augmenaion, he lengh o he hore augmening pah ricly increae. Proo ahead. Theorem. The hore augmening pah algorihm run in O(m n) ime. O(m+n) ime o ind hore augmening pah via BFS. O(m) augmenaion or pah o exacly k arc. I here i an augmening pah, here i a imple one. k < n O(mn) augmenaion.

Shore Augmening Pah: Analyi Shore Augmening Pah: Analyi Level graph o (V, E, ). For each verex v, deine l(v) o be he lengh (number o arc) o hore pah rom o v. L G (V, E G ) i ubgraph o G ha conain only hoe arc (v,w) E wih l(w) l(v) +. G: Level graph o (V, E, ). For each verex v, deine l(v) o be he lengh (number o arc) o hore pah rom o v. L (V, F) i ubgraph o G ha conain only hoe arc (v,w) E wih l(w) l(v) +. Compue in O(m+n) ime uing BFS, deleing back and ide arc. P i a hore -v pah in G i and only i i i an -v pah L. L: L G : l l l l l l l l Shore Augmening Pah: Analyi Shore Augmening Pah: Analyi L. Throughou he algorihm, he lengh o he hore pah never decreae. L. Aer a mo m hore pah augmenaion, he lengh o he hore augmening pah ricly increae. Le and be low beore and aer a hore pah augmenaion. Le L and L be level graph o G and G Only back arc added o G pah wih back arc ha lengh greaer han previou lengh A lea one arc (he boleneck arc) i deleed rom L aer each augmenaion. No new arc added o L unil lengh o hore pah ricly increae. L L l l l l l l l l L L

Shore Augmening Pah: Review o Analyi Shore Augmening Pah: Improved Verion L. Throughou he algorihm, he lengh o he hore pah never decreae. L. Aer a mo m hore pah augmenaion, he lengh o he hore augmening pah ricly increae. Theorem. The hore augmening pah algorihm run in O(m n) ime. O(m+n) ime o ind hore augmening pah via BFS. O(m) augmenaion or pah o exacly k arc. O(mn) augmenaion. Two ype o augmenaion. Normal augmenaion: lengh o hore pah doen change. Special augmenaion: lengh o hore pah ricly increae. L. Group o normal augmenaion ake O(mn) ime. Explicily mainain level graph - i change by a mo n arc aer each normal augmenaion. Sar a, advance along an arc in L G unil reach or ge uck. i reach, augmen and delee a lea one arc i ge uck, delee node Noe: Θ(mn) augmenaion neceary on ome nework. Try o decreae ime per augmenaion inead. L G Dynamic ree O(mn log n) Sleaor-Tarjan, Simple idea O(mn ) l l l l Shore Augmening Pah: Improved Verion Shore Augmening Pah: Improved Verion L G augmen L G augmen L G delee L G L G augmen STOP: lengh o hore pah mu have ricly increaed

Shore Augmening Pah: Improved Verion Shore Augmening Pah: Improved Verion ARRAY pred[v V] L G level graph o G v, pred[v] nil REPEAT WHILE (here exi (v,w) L G ) pred[w] v, v w IF (v ) P pah deined by pred[] augmen(, P) updae L G v, pred[v] nil delee v rom L G UNTIL (v ) RETURN AdvanceRerea(V, E,,, ) advance augmen rerea Two ype o augmenaion. Normal augmenaion: lengh o hore pah doen change. Special augmenaion: lengh o hore pah ricly increae. L. Group o normal augmenaion ake O(mn) ime. Explicily mainain level graph - i change by a mo n arc aer each normal augmenaion. Sar a, advance along an arc in L G unil reach or ge uck. i reach, augmen and delee a lea one arc i ge uck, delee node a mo n advance ep beore one o above even Theorem. Algorihm run in O(mn ) ime. O(mn) ime beween pecial augmenaion. A mo n pecial augmenaion. Chooing Good Augmening Pah: Summary Hiory Mehod Augmenaion Running ime Augmening pah nu mnu Max capaciy m log U m log U (m + n log n) Capaciy caling m log U m log U Improved capaciy caling m log U mn log U Shore pah mn m n Improved hore pah mn mn Fir rule aume arc capaciie are beween and U. Year... Dicoverer Mehod Big-Oh Danzig Simplex mn U Ford, Fulkeron Augmening pah mnu Edmond-Karp Shore pah m n Diniz Shore pah mn Edmond-Karp, Diniz Capaciy caling m log U Diniz-Gabow Capaciy caling mn log U Karzanov Prelow-puh n Sleaor-Tarjan Dynamic ree mn log n Goldberg-Tarjan FIFO prelow-puh mn log (n / m)......... Goldberg-Rao Lengh uncion m / log (n / m) log U mn / log (n / m) log U