CMPSCI 611: Advanced Algorithms

Similar documents
1 Review for Lecture 2 MaxFlow

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

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

Lecture 2: Network Flows 1

Algorithms: COMP3121/3821/9101/9801

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

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

CSE 326: Data Structures Network Flow. James Fogarty Autumn 2007

6.046 Recitation 11 Handout

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

Algorithms and Theory of Computation. Lecture 11: Network Flow

Discrete Optimization 2010 Lecture 3 Maximum Flows

Exposition of the Dinitz algorithm

The min cost flow problem Course notes for Search and Optimization Spring 2004

The min cost flow problem Course notes for Optimization Spring 2007

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

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

Maximum Flow. Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai

Lecture 8 Network Optimization Algorithms

Two Applications of Maximum Flow

Algorithm Design and Analysis

Maximum flow problem

CS 1501 Recitation. Xiang Xiao

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Graph Algorithms -2: Flow Networks. N. H. N. D. de Silva Dept. of Computer Science & Eng University of Moratuwa

CSC 373: Algorithm Design and Analysis Lecture 12

Algorithm Design and Analysis

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

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

Lecture 3. 1 Polynomial-time algorithms for the maximum flow problem

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

Algorithms: Lecture 12. Chalmers University of Technology

Mathematics for Decision Making: An Introduction. Lecture 13

Internet Routing Example

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

22 Max-Flow Algorithms

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

Lecture 1. 1 Overview. 2 Maximum Flow. COMPSCI 532: Design and Analysis of Algorithms August 26, 2015

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees

Review Questions, Final Exam

Basics on the Graphcut Algorithm. Application for the Computation of the Mode of the Ising Model

Energy minimization via graph-cuts

Lecture 13 Spectral Graph Algorithms

p 3 p 2 p 4 q 2 q 7 q 1 q 3 q 6 q 5

The maximum flow problem

CS 4407 Algorithms Lecture: Shortest Path Algorithms

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

Maximum flow problem (part I)

ORIE 633 Network Flows October 4, Lecture 10

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

CS 138b Computer Algorithm Homework #14. Ling Li, February 23, Construct the level graph

Maximum flow problem CE 377K. February 26, 2015

Max Flow: Algorithms and Applications

CSCE423/823. Introduction. Flow Networks. Ford-Fulkerson Method. Edmonds-Karp Algorithm. Maximum Bipartite Matching 2/35 CSCE423/823.

Maximum Flows & Minimum Cuts

Lecture 18: More NP-Complete Problems

Design and Analysis of Algorithms

Lecture 21 November 11, 2014

GRAPH ALGORITHMS Week 7 (13 Nov - 18 Nov 2017)

Algorithm Design and Analysis

Flows. Chapter Circulations

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

Algorithm Theory - Exercise Class

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi

Breadth-First Search of Graphs

The Budget-Constrained Maximum Flow Problem

Network Design and Game Theory Spring 2008 Lecture 2

Minimum cost transportation problem

CSE 202 Homework 4 Matthias Springer, A

CSC2420: Algorithm Design, Analysis and Theory Spring (or Winter for pessimists) 2017

CS675: Convex and Combinatorial Optimization Fall 2016 Combinatorial Problems as Linear and Convex Programs. Instructor: Shaddin Dughmi

Advanced Algorithms Lecture Notes. Periklis A. Papakonstantinou

The partial inverse minimum cut problem with L 1 -norm is strongly NP-hard. Elisabeth Gassner

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Small distortion and volume preserving embedding for Planar and Euclidian metrics Satish Rao

Maximum skew-symmetric flows and matchings

An example of LP problem: Political Elections

(1,3) (3,4) (2,2) (1,2) (2,4) t

Lexicographic Flow. Dexter Kozen Department of Computer Science Cornell University Ithaca, New York , USA. June 25, 2009

Parallel Graph Algorithms (con4nued)

Lecture 5 January 16, 2013

Discrete Optimization Lecture 5. M. Pawan Kumar

NP-Completeness. Algorithmique Fall semester 2011/12

IS 709/809: Computational Methods in IS Research Fall Exam Review

1 Matchings in Non-Bipartite Graphs

Notes on Graph Theory

C&O 355 Mathematical Programming Fall 2010 Lecture 18. N. Harvey

Midterm Exam 2 Solutions

Standard Diraphs the (unique) digraph with no vertices or edges. (modulo n) for every 1 i n A digraph whose underlying graph is a complete graph.

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

CSE 421 Introduction to Algorithms Final Exam Winter 2005

Design and Analysis of Algorithms

Soviet Rail Network, 1955

Maximum Flow Problem (Ford and Fulkerson, 1956)

Network Flows made simple

ACO Comprehensive Exam March 20 and 21, Computability, Complexity and Algorithms

Lecture 6 January 15, 2014

Maximum Integer Flows in Directed Planar Graphs with Multiple Sources and Sinks and Vertex Capacities

MA015: Graph Algorithms

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

Transcription:

CMPSCI 611: Advanced Algorithms Lecture 12: Network Flow Part II Andrew McGregor Last Compiled: December 14, 2017 1/26

Definitions Input: Directed Graph G = (V, E) Capacities C(u, v) > 0 for (u, v) E and C(u, v) = 0 for (u, v) E A source node s, and sink node t 2/26

Capacity 16 12 v 1 v 2 20 s 10 4 9 7 t 13 v 3 v 4 14 4 3/26

Definitions Input: Directed Graph G = (V, E) Capacities C(u, v) > 0 for (u, v) E and C(u, v) = 0 for (u, v) E A source node s, and sink node t Output: A flow f from s to t where f : V V R satisfies Skew-symmetry: u, v V, f (u, v) = f (v, u) Conservation of Flow: v V {s, t}, u V f (u, v) = 0 Capacity Constraints: u, v V, f (u, v) C(u, v) Goal: Maximize size of the flow, i.e., the total flow coming leaving s: f = v V f (s, v) 4/26

Capacity 16 12 v 1 v 2 20 s 10 4 9 7 t 13 v 3 v 4 14 4 5/26

Capacity/Flow 16/11 12/12 v 1 v 2 20/15 s 10/0 4/1 9/4 7/7 t 13/8 v 3 v 4 14/11 4/4 6/26

Cut Definitions Definition An s t cut of G is a partition of the vertices into two sets A and B such that s A and t B. Definition The capacity of a cut (A, B) is C(A, B) = u A,v B C(u, v) Definition The flow across a cut (A, B) is f (A, B) = u A,v B f (u, v) Note that because of capacity constraints: f (A, B) C(A, B) 7/26

First Cut 16/11 12/12 v 1 v 2 20/15 s 10/0 4/1 9/4 7/7 t 13/8 v 3 v 4 14/11 4/4 8/26

Second Cut 16/11 12/12 v 1 v 2 20/15 s 10/0 4/1 9/4 7/7 t 13/8 v 3 v 4 14/11 4/4 9/26

All cuts have same flow Lemma For any flow f : for all s-t cuts (A, B), f (A, B) equals f. Proof. By induction on size of A where s A Base Case: A = {s} and f (s, V s) = f Induction Hypothesis: f (A, B) = f for all A such that A = k Consider cut (A, B ) where A = k + 1. Let u A s: f (A, B ) = f (A u, B + u) v A f (v, u) + v B f (u, v) By skew-symmetry and conservation of flow f (v, u) f (u, v) = f (v, u)+ f (v, u) = f (v, u) = 0 v A v B v A v B v V Hence, f (A, B ) = f (A u, B + u) = f by induction hypothesis. 10/26

Max-Flow Min-Cut Theorem (Max-Flow Min-Cut) For any flow network and flow f, the following statements are equivalent: 1. f is a maximum flow. 2. There exists an s t cut (A, B) such that f = C(A, B) 11/26

Residual Networks and Augmenting Paths Residual network encodes how you can change the flow between two nodes given the current flow and the capacity constraints. Definition Given a flow network G = (V, E) and flow f in G, the residual network G f is defined as G f = (V, E f ) where E f = {(u, v) : C(u, v) f (u, v) > 0} C f (u, v) = C(u, v) f (u, v) Note that (u, v) E f implies either C(u, v) > 0 or C(v, u) > 0. Definition An augmenting path for flow f is a path from s to t in graph G f. The bottleneck capacity b(p) is the minimum capacity in G f of any edge of p. We can increase flow by b(p) along an augmenting path. 12/26

Capacity/Flow 16/11 12/12 v 1 v 2 20/15 s 10/0 4/1 9/4 7/7 t 13/8 v 3 v 4 14/11 4/4 13/26

Residual 11 12 v 1 v 2 15 s 5 5 11 3 5 4 7 5 t 8 v 3 v 4 3 11 4 14/26

Augmenting Path 11 12 v 1 v 2 15 s 5 5 11 3 5 4 7 5 t 8 v 3 v 4 3 11 4 15/26

Old Flow 16/11 12/12 v 1 v 2 20/15 s 10/0 4/1 9/4 7/7 t 13/8 v 3 v 4 14/11 4/4 16/26

New Flow 16/11 12/12 v 1 v 2 20/19 s 10/0 4/1 9/0 7/7 t 13/12 v 3 v 4 14/11 4/4 17/26

Min Capacity Cut Proves this is Optimal 16/11 12/12 v 1 v 2 20/19 s 10/0 4/1 9/0 7/7 t 13/12 v 3 v 4 14/11 4/4 18/26

Old Residual Graph 11 12 v 1 v 2 15 s 5 5 11 3 5 4 7 5 t 8 v 3 v 4 3 11 4 19/26

New Residual Graph 11 12 v 1 v 2 19 s 5 1 11 3 9 7 1 t 12 v 3 v 4 3 11 4 20/26

Max-Flow Min-Cut Theorem (Max-Flow Min-Cut) For any flow network and flow f, the following statements are equivalent: 1. f is a maximum flow. 2. There exists an s t cut (A, B) with f = f (A, B) = C(A, B). 3. There doesn t exist an augmenting path in G f. Proof. (2 1): Increasing flow, increases f (A, B) which violates capacity (1 3): If p is an augmenting path, can increase flow by b(p) (3 2): Suppose G f has no augmenting path. Define cut A = {v : v is reachable from s in G f } and B = V A u A, v B, f (u, v) = C(u, v). Hence C(A, B) = f (A, B) = f 21/26

Ford-Fulkerson Algorithm Algorithm 1. flow f = 0 2. while there exists an augmenting path p for f 2.1 find augmenting path p 2.2 augment f by b(p) units along p 3. return f Theorem The algorithms finds a maximum flow in time O( E f ) if capacities are integral where f is the size of the maximum flow. Proof. O( E ) time to find each augmenting path via BFS and f iterations because each augmenting path increases flow by at least 1. 22/26

Ford-Fulkerson Algorithm with Edmonds-Karp Heuristic Algorithm 1. flow f = 0 2. while there exists an augmenting path p for f 2.1 find shortest (unweighted) augmenting path p 2.2 augment f by b(p) units along p 3. return f Theorem The algorithms finds a maximum flow in time O( E 2 V ) 23/26

Proof of Running Time (1/3) Definition Let δ f (s, u) be length of shortest unweighted path from s to u in the G f. Definition (u, v) is critical if it s on augmenting path p for f and C f (u, v) = b(p). Lemma δ f (s, v) is non-decreasing as f changes. Lemma Between occasions when (u, v) is critical, δ f (s, u) increases by at least 2. Proof of Running Time. Max distance in G f At most 2 E edges in residual network is V so any edge is critical at most V /2 times There s a critical edge in each iteration so O( E V ) iterations Each iteration takes O( E ) to find shortest path 24/26

Proof of Running Time (2/3) Lemma δ f (s, v) is non-decreasing as f changes. Proof. Consider augmenting f to f For contradiction, pick v that minimizes δ f (s, v) subject to: δ f (s, v) < δ f (s, v) and let u be vertex before v on shortest path in G f from s to v Claim (u, v) E f Otherwise δf (s, v) δ f (s, u) + 1 But δf (s, u) δ f (s, u) and so δ f (s, v) δ f (s, u) + 1 = δ f (s, v) (u, v) E f and (u, v) E f implies augmentation contains (v, u) Since augmentation was shortest path: δ f (s, v) = δ f (s, u) 1 δ f (s, u) 1 = δ f (s, v) 2 25/26

Proof of Running Time (3/3) Lemma Between occasions when (u, v) is critical, δ f (s, u) increases by at least 2. Proof. Let (u, v) be critical in the augmentation of f Since (u, v) on shortest path: δ f (s, u) = δ f (s, v) 1 After augmentation (u, v) disappears from residual network! Let f be next flow with (u, v) G f and f be flow right before f (u, v) G f but (u, v) G f implies (v, u) used to augment f Therefore δ f (s, v) = δ f (s, u) 1 and so δ f (s, u) = δ f (s, v) 1 δ f (s, v) 1 = δ f (s, u) 2 26/26