The Max Flow Problem

Similar documents
Mathematics for Decision Making: An Introduction. Lecture 13

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

Math 5490 Network Flows

Two Applications of Maximum Flow

Discrete Optimization 2010 Lecture 3 Maximum Flows

Maximum flow problem

Maximum flow problem (part I)

Algorithms: Lecture 12. Chalmers University of Technology

Internet Routing Example

Breadth-First Search of Graphs

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

Maximum flow problem CE 377K. February 26, 2015

Minimum cost transportation problem

The maximum flow problem

Flows. Chapter Circulations

Graphs and Network Flows IE411. Lecture 15. Dr. Ted Ralphs

Network Flows. 4. Maximum Flows Problems. Fall 2010 Instructor: Dr. Masoud Yaghini

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.

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

Graphs and Network Flows IE411. Lecture 12. Dr. Ted Ralphs

MAS210 Graph Theory Exercises 5 Solutions (1) v 5 (1)

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

Lecture 2: Network Flows 1

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

Lecture 13: Polynomial-Time Algorithms for Min Cost Flows. (Reading: AM&O Chapter 10)

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

Parallel Graph Algorithms (con4nued)

Energy minimization via graph-cuts

15.082J and 6.855J and ESD.78J October 21, Max Flows 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)}

Discrete Optimization 23

CMPSCI 611: Advanced Algorithms

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

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

Ngày 20 tháng 7 năm Discrete Optimization Graphs

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

Bulletin of the Transilvania University of Braşov Vol 8(57), No Series III: Mathematics, Informatics, Physics,

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

2.13 Maximum flow with a strictly positive initial feasible flow

Selected partial inverse combinatorial optimization problems with forbidden elements. Elisabeth Gassner

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

Cutting Plane Methods II

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

Recall: Matchings. Examples. K n,m, K n, Petersen graph, Q k ; graphs without perfect matching

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk

CS 4407 Algorithms Lecture: Shortest Path Algorithms

Observation 4.1 G has a proper separation of order 0 if and only if G is disconnected.

Observation 4.1 G has a proper separation of order 0 if and only if G is disconnected.

Lecture 21 November 11, 2014

3.3 Easy ILP problems and totally unimodular matrices

Algorithms: COMP3121/3821/9101/9801

Algorithms and Theory of Computation. Lecture 11: Network Flow

Longest paths in strong spanning oriented subgraphs of strong semicomplete multipartite digraphs

Single Source Shortest Paths

Single Source Shortest Paths

Introduction to Graph Theory

Parallel Graph Algorithms (con4nued)

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

Contents. Introduction

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search

Mathematics for Decision Making: An Introduction. Lecture 8

Network Flow Problems Luis Goddyn, Math 408

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

CSC 373: Algorithm Design and Analysis Lecture 12

Semi-Markov/Graph Cuts

Acyclic Digraphs arising from Complete Intersections

Chapter 7 Network Flow Problems, I

Fundamental Algorithms 11

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

Breadth First Search, Dijkstra s Algorithm for Shortest Paths

VISUALIZING, FINDING AND PACKING DIJOINS

PATH PROBLEMS IN SKEW-SYMMETRIC GRAPHS ANDREW V. GOLDBERG COMPUTER SCIENCE DEPARTMENT STANFORD UNIVERSITY STANFORD, CA

2 GRAPH AND NETWORK OPTIMIZATION. E. Amaldi Introduction to Operations Research Politecnico Milano 1

ACYCLIC DIGRAPHS GIVING RISE TO COMPLETE INTERSECTIONS

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

Chapter 10. Maximum flow

Paths and cycles in extended and decomposable digraphs

Review Questions, Final Exam

MA015: Graph Algorithms

16 February 2010 Draft Version

Multicommodity Flows and Column Generation

CS 1501 Recitation. Xiang Xiao

On the oriented chromatic index of oriented graphs

EXERCISES SHORTEST PATHS: APPLICATIONS, OPTIMIZATION, VARIATIONS, AND SOLVING THE CONSTRAINED SHORTEST PATH PROBLEM. 1 Applications and Modelling

Algorithms. Algorithms 6.4 MAXIMUM FLOW

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

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

The Budget-Constrained Maximum Flow Problem

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

Design and Analysis of Algorithms

CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk. 10/8/12 CMPS 2200 Intro.

Maximum Flow Problem (Ford and Fulkerson, 1956)

The Maximum Flow Problem with Disjunctive Constraints

Analysis of Algorithms I: All-Pairs Shortest Paths

Paths with two blocks in n-chromatic digraphs

A FAST MAX FLOW ALGORITHM

Mathematical Programs Linear Program (LP)

Analysis of Algorithms. Outline. Single Source Shortest Path. Andres Mendez-Vazquez. November 9, Notes. Notes

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

Advanced Combinatorial Optimization September 24, Lecture 5

Transcription:

The Max Flow Problem jla,jc@imm.dtu.dk Informatics and Mathematical Modelling Technical University of Denmark 1

1 3 4 6 6 1 2 4 3 r 3 2 4 5 7 s 6 2 1 8 1 3 3 2 6 2

Max-Flow Terminology We consider a digraph G = (V, E) which for each e has a capacity u e R +. Furthermore two special vertices r and s are given; these are called resp. the source and the sink. A flow in G is a function x : E R + satisfying: v V \ {r, s} : x wv x vw = 0 (w,v) E (w,v) E (v, w) E : 0 x vw u vw 3

Flow For a flow we define: f x (v) = x wv x vw (w,v) E (w,v) E f x (v) is the net flow into v or the excess for x in v. f x (s) is called the value of x. 4

Math. Programming Model of Max Flow max f x (s) f x (v) = 0 v V \ {r, s} 0 x e u e e E x e integral, e E 5

Max Flow and cuts We now consider R V. δ(r) is the set of edges incident from a vertex in R to a vertex in V \ R. δ(r) is also called the cut generated by R: δ(r) = {(v, w) E v R, w V \ R} R is an r,s-cut if r R and s / R. The capacity of the cut R is defined as: u(δ(r)) = (u,w) E,v R,w V \R u vw 6

Relationship between flows and cuts Proposition: For any (r, s)-cut δ(r) and any (r, s)-flow x we have: x(δ(r)) x(δ( R)) = f x (s) Corollary: For any feasible (r, s)-flow x and any (r, s)-cut δ(r), we have: f x (s) u(δ(r)). 7

The Residual graph Suppose that x is a flow in G. The residual graph shows how flow excess can be moved in G given that the flow x is already present. The residual graph G x for G wrt. x is defined by: V (G x ) = V E(G x ) = {(v, w) (v, w) E x vw < u vw } {(w, v) (v, w) E x vw > 0} 8

Incrementing and augmenting path A path is called x-incrementing if for every forward arc e x e < u e and for every backward arc x e > 0. A x-incrementing path from r to s is called x-augmenting. 9

Algorithm for the Max-Flow Problem 1. Utilize spare capacity 2. dipaths in the residual path 3. flow augmenting path 10

Initialize x vw 0 for all (v, w) E repeat construct G x find an augmenting path if (s is reached) augment x as much as possible until (s is not reachable from r in G x ) 11

Finding an augmenting path Input: The network G = (V, E, u) and the current feasible flow x. Output: An augmenting path from r to s and the capacity for the flow augmentation. Initialize: all vertices are unlabeled; Q := {r}, S :=, p[.] := 0; u max [v] := + for v G 12

while Q and s is not labeled yet select a v Q and scan {(v, w) E} {(w, v) E} if (v, w) E and x vw < u vw and w unlabeled: label w; Q := Q {w}; p[w] := v u max [w] := min{u max [v], u vw x vw } if (w, v) E and x wv > 0 and w unlabeled: label w; Q := Q {w}; p[w] := v u max [w] := min{u max [v], x wv } Q := Q \ {v}; S := S {v} if s is labeled then the r-s-aug. path is given by the predecessor index p[]. Otherwise no r s-augmenting path exists. 13

Augmenting a feasible flow x Input: The network G = (V, E, u), the current feasible flow x, an augmenting path P from r to s in G x and the x-width of P. Output: An updated feasible flow x. for (v, w) P : (v, w) E : x vw = x vw + u max [s] for (v, w) P : (w, v) E : x wv = x wv u max [s] for all other (v, w) E : x vw = x vw 14

Max Flow - Min Cut Theorem Given a network G = (V, E, U) and a current feasible flow x. The following 3 statements are equivalent: x is a maximum flow in G. A flow augmenting r-s-path does not exist (an r-s-dipath in G x ). An r, s-cut R exists with capacity equal to the value of x, ie. u(r) = f x (s). 15

We call an augmenting path from r to s shortest if it has the minimum possible number of arcs. The augmenting path algorithm with a breadth-first search solves the maximum flow problem in O(nm 2 ). Breadth-first can easily be established using a queue. 16