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

Similar documents
Algorithm Design and Analysis

Chapter 7. Network Flow. CS 350: Winter 2018

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

Running Time. Assumption. All capacities are integers between 1 and C.

Algorithm Design and Analysis

Soviet Rail Network, 1955

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

Algorithm Design and Analysis

Soviet Rail Network, 1955

Agenda. Soviet Rail Network, We ve done Greedy Method Divide and Conquer Dynamic Programming

Algorithms and Theory of Computation. Lecture 11: Network Flow

CS4800: Algorithms & Data Jonathan Ullman

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 and Minimum Cut

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

Chapter Landscape of an Optimization Problem. Local Search. Coping With NP-Hardness. Gradient Descent: Vertex Cover

Soviet Rail Network, 1955

Algorithm Design and Analysis

directed weighted graphs as flow networks the Ford-Fulkerson algorithm termination and running time

Algorithms: Lecture 12. Chalmers University of Technology

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

Algorithm Design and Analysis

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

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

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

Max Flow: Algorithms and Applications

Algorithms. Algorithms 6.4 MAXIMUM FLOW

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

Lecture 21. The Lovasz splitting-off lemma Topics in Combinatorial Optimization April 29th, 2004

CSC 373: Algorithm Design and Analysis Lecture 12

10 Max-Flow Min-Cut Flows and Capacitated Graphs 10 MAX-FLOW MIN-CUT

The max flow problem. Ford-Fulkerson method. A cut. Lemma Corollary Max Flow Min Cut Theorem. Max Flow Min Cut Theorem

Matching. Slides designed by Kevin Wayne.

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

Today: Max Flow Proofs

Algorithm Design and Analysis

7. NETWORK FLOW II. bipartite matching disjoint paths extensions to max flow 3D Memory Reliability survey design airline scheduling image segmentation

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Balanced Network Flows

Problem Set 8 Solutions

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

4. Connectivity Connectivity Connectivity. Whitney's s connectivity theorem: (G) (G) (G) for special

Algorithms. Algorithms 6.4 MIN CUT / MAX FLOW

7.5 Bipartite Matching

Bogoliubov Transformation in Classical Mechanics

Flow Network. The following figure shows an example of a flow network:

Two Applications of Maximum Flow

LINEAR ALGEBRA METHOD IN COMBINATORICS. Theorem 1.1 (Oddtown theorem). In a town of n citizens, no more than n clubs can be formed under the rules

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

Bipartite Matchings and Stable Marriage

Problem set 1. (c) Is the Ford-Fulkerson algorithm guaranteed to produce an acyclic maximum flow?

Flows and Cuts. 1 Concepts. CS 787: Advanced Algorithms. Instructor: Dieter van Melkebeek

Chapter 6. Dynamic Programming. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Myriad of applications

CMPSCI 611: Advanced Algorithms

CS 170: Midterm Exam II University of California at Berkeley Department of Electrical Engineering and Computer Sciences Computer Science Division

List Coloring Graphs

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

SOME RESULTS ON INFINITE POWER TOWERS

Maximum flow problem CE 377K. February 26, 2015

Theoretical Computer Science. Optimal algorithms for online scheduling with bounded rearrangement at the end

Clustering Methods without Given Number of Clusters

Algorithm Design and Analysis

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Sparse Fault-Tolerant BFS Trees. Merav Parter and David Peleg Weizmann Institute Of Science BIU-CS Colloquium

- Well-characterized problems, min-max relations, approximate certificates. - LP problems in the standard form, primal and dual linear programs

Source slideplayer.com/fundamentals of Analytical Chemistry, F.J. Holler, S.R.Crouch. Chapter 6: Random Errors in Chemical Analysis

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

LINEAR PROGRAMMING III

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

Types of Networks. Internet Telephone Cell Highways Rail Electrical Power Water Sewer Gas

Parallel Graph Algorithms (con4nued)

New bounds for Morse clusters

Mathematics for Decision Making: An Introduction. Lecture 13

Hybrid Control and Switched Systems. Lecture #6 Reachability

List coloring hypergraphs

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows

Network Flows made simple

Network Flow. Data Structures and Algorithms Andrei Bulatov

arxiv: v2 [math.co] 11 Sep 2017

Preemptive scheduling on a small number of hierarchical machines

We say that a flow is feasible for G (or just feasible if the graph and capacity function in question are obvious) if

Maximum flow problem

22 Max-Flow Algorithms

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

Graphs III - Network Flow

Maximum Flow. Jie Wang. University of Massachusetts Lowell Department of Computer Science. J. Wang (UMass Lowell) Maximum Flow 1 / 27

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

Discrete Mathematics

Algorithm Design and Analysis

Parallel Graph Algorithms (con4nued)

11.2 Stability. A gain element is an active device. One potential problem with every active circuit is its stability

12. LOCAL SEARCH. gradient descent Metropolis algorithm Hopfield neural networks maximum cut Nash equilibria

Electronic Theses and Dissertations

Physics 2212 G Quiz #2 Solutions Spring 2018

Mathematical Programs Linear Program (LP)

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

CSE 521: Design & Analysis of Algorithms I

Sampling and the Discrete Fourier Transform

Algorithms: COMP3121/3821/9101/9801

Transcription:

Chapter 7 Network Flow Slide by Kevin Wayne. Copyright 5 Pearon-Addion Weley. All right reerved.

Soviet Rail Network, 55 Reference: On the hitory of the tranportation and maximum flow problem. Alexander Schrijver in Math Programming, :,.

Maximum Flow and Minimum Cut Max flow and min cut. Two very rich algorithmic problem. Cornertone problem in combinatorial optimization. Beautiful mathematical duality. Nontrivial application / reduction. Data mining. Open-pit mining. Project election. Airline cheduling. Bipartite matching. Baeball elimination. Image egmentation. Network reliability. Ditributed computing. Egalitarian table matching. Security of tatitical data. Network intruion detection. Multi-camera cene recontruction. Many many more... Network connectivity.

Minimum Cut Problem Flow network. Abtraction for ubtance flowing through the edge. G = (V, E) = directed graph, no parallel edge. Two ditinguihed node: = ource, t = target. c(e) = capacity of edge e. 5 5 5 ource 5 t target capacity 5 5 7

Cut Def. An -t cut i a partition (A, B) of V with A and t B. Def. The capacity of a cut (A, B) i: cap( A, B) = c(e) e out of A 5 5 5 5 t A 5 5 7 Capacity = + 5 + 5 = 5

Cut Def. An -t cut i a partition (A, B) of V with A and t B. Def. The capacity of a cut (A, B) i: cap( A, B) = c(e) e out of A 5 5 5 5 t A 5 5 7 Capacity = + 5 + + =

Minimum Cut Problem Min -t cut problem. Find an -t cut of minimum capacity. 5 5 5 5 t A 5 5 7 Capacity = + + = 7

Flow Def. An -t flow i a function that atifie: For each e E: f (e) c(e) (capacity) For each v V {, t}: f (e) = f (e) (conervation) e in to v e out of v Def. The value of a flow f i: v( f ) = f (e) e out of. 5 5 5 5 t capacity 5 5 flow 7 Value =

Flow Def. An -t flow i a function that atifie: For each e E: f (e) c(e) (capacity) For each v V {, t}: f (e) = f (e) (conervation) e in to v e out of v Def. The value of a flow f i: v( f ) = f (e) e out of. 5 5 5 5 t capacity 5 5 flow 7 Value =

Maximum Flow Problem Max flow problem. Find -t flow of maximum value. 5 5 5 5 t capacity 5 5 flow 7 Value =

Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -t cut. Then, the net flow ent acro the cut i equal to the amount leaving. e out of A f (e) e in to A f (e) = v( f ) 5 5 5 5 t A 5 5 7 Value =

Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -t cut. Then, the net flow ent acro the cut i equal to the amount leaving. e out of A f (e) e in to A f (e) = v( f ) 5 5 5 5 t A 5 5 7 Value = + + - + =

Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -t cut. Then, the net flow ent acro the cut i equal to the amount leaving. e out of A f (e) e in to A f (e) = v( f ) 5 5 5 5 t A 5 5 7 Value = - + - + =

Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -t cut. Then f (e) f (e) = v( f ). e out of A e in to A Pf. v( f ) = f (e) e out of by flow conervation, all term except v = are = v ( f (e) f (e) ) A e out of v e in to v = f (e) e out of A f (e). e in to A

Flow and Cut Weak duality. Let f be any flow, and let (A, B) be any -t cut. Then the value of the flow i at mot the capacity of the cut. Cut capacity = Flow value 5 5 5 5 t A 5 5 7 Capacity = 5

Flow and Cut Weak duality. Let f be any flow. Then, for any -t cut (A, B) we have v(f) cap(a, B). Pf. v( f ) = f (e) e out of A e out of A f (e) c(e) e out of A = cap(a, B) e in to A f (e) A 7 B t

Certificate of Optimality Corollary. Let f be any flow, and let (A, B) be any cut. If v(f) = cap(a, B), then f i a max flow and (A, B) i a min cut. Value of flow = Cut capacity = Flow value 5 5 5 5 t A 5 5 7 7

Toward a Max Flow Algorithm Greedy algorithm. Start with f(e) = for all edge e E. Find an -t path P where each edge ha f(e) < c(e). Augment flow along path P. Repeat until you get tuck. t Flow value =

Toward a Max Flow Algorithm Greedy algorithm. Start with f(e) = for all edge e E. Find an -t path P where each edge ha f(e) < c(e). Augment flow along path P. Repeat until you get tuck. X X t X Flow value =

Toward a Max Flow Algorithm Greedy algorithm. Start with f(e) = for all edge e E. Find an -t path P where each edge ha f(e) < c(e). Augment flow along path P. Repeat until you get tuck. locally optimality global optimality t t greedy = opt =

Reidual Graph Original edge: e = (u, v) E. capacity Flow f(e), capacity c(e). u 7 v flow Reidual edge. "Undo" flow ent. e = (u, v) and e R = (v, u). reidual capacity Reidual capacity: u v c f (e) = { c(e)-f(e) if e E reidual capacity f(e R ) if e R E Reidual graph: G f = (V, E f ). Reidual edge with poitive reidual capacity. E f = {e : f(e) < c(e)} {e R : f(e) > }.

Ford-Fulkeron Algorithm G: capacity 5 t

Ford-Fulkeron Algorithm G: flow capacity 5 t Flow value =

Ford-Fulkeron Algorithm G: X X flow capacity X 5 t Flow value = G f : reidual capacity 5 t

Ford-Fulkeron Algorithm G: X X X X 5 t Flow value = G f : 5 t 5

Ford-Fulkeron Algorithm G: X X X X 5 t Flow value = G f : 7 5 t

Ford-Fulkeron Algorithm G: X X X X 5 t Flow value = G f : 5 t 7

Ford-Fulkeron Algorithm X G: X 7 X X X 5 t Flow value = G f : 5 t

Ford-Fulkeron Algorithm G: 7 5 t Flow value = G f : 7 5 t

Ford-Fulkeron Algorithm G: 7 5 t Cut capacity = Flow value = G f : 7 5 t

Augmenting Path Algorithm Augment(f, c, P) { b bottleneck(p,c,f) foreach e P { } if (e E) f(e) f(e) + b ele f(e R ) f(e R ) - b } return f min reidual capacity of edge on P forward edge revere edge Ford-Fulkeron(G,, t, c) { foreach e E f(e) G f reidual graph } while (there exit augmenting path P in G f ) { f Augment(f, c, P) update G f (along path P) } return f

Max-Flow Min-Cut Theorem Augmenting path theorem. Flow f i a max flow iff there are no augmenting path. Max-flow min-cut theorem. [Ford-Fulkeron 5] The value of the max flow i equal to the value of the min cut. Proof trategy. We prove both imultaneouly by howing the following are equivalent: (i) There exit a cut (A, B) uch that v(f) = cap(a, B). (ii) Flow f i a max flow. (iii) There i no augmenting path relative to f. (i) (ii) Thi wa the corollary to weak duality lemma. (ii) (iii) We how contrapoitive: Let f be a flow. If there exit an augmenting path, then we can improve f by ending flow along path.

Proof of Max-Flow Min-Cut Theorem (iii) (i) Let f be a flow with no augmenting path. Let A be et of vertice reachable from in reidual graph. By definition of A, A. By definition of G f, t A. v( f ) = f (e) e out of A = c(e) e out of A = cap(a, B) e in to A f (e) (otherwie connect outide A) A B t original network

Running Time Aumption. All capacitie are integer between and C. Invariant. Every flow value f(e) and every reidual capacitie c f (e) remain an integer throughout the algorithm. Theorem. The algorithm terminate in at mot v(f*) nc iteration. Pf. Each augmentation increae value by at leat. Corollary. If C =, Ford-Fulkeron run in O(mn) time. Integrality theorem. If all capacitie are integer, then there exit a max flow f for which every flow value f(e) i an integer. Pf. Since algorithm terminate, theorem follow from invariant.

7. Chooing Good Augmenting Path

Ford-Fulkeron: Exponential Number of Augmentation Q. I generic Ford-Fulkeron algorithm polynomial in input ize? m, n, and log C A. No. If C=larget capacity, then algorithm can take C iteration. X C C X X C C t X X X t C C X C iteration C C X X

Chooing Good Augmenting Path Ue care when electing augmenting path. Some choice lead to exponential algorithm. Clever choice lead to polynomial algorithm. If capacitie are irrational, algorithm not guaranteed to terminate! Goal: chooe augmenting path o that: Can find augmenting path efficiently. Few iteration. Chooe augmenting path with: [Edmond-Karp 7, Dinitz 7] Max bottleneck capacity. Sufficiently large bottleneck capacity. Fewet number of edge. 7

Capacity Scaling Intuition. Chooing path with highet bottleneck capacity increae flow by max poible amount. Don't worry about finding exact highet bottleneck path. Maintain caling parameter Δ. Let G f (Δ) be the ubgraph of the reidual graph coniting of only edge with capacity at leat Δ. t t 7 7 G f G f ()

Capacity Scaling Scaling-Max-Flow(G,, t, c, C) { foreach e E f(e) Δ larget power of C G f reidual graph } while (Δ ) { G f (Δ) Δ-reidual graph while (there exit augmenting path P in G f (Δ)) { f augment(f, c, P) update G f (Δ) (along P) } Δ Δ / } return f

Ford-Fulkeron Algorithm G: flow capacity 5 t Flow value =

Ford-Fulkeron Algorithm with Capacity Scaling G: flow capacity 5 t Flow value = Δ = G f : reidual capacity 5 t

Ford-Fulkeron Algorithm with Capacity Scaling G: X X flow capacity X 5 t Flow value = G f (): reidual capacity 5 t

Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f : 5 t

Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f (): 5 t

Ford-Fulkeron Algorithm with Capacity Scaling G: X X X X 5 t Flow value = G f (): 5 t 5

Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f : 5 t

Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f (): 5 t 7

Ford-Fulkeron Algorithm with Capacity Scaling X G: X 5 X X X 5 t Flow value = G f (): 5 t

Ford-Fulkeron Algorithm with Capacity Scaling G: 5 5 t Flow value = 7 Δ = G f : 5 5 t

Ford-Fulkeron Algorithm with Capacity Scaling G: X X5 7 X 5 t Flow value = 7 G f (): 5 5 t 5

Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Flow value = Δ = G f : 7 5 t 5

Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Flow value = Δ = G f (): 7 5 t 5

Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Flow value = G f (): 7 5 t 5

Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Cut capacity = Flow value = G f (): 7 5 t A = {vertice reachable from in G f ()} 5

Capacity Scaling: Correctne Aumption. All edge capacitie are integer between and C. Integrality invariant. All flow and reidual capacity value are integral. Correctne. If the algorithm terminate, then f i a max flow. Pf. By integrality invariant, when Δ = G f (Δ) = G f. Upon termination of Δ = phae, there are no augmenting path. 55

Capacity Scaling: Running Time Lemma. Let f be the flow at the end of a Δ-caling phae. Then the value of the maximum flow i at mot v(f) + m Δ. Pf. (almot identical to proof of max-flow min-cut theorem) We how that at the end of a Δ-phae, there exit a cut (A, B) uch that cap(a, B) v(f) + m Δ. Chooe A to be the et of node reachable from in G f (Δ). By definition of A, A. By definition of G f (Δ), t A. v( f ) = f (e) e out of A (c(e) e out of A = c(e) e in to A Δ) f (e) e in to A e out of A e out of A e in to A cap(a, B) - m Δ Δ Δ Δ A B t original network 5

Capacity Scaling: Running Time Lemma. The outer while loop repeat + log C time. Pf. Initially C/ < Δ C < Δ. Δ decreae by a factor of each iteration. Lemma. Let f be the flow at the end of a Δ-caling phae. Then the value of the maximum flow i at mot v(f) + m Δ. proof on previou lide Lemma. There are at mot m augmentation per caling phae. Pf. Initially, each of the m edge can carry at mot C<Δ flow. In general, conider the ituation at the beginning of a Δ-phae. Each augmentation in a Δ-phae will increae v(f) by at leat Δ. Let f be the flow at the end of the previou caling (Δ-)phae. Lemma v(f*) v(f) + m (Δ). Theorem. The caling max-flow algorithm find a max flow in O(m log C) augmentation. It can be implemented to run in O(m log C) time. 57

Chapter 7 Network Flow Slide by Kevin Wayne. Copyright 5 Pearon-Addion Weley. All right reerved. 5