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

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

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

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

Algorithms and Theory of Computation. Lecture 11: Network Flow

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

1 Review for Lecture 2 MaxFlow

Algorithm Design and Analysis

Algorithm Design and Analysis

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

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

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

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

The min cost flow problem Course notes for Optimization Spring 2007

Algorithms: COMP3121/3821/9101/9801

CMPSCI 611: Advanced Algorithms

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

Maximum flow problem

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

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

Lecture 8 Network Optimization Algorithms

Exposition of the Dinitz algorithm

CS 1501 Recitation. Xiang Xiao

22 Max-Flow Algorithms

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

CSC 373: Algorithm Design and Analysis Lecture 12

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

Mathematics for Decision Making: An Introduction. Lecture 13

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

Algorithms: Lecture 12. Chalmers University of Technology

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

Lecture 2: Network Flows 1

Max Flow: Algorithms and Applications

Soviet Rail Network, 1955

Network Flows made simple

Design and Analysis of Algorithms

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

Energy minimization via graph-cuts

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

Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation / P, N P and co-n P

CHAPTER 1 REAL NUMBERS KEY POINTS

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

Discrete Optimization 2010 Lecture 3 Maximum Flows

Two Applications of Maximum Flow

Day 6: 6.4 Solving Polynomial Equations Warm Up: Factor. 1. x 2-2x x 2-9x x 2 + 6x + 5

conp = { L L NP } (1) This problem is essentially the same as SAT because a formula is not satisfiable if and only if its negation is a tautology.

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

6.046 Recitation 11 Handout

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

Algorithm Design and Analysis

Internet Routing Example

Chapter 1: Preliminaries and Error Analysis

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

Computer Arithmetic. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Computer Arithmetic

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Network Flow Problems Luis Goddyn, Math 408

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

Multicommodity Flows and Column Generation

How do computers represent numbers?

Maximum flow problem CE 377K. February 26, 2015

Reductions. Example 1

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

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

NP, polynomial-time mapping reductions, and NP-completeness

Unit 1A: Computational Complexity

Lecture 2: Divide and conquer and Dynamic programming

Lecture #21. c T x Ax b. maximize subject to

Lecture 4: An FPTAS for Knapsack, and K-Center

The maximum flow problem

Parallel Graph Algorithms (con4nued)

Parallel Graph Algorithms (con4nued)

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

Numerical Methods. Exponential and Logarithmic functions. Jaesung Lee

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

CSC373: Algorithm Design, Analysis and Complexity Fall 2017 DENIS PANKRATOV NOVEMBER 1, 2017

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

The Multiroute Maximum Flow Problem Revisited

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Advanced Algorithms Lecture Notes. Periklis A. Papakonstantinou

Maximum flow problem (part I)

not to be republished NCERT REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results

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.

A An Overview of Complexity Theory for the Algorithm Designer

Maximum Flow Problem (Ford and Fulkerson, 1956)

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES

Introduction to Techniques for Counting

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

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

Discrete Optimization Lecture 5. M. Pawan Kumar

CS264: Beyond Worst-Case Analysis Lecture #18: Smoothed Complexity and Pseudopolynomial-Time Algorithms

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

Lecture 11: Generalized Lovász Local Lemma. Lovász Local Lemma

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

CS264: Beyond Worst-Case Analysis Lecture #11: LP Decoding

29 Linear Programming

CS264: Beyond Worst-Case Analysis Lecture #15: Smoothed Complexity and Pseudopolynomial-Time Algorithms

Midterm Exam 2 Solutions

Lecture 21 November 11, 2014

Transcription:

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 in G and let (S,T) be a cut in G. Then f = f(s,t). Let f be a flow in G and let (S,T) be a cut in G. Then f c(s,t). This is a weak duality theorem. S T c(s,t)=26 3 4 Max Flow Min Cut Theorem Let f be a flow in G. The following three conditions are equivalent: 1. f is a maximum flow 2. G f contains no augmenting path 3. There is a cut (S,T) so that f =c(s,t) Max Flow Min Cut Theorem The value of the maximum flow in G is equal to the capacity of the minimum cut in G. This is a strong duality theorem. 6 1

Remarks The solution values agree, not the solutions themselves flows and cuts are completely different objects. Consequence The Ford-Fulkerson method is partially correct, i.e., if it terminates it produces the flow with the maximum value. Given a max flow we can easily find a min cut (follows from proof of max flow-min cut theorem). Going the other way is less obvious. 7 8 Local search checklist Design: How do we find the first feasible solution? ٧ Neighborhood design? ٧ Which neighbor to choose? Analysis: Partial correctness? (termination correctness) Termination? Complexity? ٧ Termination Suppose all capacities are integers. We start with a flow of value 0. In each iteration, we get a new flow with higher integer value. We always have a legal flow, i.e., one of value at most f. Hence we can have at most f iterations. 9 10 Correctness of Ford-Fulkerson Since Ford-Fulkerson is partially correct and it terminates if capacities are integers it is a correct algorithm for finding the maximum flow if capacities are integers. Exercise: It is also correct if capacities are rationals. Does Ford-Fulkerson always terminate? In case of irrational capacities, not necessarily! (Exercise) But we can t give irrational capacities as inputs to digital computers anyway. In case of floating point capacities, who knows? 11 12 2

Integrality Theorem (26.11) If a flow network has integer valued capacities, there is a maximum flow with an integer value on every edge. The Ford- Fulkerson method will yield such a maximum flow. Reduction: Maximum Matching Max Flow The integrality theorem is often extremely important when programming and modeling using the max flow formalism. What is the maximum cardinality matching in G? 13 14 s t G G All capacities are 1 1 16 Finding a balanced set of Representatives (Ahuja, Application 6.2) A city has clubs C 1, C 2,,C n and parties P 1, P 2,,P m. A citizen may be a member of several clubs but may only be a member of one party. A balanced city council must be formed by including exactly one member from each club and at most u k members from party P k. 17 18 3

Local search checklist Design: How do we find the first feasible solution? ٧ Neighborhood design? ٧ Which neighbor to choose? Analysis: Partial correctness? (termination correctness) Termination? ٧ Complexity? ٧ Complexity of Ford-Fulkerson We have at most f improvement steps (iterations of the while-loop). Is this the best possible bound? 19 20 Complexity We have at most f improvement steps (iterations of the while-loop) and this bound cannot be improved for the general Ford-Fulkerson method. How fast can we implement a single improvement step? 21 Assume V -1 connected. Complexity E. Otherwise the graph is not Then, Ford-Fulkerson can be implemented to run in time at most O( E f ). Is this fast? It is a polynomially bounded function of E and f. Does this make Ford-Fulkerson a polynomial time algorithm? 22 Polynomial time algorithms How to encode max flow instance? Defintion: A polynomial time algorithm is an algorithm than runs in time polynomial in n, where n is the number of bits of the input. How we intend to encode the input influences if we have a polynomial algorithm or not. Usually, some standard encoding is implied. In this course: Polynomial Exponential Fast Slow java MaxFlow?????????? 23 24 4

How to encode max flow instance? Complexity of Ford-Fulkerson With standard (decimal or binary) representation of integers, Ford-Fulkerson is an exponential time algorithm. java MaxFlow 6#0 16 13 0 0 0#0 0 10 12 0 0 #0 4 0 0 14 0#0 0 9 0 0 20 #0 0 0 7 0 4 #0 0 0 0 0 0 2 26 Complexity of Ford-Fulkerson With unary (4 ~ 1111) representation of integers, Ford- Fulkerson is a polynomial time algorithm. Intuition: When the input is longer it is easier to be polynomial time as a function of the input length. java MaxFlow 111111 # 1111111111111111 1111111111111 # 1111111111 111111111111 # 1111 11111111111111 # 111111111 11111111111111111111 An algorithm which is polynomial if integer inputs are represented in unary is called a pseudo-polynomial algorithm. Intuitively, a pseudo-polynomial algorithm is an algorithm which is fast if all numbers in the input are small. # 1111111 1111 # 27 28 Edmonds-Karp Edmonds-Karp algorithm for Max Flow: Implement Ford-Fulkerson by always choosing the shortest possible augmenting path, i.e., the one with fewest possible edges. Complexity of Edmonds-Karp Each iteration of the while loop can still be done in time O( E ). The number of iterations are now at most O( V E ) regardless of capacities to be seen next. Thus, the total running time is O( V E 2 ) and Edmonds-Karp is a polynomial time algorithm for Max Flow. 29 30

Why at most O( V E ) iterations? When executing Edmonds-Karp, the residual network G f gradually changes (as f changes). This sequence of different residual networks G f satisfies: Theorem (~ Lemma 26.8 and Theorem 26.9): 1) The distance between s and t in G f never decreases: After each iteration of the while-loop, it either increases or stays the same. 2) The distance between s and t in G f can stay the same for at most E iterations of the while-loop before increasing. As the distance between s and t can never be more than V -1 and it starts out as at least 1, it follows from the theorem that we have at most ( V -2) E iterations. 31 6