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

Similar documents
16 Max-Flow Algorithms and Applications

16 Max-Flow Algorithms

1 Motivation and Basic Definitions

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

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

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

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

Main Reference: Sections in CLRS.

18 Extensions of Maximum Flow

Algorithmic Discrete Mathematics 6. Exercise Sheet

Network Flows: Introduction & Maximum Flow

Graphs III - Network Flow

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

23 Maximum Flows and Minimum Cuts

CSE 521: Design & Analysis of Algorithms I

Soviet Rail Network, 1955

Today: Max Flow Proofs

Randomized Perfect Bipartite Matching

Matching. Slides designed by Kevin Wayne.

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

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

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

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

Soviet Rail Network, 1955

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

Maximum Flow and Minimum Cut

Algorithm Design and Analysis

Network Flow. Data Structures and Algorithms Andrei Bulatov

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)

Algorithm Design and Analysis

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

Network Flows UPCOPENCOURSEWARE number 34414

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

Reminder: Flow Networks

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

Introduction to Congestion Games

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

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Maximum Flow in Planar Graphs

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

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

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

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

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

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

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.

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

Notes on cointegration of real interest rates and real exchange rates. ρ (2)

Average Case Lower Bounds for Monotone Switching Networks

introduction Ford-Fulkerson algorithm

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

introduction Ford-Fulkerson algorithm

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

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

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

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

arxiv: v1 [cs.cg] 21 Mar 2013

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

18.03SC Unit 3 Practice Exam and Solutions

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

, 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

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

Introduction to SLE Lecture Notes

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

Chapter 9 - The Laplace Transform

EECE 301 Signals & Systems Prof. Mark Fowler

Math 333 Problem Set #2 Solution 14 February 2003

u(t) Figure 1. Open loop control system

Echocardiography Project and Finite Fourier Series

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

Interpolation and Pulse Shaping

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

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

Mon Apr 2: Laplace transform and initial value problems like we studied in Chapter 5

Price of Stability and Introduction to Mechanism Design

Linear Algebra Primer

CHAPTER 7: SECOND-ORDER CIRCUITS

Geometric Path Problems with Violations

Two Coupled Oscillators / Normal Modes

FLAT CYCLOTOMIC POLYNOMIALS OF ORDER FOUR AND HIGHER

ARTIFICIAL INTELLIGENCE. Markov decision processes

Exponential Sawtooth

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

Some Basic Information about M-S-D Systems

Stat13 Homework 7. Suggested Solutions

Seminar 4: Hotelling 2

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

Challenge Problems. DIS 203 and 210. March 6, (e 2) k. k(k + 2). k=1. f(x) = k(k + 2) = 1 x k

Final Spring 2007

Physics 240: Worksheet 16 Name

Lecture 21: Bezier Approximation and de Casteljau s Algorithm. and thou shalt be near unto me Genesis 45:10

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

Introduction to Probability and Statistics Slides 4 Chapter 4

CHAPTER 12 DIRECT CURRENT CIRCUITS

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

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

5.2 GRAPHICAL VELOCITY ANALYSIS Polygon Method

Notes for Lecture 17-18

Transcription:

CS 473G Lecure 1: Max-Flow Algorihm and Applicaion Fall 200 1 Max-Flow Algorihm and Applicaion (November 1) 1.1 Recap Fix a direced graph G = (V, E) ha doe no conain boh an edge u v and i reveral v u, and fix a capaciy funcion c : E IR +. For any flow funcion f : E IR 0, he reidual capaciy i defined a c(u v) f(u v) if u v E c f (u v) = f(v u) if v u E. 0 oherwie The reidual graph G f = (V, E f ), where E f i he e of edge whoe non-zero reidual capaciy i poiive. 0/ /20 / 0/1 / /1 1 0/ /20 1 / / A flow f in a weighed graph G and i reidual graph G f. In he la lecure, we proved he Max-flow Min-cu Theorem: In any weighed direced graph nework, he value of he maximum (, )-flow i equal o he co of he minimum (, )-cu. The proof of he heorem i conrucive. If he reidual graph conain a pah from o, hen we can increae he flow by he minimum capaciy of he edge on hi pah, o we mu no have he maximum flow. Oherwie, we can define a cu (S, T ) whoe co i he ame a he flow f, uch ha every edge from S o T i auraed and every edge from T o S i empy, which implie ha f i a maximum flow and (S, T ) i a minimum cu. / 1 /20 / 0/1 0/ /1 1 / /20 / / An augmening pah in G f and he reuling (maximum) flow f. 1.2 Ford-Fulkeron I no hard o realize ha hi proof ranlae almo immediaely o an algorihm, fir developed by Ford and Fulkeron in he 190: Saring wih he zero flow, repeaedly augmen he flow along any pah in he reidual graph, unil here i no uch pah. If every edge capaciy i an ineger, hen every augmenaion ep increae he value of he flow by a poiive ineger. Thu, he algorihm hal afer f ieraion, where f i he acual 1

CS 473G Lecure 1: Max-Flow Algorihm and Applicaion Fall 200 maximum flow. Each ieraion require O(E) ime, o creae he reidual graph G f and perform a whaever-fir-earch o find an augmening pah. Thu, in he word cae, he Ford-Fulkeron algorihm run in O(E f ) ime. If we muliply all he capaciie by he ame (poiive) conan, he maximum flow increae everywhere by he ame conan facor. I follow ha if all he edge capaciie are raional, hen he Ford-Fulkeron algorihm evenually hal. However, if we allow irraional capaciie, he algorihm can loop forever, alway finding maller and maller augmening pah. Wore ye, hi infinie equence of augmenaion may no even converge o he maximum flow! One of he imple example of hi effec wa dicovered by Uri Zwick. Conider he graph hown below, wih ix verice and nine edge. Six of he edge have ome large ineger capaciy, wo have capaciy 1, and one ha capaciy φ = ( 1)/2 0.618034, choen o ha 1 φ = φ 2. To prove ha he Ford-Fulkeron algorihm can ge uck, we wach he reidual capaciie of he hree horizonal edge a he algorihm progree. (The reidual capaciie of he oher ix edge will alway be a lea 3.) 1 1 φ A B C Uri Zwick non-erminaing flow example, and hree augmening pah. The Ford-Fulkeron algorihm ar by chooing he cenral augmening pah, hown in he large figure above. The hree horizonal edge,, in order from lef o righ, now have reidual capaciie 1, 0, φ. Suppoe he horizonal reidual capaciie are φ k 1, 0, and φ k for ome nonnegaive ineger k. 1. Augmen along B, adding φ k o he flow; he reidual capaciie are now φ k+1, φ k, 0. 2. Augmen along C, adding φ k o he flow; he reidual capaciie are now φ k+1, 0, φ k. 3. Augmen along B, adding φ k+1 o he flow; he reidual capaciie are now 0, φ k+1, φ k+2. 4. Augmen along A, adding φ k+1 o he flow; he reidual capaciie are now φ k+1, 0, φ k+2. Thu, afer 4n + 1 augmenaion ep, he reidual capaciie are φ 2n 2, 0, φ 2n 1. A he number of augmenaion ep grow o infiniy, he value of he flow converge o 1 + 2 i=1 φ i = 1 + 2 1 φ = 4 + < 7, even hough he maximum flow value i clearly 2 + 1. 2

CS 473G Lecure 1: Max-Flow Algorihm and Applicaion Fall 200 Picky uden migh wonder a hi poin why we care abou irraional capaciie; afer all, compuer can repreen anyhing bu (mall) ineger or (dyadic) raional exacly. Good queion! One reaon i ha he ineger rericion i lierally arificial; i an arifac of acual compuaional hardware 1, no an inheren feaure of he abrac mahemaical problem. Anoher reaon, which i probably more convincing o mo pracical compuer cieni, i ha he behavior of he algorihm wih irraional inpu ell u omehing abou i wor-cae behavior in pracice given floaing-poin capaciie errible! Even wih very reaonable capaciie, a carele implemenaion of Ford-Fulkeron could ener an infinie loop imply becaue of round-off error! 1.3 Edmond-Karp: Fa Pipe The Ford-Fulkeron algorihm doe no pecify which alernaing pah o ue if here i more han one. In 1972, Jack Edmond and Richard Karp analyzed wo naural heuriic for chooing he pah. The fir i eenially a greedy algorihm: Chooe he augmening pah wih large boleneck value. I a fairly eay o how ha he maximum-boleneck (, )-pah in a direced graph can be compued in O(E log V ) ime uing a varian of Jarník minimum-panning-ree algorihm, or of Dijkra hore pah algorihm. Simply grow a direced panning ree T, rooed a. Repeaedly find he highe-capaciy edge leaving T and add i o T, unil T conain a pah from o. Alernaely, once could emulae Krukal algorihm iner edge one a a ime in decreaing capaciy order unil here i a pah from o alhough hi i le efficien. We can now analyze he algorihm in erm of he value of he maximum flow f. Le f be any flow in G, and le f be he maximum flow in he curren reidual graph G f. (A he beginning of he algorihm, G f = G and f = f.) Le e be he boleneck edge in he nex augmening pah. Le S be he e of verice reachable from hrough edge wih capaciy greaer han c(e) and le T = V \ S. By conrucion, T i non-empy, and every edge from S o T ha capaciy a mo c(e). Thu, he co of he cu (S, T ) i a mo c(e) E. On he oher hand, S, T f, which implie ha c(e) f /E. Thu, augmening f along he maximum-boleneck pah in G f muliplie he maximum flow value in G f by a facor of a mo 1 1/E. In oher word, he reidual flow decay exponenially wih he number of ieraion. Afer E ln f ieraion, he maximum flow value in G f i a mo f (1 1/E) E ln f < f e ln f = 1. (Tha Euler conan e, no he edge e. Sorry.) In paricular, if all he capaciie are ineger, hen afer E ln f ieraion, he maximum capaciy of he reidual graph i zero and f i a maximum flow. We conclude ha for graph wih ineger capaciie, he Edmond-Karp fa pipe algorihm run in O(E 2 log E log f ) ime. 1.4 Dini/Edmond-Karp: Shor Pipe The econd Edmond-Karp heuriic wa acually propoed by Ford and Fulkeron in heir original max-flow paper, and fir analyzed by he Ruian mahemaician Dini (omeime ranlieraed Dinic) in 1970. Edmond and Karp publihed heir independen and lighly weaker analyi in 1972. So naurally, almo everyone refer o hi algorihm a Edmond-Karp. 1...or perhap he law of phyic. Yeah, righ. Whaever. Like realiy acually maer in hi cla. 3

CS 473G Lecure 1: Max-Flow Algorihm and Applicaion Fall 200 Chooe he augmening pah wih fewe edge. The correc pah can be found in O(E) ime by running breadh-fir earch in he reidual graph. More urpriingly, he algorihm hal afer a polynomial number of ieraion, independen of of he acual edge capaciie! The proof of hi upper bound relie on wo obervaion abou he evoluion of he reidual graph. Le f i be he curren flow afer i augmenaion ep, le G i be he correponding reidual graph. In paricular, f 0 i zero everywhere and G 0 = G. For each verex v, le level i (v) denoe he unweighed hore pah diance from o v in G i, or equivalenly, he level of v in a breadh-fir earch ree of G i rooed a. Our fir obervaion i ha hee level can only increae over ime. Lemma 1. level i+1 (v) level i (v) for all verice v and ineger i. Proof: The claim i rivial for v =, ince level i () = 0 for all i. Chooe an arbirary verex v, and le p u v be a hore pah from o v in G i+1. (If here i no uch pah, hen level i+1 (v) =, and we re done.) Becaue hi i a hore pah, we have level i+1 (v) = level i+1 (u) + 1, and he inducive hypohei implie ha level i+1 (u) level i (u). We now have wo cae o conider. If u v i an edge in G i, hen level i (v) level i (u) + 1, becaue he level are defined by breadh-fir raveral. On he oher hand, if u v i no an edge in G i, hen v u mu be an edge in he ih augmening pah. Thu, v u mu lie on he hore pah from o in G i, which implie ha level i (v) = level i (u) 1 level i (u) + 1. In boh cae, we have level i+1 (v) = level i+1 (u) + 1 level i (u) + 1 level i (v). Whenever we augmen he flow, he boleneck edge in he augmening pah diappear from he reidual graph, and ome oher edge in he reveral of he augmening pah may (re-)appear. Our econd obervaion i ha an edge canno appear or diappear oo many ime. Lemma 2. During he execuion of he Dini/Edmond-Karp algorihm, any edge u v diappear from he reidual graph G f a mo V/2 ime. Proof: Suppoe u v i in wo reidual graph G i and G j+1, bu no in any of he inermediae reidual graph G i+1,..., G j, for ome i < j. Then u v mu be in he ih augmening pah, o level i (v) = level i (u)+1, and v u mu be on he jh augmening pah, o level j (v) = level j (u) 1. By he previou lemma, we have level j (u) = level j (v) + 1 level i (v) + 1 = level i (u) + 2. In oher word, he diance from o u increaed by a lea 2 beween he diappearance and reappearance of u v. Since every level i eiher le han V or infinie, he number of diappearance i a move V/2. Now we can derive an upper bound on he number of ieraion. Since each edge can diappear a mo V/2 ime, here are a mo EV/2 edge diappearance overall. Bu a lea one edge diappear on each ieraion, o he algorihm mu hal afer a mo EV/2 ieraion. Finally, ince each ieraion require O(E) ime, Dini algorihm run in O(V E 2 ) ime overall. 4

CS 473G Lecure 1: Max-Flow Algorihm and Applicaion Fall 200 1. Maximum Maching in Biparie Graph Perhap one of he imple applicaion of maximum flow i in compuing a maximum-ize maching in a biparie graph. A maching i a ubgraph in which every verex ha degree a mo one, or equivalenly, a collecion of edge uch ha no wo hare a verex. The problem i o find he large maching in a given biparie graph. We can olve hi problem by reducing i o a maximum flow problem a follow. Le G be he given biparie graph wih verex e V = U W, uch ha every edge join a verex in U o a verex in W. We creae a new direced graph G by (1) oriening each edge from U o W, (2) adding wo new verice and, (3) adding edge from o every verex in U, and (4) adding edge from each verex in W o. Finally, we aign every edge in G a capaciy of 1. Any maching M in G can be ranformed ino a flow f M in G a follow: For each edge (u, w) in M, puh one uni of flow along he pah u w. Thee pah are dijoin excep a and, o he reuling flow aifie he capaciy conrain. Moreover, he value of he reuling flow i equal o he number of edge in M. Converely, conider any (, )-flow f in G compued uing he Ford-Fulkeron augmening pah algorihm. Becaue he edge capaciie are ineger, he Ford-Fulkeron algorihm aign an ineger flow o every edge. (Thi i eay o verify by inducion hin hin.) Moreover, ince each edge ha uni capaciy, he compued flow eiher aurae (f(e) = 1) or avoid (f(e) = 0) every edge in G. Finally, ince a mo one uni of flow can ener any verex in U or leave any verex in W, he auraed edge from U o W form a maching in G. The ize of hi maching i exacly f. Thu, he ize of he maximum maching in G i equal o he value of he maximum flow in G, and provided we compue he maxflow uing augmening pah, we can conver he acual maxflow ino a maximum maching. The maximum flow ha value a mo min{ U, W } = O(V ), o he Ford-Fulkeron algorihm run in O(V E) ime. A maximum maching in a biparie graph G, and he correponding maximum flow in G 1.6 Edge-Dijoin Pah Similarly, we can compue he maximum number of edge-dijoin pah beween wo verice and in an graph uing maximum flow. A e of pah in G i edge-dijoin if each edge in G appear in a mo one of he pah. (Several pah may pa hrough he ame verex, however.) If we give each edge capaciy 1, hen he maxflow from o aign a flow of eiher 0 or 1 o every edge. Moreover, even if he original graph i undireced, he maxflow algorihm will aign a direcion o every auraed edge. Thu, he ubgraph S of auraed edge i he union of everal edge-dijoin pah; he number of pah i equal o he value of he flow. Exracing he acual pah from S i eay: Ju follow any direced pah in S from o, remove ha pah from S, and recure. The overall running ime i O(V E), ju like for maximum biparie maching.

CS 473G Lecure 1: Max-Flow Algorihm and Applicaion Fall 200 Converely, we can ranform any collecion of edge-dijoin pah ino a flow by puhing one uni of flow along each pah from o ; he value of he reuling flow i equal o he number of pah in he collecion. I follow ha he maxflow algorihm acually compue he large poible e of edge-dijoin pah. 6