Algorithms. Algorithms 6.4 MAXIMUM FLOW

Similar documents
introduction Ford-Fulkerson algorithm

introduction Ford-Fulkerson algorithm

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

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.

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

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.

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

Maximum Flow and Minimum Cut

1 Motivation and Basic Definitions

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

Matching. Slides designed by Kevin Wayne.

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

Today: Max Flow Proofs

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

Algorithm Design and Analysis

Main Reference: Sections in CLRS.

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

Graphs III - Network Flow

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

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

Algorithm Design and Analysis

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

Problem Set If all directed edges in a network have distinct capacities, then there is a unique 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.

16 Max-Flow Algorithms and Applications

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

CSE 521: Design & Analysis of Algorithms I

Algorithmic Discrete Mathematics 6. Exercise Sheet

Randomized Perfect Bipartite Matching

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

Reminder: Flow Networks

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

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

Algorithms. Algorithms 6.4 MAXIMUM FLOW

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

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

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

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

Network Flow. Data Structures and Algorithms Andrei Bulatov

Network Flows: Introduction & Maximum Flow

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

Network Flows UPCOPENCOURSEWARE number 34414

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)

23 Maximum Flows and Minimum Cuts

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

18 Extensions of Maximum Flow

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

Algorithms. Algorithms 6.4 MIN CUT / MAX FLOW

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

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

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

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

Introduction to Congestion Games

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

Maximum Flow in Planar Graphs

16 Max-Flow Algorithms

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

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

Algorithms. Algorithms 6.4 MAXIMUM FLOW

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

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

Network Flow Applications

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

Algorithms 6.4 MAXIMUM FLOW. overview Ford-Fulkerson algorithm analysis Java implementation applications

An introduction to the theory of SDDP algorithm

EECE 301 Signals & Systems Prof. Mark Fowler

FLAT CYCLOTOMIC POLYNOMIALS OF ORDER FOUR AND HIGHER

Research Article On Double Summability of Double Conjugate Fourier Series

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

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

T-Rough Fuzzy Subgroups of Groups

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

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

Average Case Lower Bounds for Monotone Switching Networks

18.03SC Unit 3 Practice Exam and Solutions

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

The Primal Simplex Approach to the QoS Routing Problem

Introduction to SLE Lecture Notes

Graph Theory: Network Flow

The multisubset sum problem for finite abelian groups

DETC2004/CIE ALGORITHMIC FOUNDATIONS FOR CONSISTENCY-CHECKING OF INTERACTION-STATES OF MECHATRONIC SYSTEMS

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

NECESSARY AND SUFFICIENT CONDITIONS FOR LATENT SEPARABILITY

Physics 235 Chapter 2. Chapter 2 Newtonian Mechanics Single Particle

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

arxiv: v1 [cs.cg] 21 Mar 2013

Random Walk with Anti-Correlated Steps

Stability in Distribution for Backward Uncertain Differential Equation

Survivable Routing Meets Diversity Coding

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

6.8 Laplace Transform: General Formulas

Geometric Path Problems with Violations

Research Article An Upper Bound on the Critical Value β Involved in the Blasius Problem

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

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

, 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

Transcription:

Algorihm ROBERT SEDGEWICK KEVIN WAYNE 6.4 MAXIMUM FLOW Algorihm F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE hp://alg4.c.princeon.edu inroducion Ford Fulkeron algorihm maxflow mincu heorem analyi of running ime Java implemenaion (ee video) applicaion La updaed on 11/20/18 2:32 AM

6.4 MAXIMUM FLOW Algorihm ROBERT SEDGEWICK KEVIN WAYNE hp://alg4.c.princeon.edu inroducion Ford Fulkeron algorihm maxflow mincu heorem analyi of running ime Java implemenaion applicaion

Mincu problem Inpu. An edge-weighed digraph, ource verex, and arge verex. each edge ha a poiive capaciy capaciy 9 10 4 15 15 10 5 8 10 15 4 6 15 10 16 3

Mincu problem Def. A -cu (cu) i a pariion of he verice ino wo dijoin e, wih in one e A and in he oher e B. Def. I capaciy i he um of he capaciie of he edge from A o B. A 10 5 15 capaciy = 10 + 5 + 15 = 30 4

Mincu problem Def. A -cu (cu) i a pariion of he verice ino wo dijoin e, wih in one e A and in he oher e B. Def. I capaciy i he um of he capaciie of he edge from A o B. 10 8 A don' coun edge from B o A capaciy = 10 + 8 + 16 = 34 16 5

Mincu problem Def. A -cu (cu) i a pariion of he verice ino wo dijoin e, wih in one e A and in he oher e B. Def. I capaciy i he um of he capaciie of he edge from A o B. Minimum -cu (mincu) problem. Find a cu of minimum capaciy. 10 8 A 10 capaciy = 10 + 8 + 10 = 28 6

Maxflow: quiz 1 Wha i he capaciy of he -cu { A, E, F, G }? A. 11 (20 + 25 8 11 9 6) B. 34 (8 + 11 + 9 + 6) C. 45 (20 + 25) D. 79 (20 + 25 + 8 + 11 + 9 + 6) ource capaciy A 20 B 8 C 10 D 6 12 8 11 9 6 8 E 1 F 16 G 25 H arge 7

Mincu applicaion (RAND 1950) Free world goal. Cu upplie (if Cold War urn ino real war). rail nework connecing Sovie Union wih Eaern European counrie (map declaified by Penagon in 1999) 8

Maxflow problem Efficien Maximum Flow Algorihm by Andrew Goldberg and Bob Tarjan hp://vimeo.com/774435 9

Maxflow problem Inpu. An edge-weighed digraph, ource verex, and arge verex. each edge ha a poiive capaciy capaciy 9 10 4 15 15 10 5 8 10 15 6 4 15 10 16 10

v Maxflow problem Def. An -flow (flow) i an aignmen of value o he edge uch ha: Capaciy conrain: 0 edge flow edge capaciy. Local equilibrium: inflow = ouflow a every verex (excep and ). flow capaciy inflow a v = 5 + 5 + 0 = 10 5 / 9 ouflow a v = 10 + 0 = 10 0 / 4 5 / 15 5 / 10 5 / 5 5 / 8 1 0 / 4 0 / 6 10 / 16 11

Maxflow problem Def. An -flow (flow) i an aignmen of value o he edge uch ha: Capaciy conrain: 0 edge flow edge capaciy. Local equilibrium: inflow = ouflow a every verex (excep and ). Def. The value of a flow i he inflow a. we aume no edge poin o or from 5 / 9 0 / 4 5 / 15 5 / 10 5 / 5 5 / 8 value = 5 + 10 + 10 = 25 1 0 / 4 0 / 6 10 / 16 12

Maxflow problem Def. An -flow (flow) i an aignmen of value o he edge uch ha: Capaciy conrain: 0 edge flow edge capaciy. Local equilibrium: inflow = ouflow a every verex (excep and ). Def. The value of a flow i he inflow a. Maximum -flow (maxflow) problem. Find a flow of maximum value. 8 / 9 0 / 4 2 / 15 8 / 10 5 / 5 8 / 8 value = 8 + 10 + 10 = 28 13 / 15 0 / 4 3 / 6 13 / 16 13

Maxflow applicaion (Toloǐ 1930) Sovie Union goal. Maximize flow of upplie o Eaern Europe. flow capaciy rail nework connecing Sovie Union wih Eaern European counrie (map declaified by Penagon in 1999) 14

Summary Inpu. An edge-weighed digraph, ource verex, and arge verex. Mincu problem. Find a cu of minimum capaciy. Maxflow problem. Find a flow of maximum value. 5 / 5 13 / 15 0 / 4 0 / 4 8 / 9 2 / 15 8 / 8 3 / 6 13 / 16 value of flow = 28 capaciy of cu = 28 Remarkable fac. Thee wo problem are dual! 8 / 10 10 8 10 15

6.4 MAXIMUM FLOW Algorihm ROBERT SEDGEWICK KEVIN WAYNE hp://alg4.c.princeon.edu inroducion Ford Fulkeron algorihm maxflow mincu heorem analyi of running ime Java implemenaion applicaion

Ford Fulkeron algorihm Iniializaion. Sar wih 0 flow. iniializaion flow capaciy 0 / 9 0 / 10 0 / 4 0 / 10 value of flow 0 / 5 0 / 8 0 / 10 0 0 / 4 0 / 6 0 / 10 0 / 16 17

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 1 augmening pah 0 / 9 boleneck capaciy = 10 10 0 / 10 10 0 / 4 10 0 / 10 0 / 5 0 / 8 10 0 / 10 0 + 10 = 10 0 / 4 0 / 6 0 / 10 0 / 16 18

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 2 nd augmening pah 0 / 9 0 / 4 1 0 / 10 0 / 5 0 / 8 10 + 10 = 20 10 15 0 / 4 0 / 6 10 0 / 10 10 10 0 / 16 19

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 3 rd augmening pah 5 0 / 9 backward edge (no empy) 0 / 4 5 10 / 15 5 0 / 10 10 5 0 / 5 5 0 / 8 20 + 5 = 25 1 0 / 6 0 / 4 10 / 16 20

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 4 h augmening pah 8 5 / 9 backward edge (no empy) 0 / 4 2 5 / 15 8 5 / 10 10 5 / 5 8 5 / 8 25 + 3 = 28 13 10 10 / 15 15 3 0 / 6 0 / 4 13 10 / 16 21

Idea: increae flow along augmening pah Terminaion. All pah from o are blocked by eiher a Full forward edge. Empy backward edge. no more augmening pah 8 / 9 0 / 4 2 / 15 8 / 10 5 / 5 8 / 8 28 13 / 15 3 / 6 0 / 4 13 / 16 full forward edge empy backward edge 22

Maxflow: quiz 2 Which i he augmening pah of highe boleneck capaciy? A. A F G H B. A B C D H C. A F B G H D. A F B G C D H flow capaciy A 20 / 20 B 8 / 8 C 4 / 10 D ource 1 / 6 5 / 12 8 / 8 4 / 11 4 / 9 0 / 6 4 / 8 E 1 / 1 F 14 / 16 G 22 / 25 H arge 23

Ford Fulkeron algorihm Ford Fulkeron algorihm Sar wih 0 flow. While here exi an augmening pah: - find an augmening pah - compue boleneck capaciy - updae flow on ha pah by boleneck capaciy Fundamenal queion. How o find an augmening pah? How many augmening pah? Guaraneed o compue a maxflow? Given a maxflow, how o compue a mincu? 25

6.4 MAXIMUM FLOW Algorihm ROBERT SEDGEWICK KEVIN WAYNE hp://alg4.c.princeon.edu inroducion Ford Fulkeron algorihm maxflow mincu heorem analyi of running ime Java implemenaion applicaion

Relaionhip beween flow and cu Def. The ne flow acro a cu (A, B) i he um of he flow on i edge from A o B minu he um of he flow on i edge from B o A. ne flow acro cu = 5 + 10 + 10 = 25 5 / 9 0 / 4 5 / 15 5 / 10 5 / 5 5 / 8 value of flow = 25 1 0 / 4 0 / 6 10 / 16 27

Relaionhip beween flow and cu Def. The ne flow acro a cu (A, B) i he um of he flow on i edge from A o B minu he um of he flow on i edge from B o A. ne flow acro cu = 10 + 5 + 10 = 25 5 / 9 0 / 4 5 / 15 5 / 10 5 / 5 5 / 8 value of flow = 25 1 0 / 4 0 / 6 10 / 16 28

Relaionhip beween flow and cu Def. The ne flow acro a cu (A, B) i he um of he flow on i edge from A o B minu he um of he flow on i edge from B o A. ne flow acro cu = (10 + 10 + 5 + 10 + 0 + 0) (5 + 5 + 0 + 0) = 25 5 / 9 0 / 4 5 / 15 5 / 10 edge from B o A 5 / 5 5 / 8 value of flow = 25 1 0 / 4 0 / 6 10 / 16 29

Maxflow: quiz 3 Which i he ne flow acro he -cu { A, E, F, G }? A. 11 (20 + 25 8 11 9 6) B. 26 (20 + 22 8 4 4) C. 42 (20 + 22) D. 45 (20 + 25) flow capaciy A 20 / 20 B 8 / 8 C 4 / 10 D ource 1 / 6 5 / 12 8 / 8 4 / 11 4 / 9 0 / 6 4 / 8 E 1 / 1 F 14 / 16 G 22 / 25 H arge 30

Relaionhip beween flow and cu Flow value lemma. Le f be any flow and le (A, B) be any cu. Then, he ne flow acro (A, B) equal he value of f. Inuiion. Conervaion of flow. Pf. By inducion on he ize of B. Bae cae: B = { }. Inducion ep: remain rue by local equilibrium when moving any verex from A o B. Corollary. Ouflow from = inflow o = value of flow. 31

Relaionhip beween flow and cu Weak dualiy. Le f be any flow and le (A, B) be any cu. Then, he value of he flow f he capaciy of he cu (A, B). Pf. Value of flow f = ne flow acro cu (A, B) capaciy of cu (A, B). flow value lemma flow bounded by capaciy 8 / 9 0 / 4 2 / 15 8 / 10 10 5 / 5 7 / 8 9 / 10 5 12 / 15 0 / 4 2 / 6 15 12 / 16 value of flow = 27 capaciy of cu = 30 32

Maxflow mincu heorem Augmening pah heorem. A flow f i a maxflow iff no augmening pah. Maxflow mincu heorem. Value of he maxflow = capaciy of mincu. Pf. For any flow f, he following hree condiion are equivalen: i. f i a maxflow. ii. There i no augmening pah wih repec o f. iii. There exi a cu whoe capaciy equal he value of he flow f. [ i ii ] We prove conrapoiive: ~ii ~i. rong dualiy Suppoe ha here i an augmening pah wih repec o f. Can improve flow f by ending flow along hi pah. Thu, f i no a maxflow. 33

Maxflow mincu heorem Augmening pah heorem. A flow f i a maxflow iff no augmening pah. Maxflow mincu heorem. Value of he maxflow = capaciy of mincu. Pf. For any flow f, he following hree condiion are equivalen: i. f i a maxflow. ii. There i no augmening pah wih repec o f. iii. There exi a cu whoe capaciy equal he value of he flow f. [ iii i ] Suppoe ha (A, B) i a cu wih capaciy equal o he value of f. Then, he value of any flow f ' capaciy of (A, B) = value of f. Thu, f i a maxflow. weak dualiy by aumpion 34

Maxflow mincu heorem [ ii iii ] Le f be a flow wih no augmening pah. Le A be e of verice conneced o by an undireced pah wih no full forward or empy backward edge. By definiion of cu (A, B), i in A. By definiion of cu (A, B) and flow f, i in B. Capaciy of (A, B) = ne flow acro cu = value of flow f. A G backward edge from B o A (flow = 0) B flow value lemma forward edge from A o B (flow = capaciy) 35

Compuing a mincu from a maxflow To compue mincu (A, B) from maxflow f : By augmening pah heorem, no augmening pah wih repec o f. Compue A = e of verice conneced o by an undireced pah wih no full forward or empy backward edge. Capaciy of cu (A, B) = value of flow f. 8 / 9 0 / 4 2 / 15 8 / 10 5 / 5 8 / 8 A 13 13 / 15 15 3 / 4 6 / 6 forward edge (no full) 16 / 16 full forward edge empy backward edge backward edge (no empy) 36

Maxflow: quiz 4 Given he following maxflow, which i a mincu? A. S = { A }. B. S = { A, B, C, E, F }. C. Boh A and B. D. Neiher A nor B. flow capaciy A 20 / 20 B 8 / 9 C 8 / 8 D ource 1 / 1 11 / 13 4 / 8 8 / 8 0 / 9 0 / 6 8 / 8 E 1 / 1 F 16 / 16 G 24 / 25 H arge 37

6.4 MAXIMUM FLOW Algorihm ROBERT SEDGEWICK KEVIN WAYNE hp://alg4.c.princeon.edu inroducion Ford Fulkeron algorihm maxflow mincu heorem analyi of running ime Java implemenaion applicaion

Ford Fulkeron algorihm analyi (wih ineger capaciie) Imporan pecial cae. Edge capaciie are ineger beween 1 and U. Invarian. The flow i inegral hroughou Ford Fulkeron. Pf. [by inducion] Boleneck capaciy i an ineger. Flow on an edge increae/decreae by boleneck capaciy. Propoiion. Number of augmenaion he value of he maxflow. Pf. Each augmenaion increae he value by a lea 1. Inegraliy heorem. There exi an inegral maxflow. Pf. flow on each edge i an ineger criical for ome applicaion (ay uned) Propoiion + Augmening pah heorem FF erminae wih maxflow. Propoiion + Invarian FF erminae wih an inegral flow. 39

0 0 Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. iniialize wih 0 flow 0 flow capaciy 0 1 0 40

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. 1 augmening pah 0 1 0 0 1 1 0 0 1 41

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. 2 nd augmening pah 1 0 1 1 1 0 0 1 1 42

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. 3 rd augmening pah 1 2 1 0 1 1 1 1 2 43

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. 4 h augmening pah 2 1 2 1 1 0 1 2 2 44

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large.... 45

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. 199 h augmening pah 99 99 0 1 1 99 99 46

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. 200 h augmening pah 99 1 1 0 99 47

Bad cae for Ford Fulkeron Bad new. Even when edge capaciie are ineger, number of augmening pah could be very large. exponenial in inpu ize 0 1 48

How o chooe augmening pah? Good new. Clever choice lead o efficien algorihm. augmening pah number of pah implemenaion hore pah (fewe edge) ½ E V queue (BFS) fae pah (max boleneck capaciy) E ln(e U) prioriy queue flow nework wih V verice, E edge, and ineger capaciie beween 1 and U Theoreical Improvemen in Algorihmic Efficiency for Nework Flow Problem JACK EDMONDS Univeriy of Waerloo, Waerloo, Onario, Canada AND RICHARD M. KARP Univeriy of California, Berkeley, California ABSTRACT. Thi paper preen new algorihm for he maximum flow problem, he Hichcock ranporaion problem, and he general minimum-co flow problem. Upper bound on he number of ep in hee algorihm are derived, and are hown o compale favorably wih upper bound on he number of ep required by earlier algorihm. Edmond-Karp 1972 (USA) Dinic 1970 (Sovie Union) 49

6.4 MAXIMUM FLOW Algorihm ROBERT SEDGEWICK KEVIN WAYNE hp://alg4.c.princeon.edu inroducion Ford Fulkeron algorihm maxflow mincu heorem analyi of running ime Java implemenaion applicaion

Maxflow and mincu applicaion Maxflow/mincu i a widely applicable problem-olving model. Daa mining. Open-pi mining. Biparie maching. Nework reliabiliy. Baeball eliminaion. Image egmenaion. Nework conneciviy. Diribued compuing. Securiy of aiical daa. Egaliarian able maching. Muli-camera cene reconrucion. Senor placemen for homeland ecuriy. Many, many, more. liver and hepaic vacularizaion egmenaion 51

Biparie maching problem Problem. Given n people and n ak, aign he ak o people o ha: Every ak i aigned o a qualified peron. Every peron i aigned o exacly one ak. 52

Biparie maching problem Problem. Given a biparie graph, find a perfec maching (if one exi). biparie graph perfec maching 1 2 3 6 7 8 1 9 2 6 3 8 4 10 5 7 4 9 5 10 n ak n people peron 10 i qualified o perform ak 4 and 5 53

Maxflow formulaion of biparie maching Creae,, one verex for each ak, and one verex for each peron. Add edge from o each ak (of capaciy 1). Add edge from each peron o (of capaciy 1). Add edge from ak o qualified peron (of infinie capaciy). flow nework 1 6 1 1 2 7 3 8 4 9 5 10 n ak n people 54

Maxflow formulaion of biparie maching 1 1 correpondence beween perfec maching in biparie graph and inegral flow of value n in flow nework. Inegraliy heorem + 1 1 correpondence Maxflow formulaion i correc. flow nework 1 6 2 7 3 8 4 9 5 10 n ak n people 55

Maxflow: quiz 5 How many augmenaion doe he Ford Fulkeron algorihm make o find a perfec maching in a biparie graph wih n verice per ide? A. n value of flow n B. n 2 C. n 3 D. n 4 56

Maximum flow algorihm: heory (Ye anoher) holy grail for heoreical compuer cieni. year mehod wor cae dicovered by 1951 implex E 3 U Danzig 1955 augmening pah E 2 U Ford Fulkeron 1970 hore augmening pah E 3 Diniz, Edmond Karp 1970 fae augmening pah E 2 log E log( E U ) Diniz, Edmond Karp 1977 blocking flow E 5/2 Cherkaky 1978 blocking flow E 7/3 Galil 1983 dynamic ree E 2 log E Sleaor Tarjan 1985 capaciy caling E 2 log U Gabow 1997 lengh funcion E 3/2 log E log U Goldberg Rao 2012 compac nework E 2 / log E Orlin?? E? maxflow algorihm for pare nework wih E edge, ineger capaciie beween 1 and U 57

Maximum flow algorihm: pracice Warning. Wor-cae order-of-growh i generally no ueful for predicing or comparing maxflow algorihm performance in pracice. Be in pracice. Puh relabel mehod wih gap relabeling: E 3/2. Compuer viion. Specialized algorihm for problem wih pecial rucure. On Implemening Puh-Relabel Mehod for he Maximum Flow Problem Bori V. Cherkaky 1 and Andrew V. Goldberg 2 1 Cenral Iniue for Economic and Mahemaic, Kraikova S. 32, 117418, Mocow, Ruia cher@eemi.mk.u 2 Compuer Science Deparmen, Sanford Univeriy Sanford, CA 94305, USA goldberg ~c. anford, edu Abrac. We udy efficien implemenaion of he puh-relabel mehod for he maximum flow problem. The reuling code are faer han he previou code, and much faer on ome problem familie. The peedup i due o he combinaion of heuriic ued in our implemenaion. We alo exhibi a family of problem for which he running ime of all known mehod eem o have a roughly quadraic growh rae. ELSEVIER European Journal of Operaional Reearch 97 (1997) 509-542 Theory and Mehodology EUROPEAN JOURNAL OF OPERATIONAL RESEARCH Compuaional inveigaion of maximum flow algorihm Ravindra K. Ahuja a, Murali Kodialam a b, Ajay K. Mihra c, Jame B. Orlin d,. Deparmen ~'lndurial and Managemen Engineering. Indian Iniue of Technology. Kanpur, 208 016, India b AT& T Bell Laboraorie, Holmdel, NJ 07733, USA c KA'F-Z Graduae School of Buine, Univeriy of Piburgh, Piburgh, PA 15260, USA d Sloun School of Managemen, Maachue Iniue of Technology. Cambridge. MA 02139. USA Received 30 Augu 1995; acceped 27 June 1996 58

Summary Mincu problem. Find an -cu of minimum capaciy. Maxflow problem. Find an -flow of maximum value. Dualiy. Value of he maxflow = capaciy of mincu. Proven ucceful approache. Ford Fulkeron (variou augmening-pah raegie). Preflow puh (variou verion). Open reearch challenge. Pracice: olve real-world maxflow/mincu problem in linear ime. Theory: prove i for wor-cae inpu. Sill much o be learned! 59