Algorithms and Theory of Computation. Lecture 11: Network Flow

Size: px
Start display at page:

Download "Algorithms and Theory of Computation. Lecture 11: Network Flow"

Transcription

1 Algorithms and Theory of Computation Lecture 11: Network Flow Xiaohui Bei MAS 714 September 18, 2018 Nanyang Technological University MAS 714 September 18, / 26

2 Flow Network A flow network is a directed graph G = (V, E) with a source s V and a sink t V, and a nonnegative integer capacity c(e) for each edge e E. no parallel edges, no edge enters s, no edge leaves t abstraction for material flowing through the edges a 9 d s 5 b 8 e 10 t c 16 f Nanyang Technological University MAS 714 September 18, / 26

3 Flow in Flow Networks A s-t flow (flow) f : E R is a function that satisfies: e E : 0 f(e) c(e) [capacity] v V {s, t} : e into v f(e) = e out of v f(e) [flow conservation] The value of a flow f is: val(f) = e out of s f(e). Max-Flow Problem Find a flow of maximum value. a 8/9 d 10/10 0/4 2/15 0/15 8/10 s 5/5 b 8/8 e 10/10 t 13/15 0/4 3/6 0/15 10/10 c 13/16 Nanyang Technological University MAS 714 September 18, / 26 f val(f) = 28

4 Cut in flow networks A s-t cut (cut) is a partition (A, B) of the vertices with s A and t B. The capacity of a cut is the sum of the capacities of edges from A to B. Min-Cut Problem Find a cut of minimum capacity. a 9 d s 5 b 8 e 10 t c 16 f Nanyang Technological University MAS 714 September 18, / 26

5 Application The Max Flow problem models the situation where commodities need to be transported through a network with limited capacities bipartite matching disjoint paths airline scheduling image segmentation project selection baseball elimination etc. Nanyang Technological University MAS 714 September 18, / 26

6 Application: Matching Given an undirect graph G = (V, E), a subset of edges M E is a matching if each vertex appears in at most one edge in M. Bipartite Matching Given a bipartite graph G = (L R, E), find a max cardinality matching Nanyang Technological University MAS 714 September 18, / 26

7 Bipartite Matching: Max-Flow Formulation Create a directed graph G = {L R {s, t}, E }. Direct all edges from L to R, and assign infinite capacity. Add sources s, and unit capacity edges from s to each vertex in L. Add sink t, and unit capacity edges from each vertex in R to t. Theorem The max cardinality of a matching in G = the value of max flow in G. 1 5 s Nanyang Technological University MAS 714 September 18, / t

8 Towards a max-flow algorithm First try: greedy algorithm start with f(e) = 0 for all edges e E find an s t path P where each edge has f(e) < c(e) augment flow along path P repeat until stuck a 0/4 3/4 c 10/10 8/10 2/2 0/2 0/8 8/8 7/8 0/6 6/6 0/10 6/10 9/10 s b 0/10 6/10 9/10 0/9 2/9 8/9 9/9 10/10 8/10 val(f) = 0 val(f) = = 8 val(f) = = 10 val(f) = = 16 val(f) = 16 optimal val(f) = 19 d t Nanyang Technological University MAS 714 September 18, / 26

9 Residual Graph Residual edge undo flow sent Original edge: e = (u, v) E flow f(e) e = (u, v) and e R = (v, u) residual capacity: capacity c(e) { c(e) f(e) if e E c f (e) = f(e) if e R E u 6/17 v 6 u 11 v Residual Graph: G f = (V, E f ) residual edges with positive residual capacity E f = {e : f(e) < c(e)} {e R : f(e) > 0} key property: f + f is a flow in G iff f is a flow in G f Nanyang Technological University MAS 714 September 18, / 26

10 Augmenting Path An augmenting path is a simple s t path P in the residual graph G f. The bottleneck capacity of an augmenting P is the minimum residual capacity of any edge in P. Key Property Let f be a flow and let P be an augmenting path in G f. Then f is a flow and val(f ) = val(f) + bottleneck(g f, P) Algorithm: Augment(f, c, P): b = bottleneck capacity of path P; foreach edge e P do if e E then f(e) = f(e) + b; else f(e R ) = f(e R ) b; return f Nanyang Technological University MAS 714 September 18, / 26

11 Ford-Fulkerson Algorithm Ford-Fulkerson augmenting path algorithm start with f(e) = 0 for all edges e E find an augmenting path P in the residual graph G f augment flow along path P repeat until stuck Algorithm: Ford-Fulkerson(G, s, t, c): foreach edge e E do f(e) = 0; G f = residual graph; while there exists an augmenting path P in G f do f = Augment(f, c, P); Update G f ; return f Nanyang Technological University MAS 714 September 18, / 26

12 Demo a 4 c s 10 b 9 d 10 t Nanyang Technological University MAS 714 September 18, / 26

13 net flow across cut = = 25 net flow across cut = = 25 net flow across cut Nanyang Technological University MAS 714 September 18, / 26 Relationship between Flows and Cuts Flow Value Lemma Let f be any flow and let (A, B) be any cut. Then the net flow across (A, B) equals the value of f, that is, f(e) f(e) = val(f). e out of A e into A a 5/9 d 10/10 0/4 5/15 0/15 5/10 s 5/5 b 5/8 e 10/10 t 10/15 0/4 0/6 0/15 10/10 c 10/16 f

14 Relationship between Flows and Cuts Flow Value Lemma Let f be any flow and let (A, B) be any cut. Then the net flow across (A, B) equals the value of f, that is, f(e) f(e) = val(f). e out of A e into A Proof. val(f) = f(e) e out of s = v A = ( e out of v f(e) e out of A e into A f(e) ) f(e) e into v f(e) by flow conservation Nanyang Technological University MAS 714 September 18, / 26

15 Weak Duality Weak Duality Let f be any flow and (A, B) be any cut. Then val(f) cap(a, B). Proof. val(f) = f(e) f(e) e out of A e out of A e out of A = cap(a, B) f(e) c(e) e into A Nanyang Technological University MAS 714 September 18, / 26

16 Max-Flow Min-Cut Theorem Augmenting Path Theorem A flow f is a max-flow iff there are no augmenting paths. Max-Flow Min-Cut Theorem Value of max-flow = capacity of min-cut. Proof: show the following three conditions are equivalent for any flow f 1 There exists a cut (A, B) such that cap(a, B) = val(f). 2 f is a max-flow. 3 There is no augmenting path with respect to f. Nanyang Technological University MAS 714 September 18, / 26

17 Max-Flow Min-Cut Theorem Proof. [(1) = (2)] : Trivial by weak duality. [(2) = (3)] : Assume by contradiction that there is an augmenting path with respect to f. Can improve flow f by sending flow along this path. Thus f is not a max-flow. Nanyang Technological University MAS 714 September 18, / 26

18 Max-Flow Min-Cut Theorem Proof. [(3) = (1)] : Let f be a flow with no augmenting paths. Let A be the set of vertices reachable from s in the residual graph G f. By the definition of cut A, s A. By the definition of flow f, t / A. val(f) = f(e) f(e) = e out of A e out of A = cap(a, B) c(e) e into A Nanyang Technological University MAS 714 September 18, / 26

19 Back to Ford-Fulkerson Algorithm: Ford-Fulkerson(G, s, t, c): foreach edge e E do f(e) = 0; G f = residual graph; while there exists an augmenting path P in G f do f = Augment(f, c, P); Update G f ; return f Theorem The Ford-Fulkerson algorithm computes a maximum flow of the network. Directly from the augmenting path theorem. Nanyang Technological University MAS 714 September 18, / 26

20 Running Time Analysis Assumption. Capacities are integers between 1 and C. Integrality invariant. Throughout the algorithm, the flow values f(e) and the residual capacities c f (e) are integers. Theorem The algorithm terminates in at most val(f ) nc iterations. Proof. Each augmentation increases the value by at least 1. Corollary The running time of Ford-Fulkerson is O(mnC). Nanyang Technological University MAS 714 September 18, / 26

21 Bad Case for Ford-Fulkerson Is generic Ford-Fulkerson algorithm polynomial time in input size? No. Input size is polynomial in m, n, log C. s C a 1 C t Augmenting Path: s a b t s b a t s a b t C b C s b a t... Requires 2C iterations. Nanyang Technological University MAS 714 September 18, / 26

22 Choosing Good Augmenting Paths Goal. Choose augmenting paths so that: Can find augmenting paths efficiently. Algorithm takes few iterations. Choosing augmenting paths with max bottleneck capacity sufficiently large bottleneck capacity fewest number of edges Nanyang Technological University MAS 714 September 18, / 26

23 Capacity-scaling algorithm Intuition. Choose augmenting path with (almost) highest bottleneck capacity: it increases flow by max possible amount in given iteration. Detail of the algorithm is omitted. Theorem The scaling algorithm finds a max flow in O(m log C) augmentations. It can be implemented to run in O(m 2 log C) time. Nanyang Technological University MAS 714 September 18, / 26

24 Shortest Augmenting Paths Lemma 1. Throughout the algorithm, length of the shortest path never decreases. Lemma 2. After at most m shortest path augmentations, the length of the shortest augmenting path strictly increases. O(m + n) time to find shortest augmenting path via BFS. O(m) augmentations for paths of exactly k edges. O(mn) augmentations. Theorem The shortest augmenting path algorithm runs in O(m 2 n) time. Nanyang Technological University MAS 714 September 18, / 26

25 Choosing Good Augmenting Paths: Summary Assumption. Integer capacities between 1 and C. method augmentations running time augmenting path nc O(mnC) fattest augmenting path m log (mc) O(m 2 log n log (mc)) capacity scaling m log C O(m 2 log C) improved capacity scaling m log C O(mn log C) shortest augmenting path mn O(m 2 n) improved shortest augmenting mn O(mn 2 ) path dynamic trees mn O(mn log n) Nanyang Technological University MAS 714 September 18, / 26

26 Max-Flow Algorithms: Theory year method worst case discovered by 1951 simplex O(m 3 C) Dantzig 1955 augmenting path O(m 2 C) Ford-Fulkerson 1970 shortest augmenting path O(m 3 ) Dinic, Edmonds-Karp 1970 fattest augmenting path O(m 2 log m log (mc)) Dinic, Edmonds-Karp 1977 blocking flow O(m 5/2 ) Cherkasky 1978 blocking flow O(m 7/3 ) Galil 1983 dynamic trees O(m 2 log m) Sleator-Tarjan 1985 capacity scaling O(m 2 log C) Gabow 1997 length function O(m 3/2 log m log C) Goldberg-Rao 2012 compact network O(m 2 / log m) Orlin?? O(m)? Nanyang Technological University MAS 714 September 18, / 26

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

Agenda. Soviet Rail Network, We ve done Greedy Method Divide and Conquer Dynamic Programming Agenda We ve done Greedy Method Divide and Conquer Dynamic Programming Now Flow Networks, Max-flow Min-cut and Applications c Hung Q. Ngo (SUNY at Buffalo) CSE 531 Algorithm Analysis and Design 1 / 52

More information

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

Running Time. Assumption. All capacities are integers between 1 and C. Running Time Assumption. All capacities are integers between and. Invariant. Every flow value f(e) and every residual capacities c f (e) remains an integer throughout the algorithm. Theorem. The algorithm

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LETURE 28 Network Flow hoosing good augmenting paths apacity scaling algorithm A. Smith /4/2008 A. Smith; based on slides by K. Wayne and S. Raskhodnikova Pre-break: Ford-Fulkerson

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LETURE 2 Network Flow Finish bipartite matching apacity-scaling algorithm Adam Smith 0//0 A. Smith; based on slides by E. Demaine,. Leiserson, S. Raskhodnikova, K. Wayne Marriage

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 7 Network Flow Application: Bipartite Matching Adam Smith 0//008 A. Smith; based on slides by S. Raskhodnikova and K. Wayne Recently: Ford-Fulkerson Find max s-t flow

More information

Soviet Rail Network, 1955

Soviet Rail Network, 1955 Ch7. Network Flow Soviet Rail Network, 955 Reference: On the history of the transportation and maximum flow problems. Alexander Schrijver in Math Programming, 9: 3, 2002. 2 Maximum Flow and Minimum Cut

More information

Algorithms: Lecture 12. Chalmers University of Technology

Algorithms: Lecture 12. Chalmers University of Technology Algorithms: Lecture 1 Chalmers University of Technology Today s Topics Shortest Paths Network Flow Algorithms Shortest Path in a Graph Shortest Path Problem Shortest path network. Directed graph G = (V,

More information

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

directed weighted graphs as flow networks the Ford-Fulkerson algorithm termination and running time Network Flow 1 The Maximum-Flow Problem directed weighted graphs as flow networks the Ford-Fulkerson algorithm termination and running time 2 Maximum Flows and Minimum Cuts flows and cuts max flow equals

More information

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

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 Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. V = {, 2, 3,,,, 7, 8 } E

More information

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

10 Max-Flow Min-Cut Flows and Capacitated Graphs 10 MAX-FLOW MIN-CUT 10 Max-Flow Min-Cut 10.1 Flows and Capacitated Graphs Previously, we considered weighted graphs. In this setting, it was natural to thinking about minimizing the weight of a given path. In fact, we considered

More information

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Algorithms. Algorithms 6.4 MAXIMUM FLOW Algorithms ROBERT SEDGEWICK KEVIN WAYNE 6.4 MAXIMUM FLOW Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu introduction Ford Fulkerson algorithm maxflow mincut

More information

Algorithms: COMP3121/3821/9101/9801

Algorithms: COMP3121/3821/9101/9801 NEW SOUTH WALES Algorithms: COMP32/382/90/980 Aleks Ignjatović School of Computer Science and Engineering University of New South Wales LECTURE 7: MAXIMUM FLOW COMP32/382/90/980 / 24 Flow Networks A flow

More information

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

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 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

More information

7.5 Bipartite Matching

7.5 Bipartite Matching 7. Bipartite Matching Matching Matching. Input: undirected graph G = (V, E). M E is a matching if each node appears in at most edge in M. Max matching: find a max cardinality matching. Bipartite Matching

More information

CMPSCI 611: Advanced Algorithms

CMPSCI 611: Advanced Algorithms 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

More information

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

The max flow problem. Ford-Fulkerson method. A cut. Lemma Corollary Max Flow Min Cut Theorem. Max Flow Min Cut Theorem The max flow problem Ford-Fulkerson method 7 11 Ford-Fulkerson(G) f = 0 while( simple path p from s to t in G f ) 10-2 2 1 f := f + f p output f 4 9 1 2 A cut Lemma 26. + Corollary 26.6 Let f be a flow

More information

Lecture 21 November 11, 2014

Lecture 21 November 11, 2014 CS 224: Advanced Algorithms Fall 2-14 Prof. Jelani Nelson Lecture 21 November 11, 2014 Scribe: Nithin Tumma 1 Overview In the previous lecture we finished covering the multiplicative weights method and

More information

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

Flow Network. The following figure shows an example of a flow network: Maximum Flow 1 Flow Network The following figure shows an example of a flow network: 16 V 1 12 V 3 20 s 10 4 9 7 t 13 4 V 2 V 4 14 A flow network G = (V,E) is a directed graph. Each edge (u, v) E has a

More information

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

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 7 Network Flow Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 7.5 Bipartite Matching Matching Matching. Input: undirected graph G = (V, E). M E is a matching

More information

Algorithms. Algorithms 6.4 MIN CUT / MAX FLOW

Algorithms. Algorithms 6.4 MIN CUT / MAX FLOW Algorithms ROBERT SEDGEWICK KEVIN WAYNE 6.4 MIN CUT / MAX FLOW Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu introduction Ford Fulkerson algorithm maxflow

More information

CSC 373: Algorithm Design and Analysis Lecture 12

CSC 373: Algorithm Design and Analysis Lecture 12 CSC 373: Algorithm Design and Analysis Lecture 12 Allan Borodin February 4, 2013 1 / 16 Lecture 12: Announcements and Outline Announcements Term test 1 in tutorials. Need to use only two rooms due to sickness

More information

Maximum flow problem

Maximum flow problem Maximum flow problem 7000 Network flows Network Directed graph G = (V, E) Source node s V, sink node t V Edge capacities: cap : E R 0 Flow: f : E R 0 satisfying 1. Flow conservation constraints e:target(e)=v

More information

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Algorithms. Algorithms 6.4 MAXIMUM FLOW Algorithms ROBERT SEDGEWICK KEVIN WAYNE 6.4 MAXIMUM FLOW Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu introduction Ford-Fulkerson algorithm maxflow-mincut

More information

22 Max-Flow Algorithms

22 Max-Flow Algorithms A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it. The First Law of Mentat, in Frank Herbert s Dune (965) There s a difference

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Deign and Analyi LECTURES 1-1 Network Flow Flow, cut Ford-Fulkeron Min-cut/max-flow theorem Adam Smith // A. Smith; baed on lide by E. Demaine, C. Leieron, S. Rakhodnikova, K. Wayne Detecting

More information

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

Maximum Flow. Jie Wang. University of Massachusetts Lowell Department of Computer Science. J. Wang (UMass Lowell) Maximum Flow 1 / 27 Maximum Flow Jie Wang University of Massachusetts Lowell Department of Computer Science J. Wang (UMass Lowell) Maximum Flow 1 / 27 Flow Networks A flow network is a weighted digraph G = (V, E), where the

More information

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

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Bipartite Matching Computer Science & Engineering 423/823 Design and s Lecture 07 (Chapter 26) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 36 Spring 2010 Bipartite Matching 2 / 36 Can use

More information

6.046 Recitation 11 Handout

6.046 Recitation 11 Handout 6.046 Recitation 11 Handout May 2, 2008 1 Max Flow as a Linear Program As a reminder, a linear program is a problem that can be written as that of fulfilling an objective function and a set of constraints

More information

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

Flows and Cuts. 1 Concepts. CS 787: Advanced Algorithms. Instructor: Dieter van Melkebeek CS 787: Advanced Algorithms Flows and Cuts Instructor: Dieter van Melkebeek This lecture covers the construction of optimal flows and cuts in networks, their relationship, and some applications. It paves

More information

Two Applications of Maximum Flow

Two Applications of Maximum Flow Two Applications of Maximum Flow The Bipartite Matching Problem a bipartite graph as a flow network maximum flow and maximum matching alternating paths perfect matchings 2 Circulation with Demands flows

More information

Network Flows made simple

Network Flows made simple Network Flows made simple A mild but rigorous introduction to Network Flows Periklis A. Papakonstantinou York University Network Flows is the last algorithmic paradigm we consider. Actually, we only address

More information

1 Review for Lecture 2 MaxFlow

1 Review for Lecture 2 MaxFlow Comp 260: Advanced Algorithms Tufts University, Spring 2009 Prof. Lenore Cowen Scribe: Wanyu Wang Lecture 13: Back to MaxFlow/Edmonds-Karp 1 Review for Lecture 2 MaxFlow A flow network showing flow and

More information

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

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows Matching Input: undirected graph G = (V, E). M E is a matching if each node appears in at most one Part V edge in M. Maximum Matching: find a matching of maximum cardinality Matchings Ernst Mayr, Harald

More information

Internet Routing Example

Internet Routing Example Internet Routing Example Acme Routing Company wants to route traffic over the internet from San Fransisco to New York. It owns some wires that go between San Francisco, Houston, Chicago and New York. The

More information

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

CSC2420: Algorithm Design, Analysis and Theory Spring (or Winter for pessimists) 2017 CSC2420: Algorithm Design, Analysis and Theory Spring (or Winter for pessimists) 2017 Allan Borodin January 30, 2017 1 / 32 Lecture 4 Announcements: I have posted all 7 questions for assignment 1. It is

More information

Lecture 2: Network Flows 1

Lecture 2: Network Flows 1 Comp 260: Advanced Algorithms Tufts University, Spring 2011 Lecture by: Prof. Cowen Scribe: Saeed Majidi Lecture 2: Network Flows 1 A wide variety of problems, including the matching problems discussed

More information

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

Algorithms 6.4 MAXIMUM FLOW. overview Ford-Fulkerson algorithm analysis Java implementation applications 6.4 MAXIMUM FLOW Algorithms F O U R T H E D I T I O N overview Ford-Fulkerson algorithm analysis Java implementation applications R O B E R T S E D G E W I C K K E V I N W A Y N E Algorithms, 4 th Edition

More information

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

Problem set 1. (c) Is the Ford-Fulkerson algorithm guaranteed to produce an acyclic maximum flow? CS261, Winter 2017. Instructor: Ashish Goel. Problem set 1 Electronic submission to Gradescope due 11:59pm Thursday 2/2. Form a group of 2-3 students that is, submit one homework with all of your names.

More information

Chapter 7. Network Flow. CS 350: Winter 2018

Chapter 7. Network Flow. CS 350: Winter 2018 Chapter 7 Network Flow CS 3: Winter 1 1 Soviet Rail Network, Reference: On the hitory of the tranportation and maximum flow problem. Alexander Schrijver in Math Programming, 1: 3,. Maximum Flow and Minimum

More information

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

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)} Preliminaries Graphs G = (V, E), V : set of vertices E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) 1 2 3 5 4 V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)} 1 Directed Graph (Digraph)

More information

Max Flow: Algorithms and Applications

Max Flow: Algorithms and Applications Max Flow: Algorithms and Applications Outline for today Quick review of the Max Flow problem Applications of Max Flow The Ford-Fulkerson (FF) algorithm for Max Flow Analysis of FF, and the Max Flow Min

More information

Chapter 10. Maximum flow

Chapter 10. Maximum flow Chapter 10 Maximum flow An s t flow is defined as a nonnegative real-valued function on the arcs of a digraph satisfying the flow conservation law at each vertex s, t. In this chapter we consider the problem

More information

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

We say that a flow is feasible for G (or just feasible if the graph and capacity function in question are obvious) if CS787: Advanced Algorithms Lecture 4: Network Flow We devote this lecture to the network flow problem and the max-flow min-cut theorem. A number of other problems can be cast into a maximum flow or minimum

More information

Mathematics for Decision Making: An Introduction. Lecture 13

Mathematics for Decision Making: An Introduction. Lecture 13 Mathematics for Decision Making: An Introduction Lecture 13 Matthias Köppe UC Davis, Mathematics February 17, 2009 13 1 Reminder: Flows in networks General structure: Flows in networks In general, consider

More information

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

Today. Flow review. Augmenting paths. Ford-Fulkerson Algorithm. Intro to cuts (reason: prove correctness) Today Flow review Augmenting path Ford-Fulkeron Algorithm Intro to cut (reaon: prove correctne) Flow Network = ource, t = ink. c(e) = capacity of edge e Capacity condition: f(e) c(e) Conervation condition:

More information

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

Types of Networks. Internet Telephone Cell Highways Rail Electrical Power Water Sewer Gas Flow Networks Network Flows 2 Types of Networks Internet Telephone Cell Highways Rail Electrical Power Water Sewer Gas 3 Maximum Flow Problem How can we maximize the flow in a network from a source or

More information

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

CSCE423/823. Introduction. Flow Networks. Ford-Fulkerson Method. Edmonds-Karp Algorithm. Maximum Bipartite Matching 2/35 CSCE423/823. 1/35 2pt 0em Computer Science & Engineering 423/823 Design and s Lecture 07 (Chapter 26) Stephen Scott (Adapted from Vinodchandran N. Variyam) 2/35 Can use a directed graph as a flow network to model:

More information

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

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Recap Network Flow Problems Max-Flow Min Cut Theorem Ford Fulkerson Augmenting Paths Residual Flow Graph Integral Solutions

More information

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

CS 138b Computer Algorithm Homework #14. Ling Li, February 23, Construct the level graph 14.1 Construct the level graph Let s modify BFS slightly to construct the level graph L G = (V, E ) of G = (V, E, c) out of a source s V. We will use a queue Q and an array l containing levels of vertices.

More information

CSC2420: Algorithm Design, Analysis and Theory Fall 2017

CSC2420: Algorithm Design, Analysis and Theory Fall 2017 CSC2420: Algorithm Design, Analysis and Theory Fall 2017 Allan Borodin and Nisarg Shah October 11, 2017 1 / 32 Lecture 5 Announcements: The first assignment is due next week, October 18, at 1:00 PM The

More information

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

Lecture 1. 1 Overview. 2 Maximum Flow. COMPSCI 532: Design and Analysis of Algorithms August 26, 2015 COMPSCI 532: Design and Analysis of Algorithms August 26, 205 Lecture Lecturer: Debmalya Panigrahi Scribe: Allen Xiao Oeriew In this lecture, we will define the maximum flow problem and discuss two algorithms

More information

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

Maximum Integer Flows in Directed Planar Graphs with Multiple Sources and Sinks and Vertex Capacities Maximum Integer Flows in Directed Planar Graphs with Multiple Sources and Sinks and Vertex Capacities Yipu Wang University of Illinois at Urbana-Champaign ywang298@illinois.edu July 12, 2018 Abstract We

More information

Friday, September 21, Flows

Friday, September 21, Flows Flows Building evacuation plan people to evacuate from the offices corridors and stairways capacity 10 10 5 50 15 15 15 60 60 50 15 10 60 10 60 15 15 50 For each person determine the path to follow to

More information

Maximum flow problem (part I)

Maximum flow problem (part I) Maximum flow problem (part I) Combinatorial Optimization Giovanni Righini Università degli Studi di Milano Definitions A flow network is a digraph D = (N,A) with two particular nodes s and t acting as

More information

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

Maximum Flow. Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai Maximum Flow Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai Flow Network A low network G ( V, E) is a directed graph with a source node sv, a sink node tv, a capacity unction c. Each edge ( u,

More information

Energy minimization via graph-cuts

Energy minimization via graph-cuts Energy minimization via graph-cuts Nikos Komodakis Ecole des Ponts ParisTech, LIGM Traitement de l information et vision artificielle Binary energy minimization We will first consider binary MRFs: Graph

More information

Lecture 8 Network Optimization Algorithms

Lecture 8 Network Optimization Algorithms Advanced Algorithms Floriano Zini Free University of Bozen-Bolzano Faculty of Computer Science Academic Year 2013-2014 Lecture 8 Network Optimization Algorithms 1 21/01/14 Introduction Network models have

More information

Dantzig s pivoting rule for shortest paths, deterministic MDPs, and minimum cost to time ratio cycles

Dantzig s pivoting rule for shortest paths, deterministic MDPs, and minimum cost to time ratio cycles Dantzig s pivoting rule for shortest paths, deterministic MDPs, and minimum cost to time ratio cycles Thomas Dueholm Hansen 1 Haim Kaplan Uri Zwick 1 Department of Management Science and Engineering, Stanford

More information

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

Graph Algorithms -2: Flow Networks. N. H. N. D. de Silva Dept. of Computer Science & Eng University of Moratuwa CS4460 Advanced d Algorithms Batch 08, L4S2 Lecture 9 Graph Algorithms -2: Flow Networks Dept. of Computer Science & Eng University of Moratuwa Announcement Assignment 2 is due on 18 th of November Worth

More information

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2) Algorithms and Theory of Computation Lecture 22: NP-Completeness (2) Xiaohui Bei MAS 714 November 8, 2018 Nanyang Technological University MAS 714 November 8, 2018 1 / 20 Set Cover Set Cover Input: a set

More information

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

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 208 Midterm Exam Anticipate having midterm graded at this point Look for comments on Piazza Common Mistakes Average, Max,

More information

Exposition of the Dinitz algorithm

Exposition of the Dinitz algorithm Exposition of the Dinitz algorithm Yefim Dinitz and Avraham A. Melkman Department of Computer Science Ben Gurion University of the Negev, 84105 Beer-Sheva, Israel {dinitz,melkman}@cs.bgu.ac.il June 6,

More information

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

CSE 326: Data Structures Network Flow. James Fogarty Autumn 2007 CSE 36: Data Structures Network Flow James Fogarty Autumn 007 Network Flows Given a weighted, directed graph G=(V,E) Treat the edge weights as capacities How much can we flow through the graph? A 1 B 7

More information

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

GRAPH ALGORITHMS Week 7 (13 Nov - 18 Nov 2017) GRAPH ALGORITHMS Week 7 (13 Nov - 18 Nov 2017) C. Croitoru croitoru@info.uaic.ro FII November 12, 2017 1 / 33 OUTLINE Matchings Analytical Formulation of the Maximum Matching Problem Perfect Matchings

More information

u = 50 u = 30 Generalized Maximum Flow Problem s u = 00 2 u = 00 u = 50 4 = 3=4 u = 00 t capacity u = 20 3 u = 20 = =2 5 u = 00 gain/loss factor Max o

u = 50 u = 30 Generalized Maximum Flow Problem s u = 00 2 u = 00 u = 50 4 = 3=4 u = 00 t capacity u = 20 3 u = 20 = =2 5 u = 00 gain/loss factor Max o Generalized Max Flows Kevin Wayne Cornell University www.orie.cornell.edu/~wayne = 3=4 40 v w 30 advisor: Eva Tardos u = 50 u = 30 Generalized Maximum Flow Problem s u = 00 2 u = 00 u = 50 4 = 3=4 u =

More information

. CS711008Z Algorithm Design and Analysis. Lecture 10. Algorithm design technique: Network flow and its applications 1. Dongbo Bu

. CS711008Z Algorithm Design and Analysis. Lecture 10. Algorithm design technique: Network flow and its applications 1. Dongbo Bu CS711008Z Algorithm Design and Analysis Lecture 10 Algorithm design technique: Network flow and its applications 1 Dongbo Bu Institute of Computing Technology Chinese Academy of Sciences, Beijing, China

More information

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

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 7 Network Flow Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 7.5 Bipartite Matching Matching Matching. Input: undirected graph G = (V, E). M E is a matching

More information

ORIE 633 Network Flows October 4, Lecture 10

ORIE 633 Network Flows October 4, Lecture 10 ORIE 633 Network Flows October 4, 2007 Lecturer: David P. Williamson Lecture 10 Scribe: Kathleen King 1 Efficient algorithms for max flows 1.1 The Goldberg-Rao algorithm Recall from last time: Dinic s

More information

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

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs Instructor: Shaddin Dughmi Outline 1 Introduction 2 Shortest Path 3 Algorithms for Single-Source Shortest

More information

III. Linear Programming

III. Linear Programming III. Linear Programming Thomas Sauerwald Easter 2017 Outline Introduction Standard and Slack Forms Formulating Problems as Linear Programs Simplex Algorithm Finding an Initial Solution III. Linear Programming

More information

Algorithms and Theory of Computation. Lecture 13: Linear Programming (2)

Algorithms and Theory of Computation. Lecture 13: Linear Programming (2) Algorithms and Theory of Computation Lecture 13: Linear Programming (2) Xiaohui Bei MAS 714 September 25, 2018 Nanyang Technological University MAS 714 September 25, 2018 1 / 15 LP Duality Primal problem

More information

Network Flows. CTU FEE Department of control engineering. March 28, 2017

Network Flows. CTU FEE Department of control engineering. March 28, 2017 Network Flows Zdeněk Hanzálek, Přemysl Šůcha hanzalek@fel.cvut.cz CTU FEE Department of control engineering March 28, 2017 Z. Hanzálek (CTU FEE) Network Flows March 28, 2017 1 / 44 Table of contents 1

More information

Parallel Graph Algorithms (con4nued)

Parallel Graph Algorithms (con4nued) Parallel Graph Algorithms (con4nued) MaxFlow A flow network G=(V,E): a directed graph, where each edge (u,v) E has a nonnega4ve capacity c(u,v)>=0. If (u,v) E, we assume that c(u,v)=0. Two dis4nct ver4ces

More information

Multicommodity Flows and Column Generation

Multicommodity Flows and Column Generation Lecture Notes Multicommodity Flows and Column Generation Marc Pfetsch Zuse Institute Berlin pfetsch@zib.de last change: 2/8/2006 Technische Universität Berlin Fakultät II, Institut für Mathematik WS 2006/07

More information

CS 1501 Recitation. Xiang Xiao

CS 1501 Recitation. Xiang Xiao CS 1501 Recitation Xiang Xiao Network Flow A flow network G=(V,E): a directed graph, where each edge (u,v) E has a nonnegative capacity c(u,v)>=0. If (u,v) E, we assume that c(u,v)=0. two distinct vertices

More information

The Budget-Constrained Maximum Flow Problem

The Budget-Constrained Maximum Flow Problem 9 The Budget-Constrained Maximum Flow Problem In this chapter we consider the following problem which is called the constrained maximum flow problem ( Cmfp) [AO95]: We are given a budget B and we seek

More information

Breadth-First Search of Graphs

Breadth-First Search of Graphs Breadth-First Search of Graphs Analysis of Algorithms Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Applications of Breadth-First Search of Graphs a) Single Source

More information

Parallel Graph Algorithms (con4nued)

Parallel Graph Algorithms (con4nued) Parallel Graph Algorithms (con4nued) MaxFlow A flow network G=(V,E): a directed graph, where each edge (u,v) E has a nonnega4ve capacity c(u,v)>=0. If (u,v) E, we assume that c(u,v)=0. Two dis4nct ver4ces

More information

An example of LP problem: Political Elections

An example of LP problem: Political Elections Linear Programming An example of LP problem: Political Elections Suppose that you are a politician trying to win an election. Your district has three different types of areas: urban, suburban, and rural.

More information

The Simplest and Smallest Network on Which the Ford-Fulkerson Maximum Flow Procedure May Fail to Terminate

The Simplest and Smallest Network on Which the Ford-Fulkerson Maximum Flow Procedure May Fail to Terminate Journal of Information Processing Vol.24 No.2 390 394 (Mar. 206) [DOI: 0.297/ipsjjip.24.390] Regular Paper The Simplest and Smallest Network on Which the Ford-Fulkerson Maximum Flow Procedure May Fail

More information

Week 4. (1) 0 f ij u ij.

Week 4. (1) 0 f ij u ij. Week 4 1 Network Flow Chapter 7 of the book is about optimisation problems on networks. Section 7.1 gives a quick introduction to the definitions of graph theory. In fact I hope these are already known

More information

Combinatorial Optimization

Combinatorial Optimization Combinatorial Optimization 2017-2018 1 Maximum matching on bipartite graphs Given a graph G = (V, E), find a maximum cardinal matching. 1.1 Direct algorithms Theorem 1.1 (Petersen, 1891) A matching M is

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 22 Maximum Flow Applications Image segmentation Project selection Extensions to Max Flow Sofya Raskhodnikova 11/07/2016 S. Raskhodnikova; based on slides by E. Demaine,

More information

The Maximum Flow Problem

The Maximum Flow Problem The Maximum Flow Problem put: a directed graph G =(V,E), source node s V, sink node t V edge capacities cap : E IR 0 s 1/0 1/1 1/1 t 2/2 2/1 oal: compute a flow of maximal value, i.e., a function f : E

More information

Maximum Flows & Minimum Cuts

Maximum Flows & Minimum Cuts A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it. The First Law of Mentat, in Frank Herbert s Dune (196) Contrary to expectation,

More information

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

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved. Chapter 11 Approximation Algorithms Slides by Kevin Wayne. Copyright @ 2005 Pearson-Addison Wesley. All rights reserved. 1 Approximation Algorithms Q. Suppose I need to solve an NP-hard problem. What should

More information

The min cost flow problem Course notes for Optimization Spring 2007

The min cost flow problem Course notes for Optimization Spring 2007 The min cost flow problem Course notes for Optimization Spring 2007 Peter Bro Miltersen February 7, 2007 Version 3.0 1 Definition of the min cost flow problem We shall consider a generalization of the

More information

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016) FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016) The final exam will be on Thursday, May 12, from 8:00 10:00 am, at our regular class location (CSI 2117). It will be closed-book and closed-notes, except

More information

Algorithms and Theory of Computation. Lecture 9: Dynamic Programming

Algorithms and Theory of Computation. Lecture 9: Dynamic Programming Algorithms and Theory of Computation Lecture 9: Dynamic Programming Xiaohui Bei MAS 714 September 10, 2018 Nanyang Technological University MAS 714 September 10, 2018 1 / 21 Recursion in Algorithm Design

More information

1 Matchings in Non-Bipartite Graphs

1 Matchings in Non-Bipartite Graphs CS 598CSC: Combinatorial Optimization Lecture date: Feb 9, 010 Instructor: Chandra Chekuri Scribe: Matthew Yancey 1 Matchings in Non-Bipartite Graphs We discuss matching in general undirected graphs. Given

More information

Maximum Skew-Symmetric Flows. September Abstract

Maximum Skew-Symmetric Flows. September Abstract Maximum Skew-Symmetric Flows Andrew V. Goldberg NEC Research Institute 4 Independence Way Princeton, NJ 08540 avg@research.nj.nec.com Alexander V. Karzanov Institute for Systems Analysis 9, Prospect 60

More information

CSE 202 Homework 4 Matthias Springer, A

CSE 202 Homework 4 Matthias Springer, A CSE 202 Homework 4 Matthias Springer, A99500782 1 Problem 2 Basic Idea PERFECT ASSEMBLY N P: a permutation P of s i S is a certificate that can be checked in polynomial time by ensuring that P = S, and

More information

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

The min cost flow problem Course notes for Search and Optimization Spring 2004 The min cost flow problem Course notes for Search and Optimization Spring 2004 Peter Bro Miltersen February 20, 2004 Version 1.3 1 Definition of the min cost flow problem We shall consider a generalization

More information

Discrete Optimization 2010 Lecture 3 Maximum Flows

Discrete Optimization 2010 Lecture 3 Maximum Flows Remainder: Shortest Paths Maximum Flows Discrete Optimization 2010 Lecture 3 Maximum Flows Marc Uetz University of Twente m.uetz@utwente.nl Lecture 3: sheet 1 / 29 Marc Uetz Discrete Optimization Outline

More information

Computing Maximum Flow with Augmenting Electrical Flows

Computing Maximum Flow with Augmenting Electrical Flows Computing Maximum Flow with Augmenting Electrical Flows Aleksander Mądry MIT madry@mit.edu Abstract ( ) We present an Õ m 0 7 U 7 -time algorithm for the maximum s-t flow problem (and the minimum s-t cut

More information

FRACTIONAL PACKING OF T-JOINS. 1. Introduction

FRACTIONAL PACKING OF T-JOINS. 1. Introduction FRACTIONAL PACKING OF T-JOINS FRANCISCO BARAHONA Abstract Given a graph with nonnegative capacities on its edges, it is well known that the capacity of a minimum T -cut is equal to the value of a maximum

More information

Maximum flow problem CE 377K. February 26, 2015

Maximum flow problem CE 377K. February 26, 2015 Maximum flow problem CE 377K February 6, 05 REVIEW HW due in week Review Label setting vs. label correcting Bellman-Ford algorithm Review MAXIMUM FLOW PROBLEM Maximum Flow Problem What is the greatest

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 0, Winter 08 Design and Analysis of Algorithms Lecture 8: Consolidation # (DP, Greed, NP-C, Flow) Class URL: http://vlsicad.ucsd.edu/courses/cse0-w8/ Followup on IGO, Annealing Iterative Global Optimization

More information

A FAST MAX FLOW ALGORITHM

A FAST MAX FLOW ALGORITHM A FAST MAX FLOW ALGORITHM Xiaoyue Gong MIT, xygong@mit.edu James B. Orlin MIT, jorlin@mit.edu Abstract. In 2013, Orlin proved that the max flow problem could be solved in O(nm) time. His algorithm ran

More information

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

CS 170 DISCUSSION 10 MAXIMUM FLOW. Raymond Chan raychan3.github.io/cs170/fa17.html UC Berkeley Fall 17 7 IUION MXIMUM FLOW Raymond han raychan.github.io/cs7/fa7.html U erkeley Fall 7 MXIMUM FLOW Given a directed graph G = (V, E), send as many units of flow from source node s to sink node t. Edges have capacity

More information