Max flows in O(nm) time, and sometimes less. by James B. Orlin MIT Sloan School.

Slides:



Advertisements
Similar presentations
Maximum Flow and Minimum Cut Problems In this handout: Duality theory Upper bounds for maximum flow value Minimum Cut Problem Relationship between Maximum.
Advertisements

Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
Introduction to Algorithms
15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Max Flows 2: The Excess Scaling Algorithm and Variants. James Orlin.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 7 Maximum Flows: Polynomial Algorithms
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
HW2 Solutions. Problem 1 Construct a bipartite graph where, every family represents a vertex in one partition, and table represents a vertex in another.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
The max flow problem
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
15.082J, 6.855J, and ESD.78J September 21, 2010 Eulerian Walks Flow Decomposition and Transformations.
Advanced Algorithms Piyush Kumar (Lecture 4: MaxFlow MinCut Applications) Welcome to COT5405.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Minimum Cost Flows. 2 The Minimum Cost Flow Problem u ij = capacity of arc (i,j). c ij = unit cost of shipping flow from node i to node j on (i,j). x.
Advanced Algorithms Piyush Kumar (Lecture 5: Preflow Push) Welcome to COT5405.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
15.082J and 6.855J and ESD.78J October 19, 2010 Max Flows 3 Preflow-Push Algorithms.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem Thanks to Jim Orlin & MIT OCW.
Chapter 7 April 28 Network Flow.
15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
Chapter 8 Maximum Flows: Additional Topics All-Pairs Minimum Value Cut Problem  Given an undirected network G, find minimum value cut for all.
15.082J and 6.855J and ESD.78J The Successive Shortest Path Algorithm and the Capacity Scaling Algorithm for the Minimum Cost Flow Problem.
and 6.855J March 6, 2003 Maximum Flows 2. 2 Network Reliability u Communication Network u What is the maximum number of arc disjoint paths from.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
15.082J & 6.855J & ESD.78J September 30, 2010 The Label Correcting Algorithm.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
EMIS 8374 The Ford-Fulkerson Algorithm (aka the labeling algorithm) Updated 4 March 2008.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
Approximation Algorithms Duality My T. UF.
15.082J and 6.855J and ESD.78J October 21, 2010 Max Flows 4.
1 Maximum Flows CONTENTS Introduction to Maximum Flows (Section 6.1) Introduction to Minimum Cuts (Section 6.1) Applications of Maximum Flows (Section.
Minimum Cost Flow Algorithms and Networks. Algorithms and Networks: Minimum Cost Flow2 This lecture The minimum cost flow problem: statement and applications.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Algorithms and Networks Hans Bodlaender
Algorithms and Networks
James B. Orlin Presented by Tal Kaminker
Network Flow 2016/04/12.
Edmonds-Karp Algorithm
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Introduction to Maximum Flows
Richard Anderson Lecture 21 Network Flow
Problem Solving 4.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
and 6.855J March 6, 2003 Maximum Flows 2
Algorithms and Networks
Max Flow / Min Cut.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Lecture 21 Network Flow, Part 1
The Successive Shortest Path Algorithm
Max Flows 3 Preflow-Push Algorithms
Class 11 Max Flows Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow.
Presentation transcript:

Max flows in O(nm) time, and sometimes less. by James B. Orlin MIT Sloan School

2 The Maximum Flow Problem Directed Graph G = (N, A). – Source s – Sink t – Capacities u ij on arc (i,j). Let U = max {u sj : j ∈ N}. – Maximize the flow out of s, subject to – Flow out of i = Flow into i, for i ≠ s or t. A Network with Arc Capacities s 1 t A maximum Flow s 1 t 2 3/4 1/1 2/2 2/3 1/1

Max-Flow Min-Cut An s-t cut is a partition of the node set into two parts S and T, with s ∈ S and t ∈ T. The capacity of a cut with respect to capacity vector u is 3 A max flow and minimum cut s 1 t 2 3/4 1/1 2/2 2/3 1/1 Max-Flow Min-Cut (1956) The maximum flow value is the minimum capacity of an s-t cut.

Running times for max flow algorithms O(nm 2 )Edmonds and Karp (1972) O(n 2 m)Dinic (1970) O(n 3 )Karzanov (1974) Malhotra, Kumar & Maheshwari (1977) O(n 2 m ½ )Cherkasky (1977) O(nm log 2 n)Galil and Naaman (1980) O(nm log n)Sleator and Tarjan (1983) O(nm log n 2 /m)Goldberg and Tarjan (1988) 4

More Improvements in running time O(nm+ n 2+ε )King Rao and Tarjan (1992) O(nm log α n )King Rao and Tarjan (1994) α = m/(n log n) O(n 3 / log n )Cheriyan, Hagerup, and Mehlhorn (1996) O(nm)O. (2012) O(nm / log n)O. (2012) if m = O(n) and under some other conditions. Remark 1: The max flow problem is solvable in O(nm / log n) steps when m = Ω(n 2 ) and when m = O(n). 5

Weakly polynomial running times O(nm log U)Gabow (1985) O(nm + n 2 log U)Ahuja and Orlin (1989) O(nm + n 2 log ½ U)Ahuja, Orlin, and Tarjan (1989) O(m 3/2 log n log U) Goldberg and Rao (1998) O(n 2/3 m log(n 2 /m) log U)Goldberg and Rao (1998) O(n 2/3 m log U)O. (2012) Further improvements if log U max /U min = O(n 1/3- ε ) 6

On Network Flow Algorithms All are improvement algorithms, they start with a non-optimal solution and find an improved solution. 7 Augmenting Path Algorithms: intermediate solutions are feasible flows improvements are made by sending flow along a path Preflow-Push Algorithms intermediate solutions can violate flow conservation “improvements” are made by sending flow along a single edge

The Goldberg-Rao Δ-scaling phase as a black box assume that m < n 1.06 run O( log n) scaling phases of the original GR algorithm Δ-scaling phase INPUT: A flow x and an s-t cut (S, T). Δ = u(S, T) – v(x) Δ is an upper bound on how much more flow can be sent. OUTPUT: A flow x’ and an s-t cut (S’, T’) such that u(S’, T’) – v(x’) ≤ Δ/n. RUNNING TIME: O(m 3/2 log 2 n). Leads to an (O(m 3/2 log n log U) time algorithm for max flows. 8

9 The Residual Network s 1 2 t 8/10 7/8 1/1 6/10 5/6 s 1 2 t ij x /u ij ij u - x x ij We let r ij denote the residual capacity of arc (i,j) The Residual Network G(x)

10 We will ignore arcs directed into s or out of t s 1 2 t 8/10 7/8 1/1 6/10 5/6 s 1 2 t The Residual Network G(x)

Δ-abundant arcs and paths An arc (i, j) is called Δ-abundant at the Δ scaling phase if r ij ≥ 2Δ. Lemma. If an arc is Δ-abundant at some scaling phase, it is Δ- abundant at all subsequent phases. Proof. The change in flow in any arc (i, j) in the Δ-scaling phase is at most Δ. If x ij ≥ 2Δ at the beginning of the phase, then If x ij ≥ Δ at the end of the phase, and If x ij ≥ nΔ’ at the next phase. 11 We write i ⇒ j if there is a Δ-abundant path from i to j. Otherwise, we write i j We maintain a list of all pairs i, j of nodes such that i ⇒ j. O(nm) time over all iterations Italiano [1986]. Dynamic transitive closure.

Contraction of arcs 12 If arcs (i, j) and (j, i) are both Δ-abundant at the Δ scaling phase, then we will contract arcs (i, j) and (j, i) and expand them at the end of the algorithm. (Contraction is well known.) ≥ 2 Δ At time of contraction, flow into 5 (resp., 6) = flow out 5 (resp., 6). After contraction, the flow into (5, 6) changes by at most Δ over all remaining iterations.

More contraction of arcs 13 If arc (s, j) is Δ-abundant at the Δ scaling phase, then we will contract (s, j). If (j, t) is Δ-abundant, then we will contract (j, t) t s ≥ 2 Δ t s-1 We also can contract Δ abundant cycles.

Compaction of nodes Compaction. New Procedure. Determine nodes that are compactible all arcs incident to compactible nodes are Δ-abundant. Compactible nodes are eliminated. There is an arc (i, j) in the compacted graph if there is an abundant path from i to j in the original graph ≥ 2 Δ Before compaction After compaction

Small, medium, and abundant arcs 15 We say that arc (i, j) is Δ-small if r ij ≤ Δ/2n 3 We say that arc (i, j) is Δ-medium if Δ/2n 3 < r ij ≤ 2Δ We say that arc (i, j) is Δ-abundant if r ij > 2Δ s t 6 7 We partition the arcs of the contracted graph into three groups. From here on, we ignore the Δ-small arcs.

Δ-Critical Arcs and Nodes 16 We say that arc (i,j) is critical if it is Δ–medium and j i. We say that node i is critical if is incident to a critical arc s t 6 7 critical node critical arc medium non-critical arc Each arc is critical for O(1) scaling phases.

Δ-Fertile and Δ-Compactible Nodes 17 fertile node We say that a non-critical node i is Δ-compactible if Let MNC be the set of medium non-critical arcs. We say that a non-critical node i is Δ-Fertile if s t compactible node

The compacted network. Eliminate all Δ-compactible nodes. The nodes of the compacted network are N* = Δ-critical and Δ-fertile nodes. If i, j ∈ N* and if i ⇒ j, then there is a Δ-abundant arc in A*. Use flow decomposition for other arcs in MNC s t s t

s t s t Lemma 1. Any flow in G* of value v* > Δ/2 can be transformed into a flow in G with value at least v* (1 – α). Let α = 1 – 1/(4n) G = network before compaction. G* = compacted network. Lemma 2. Any s-t cut (S*, T*) in G* with capacity C < Δ/2 can be transformed into an s-t cut (S, T) in G with capacity < C(1 + α).

On the number of nodes in compacted networks s t Lemma 3. Each arc with finite capacity is critical for O(1) scaling phases. Corollary. The number of critical nodes is O(m’) over all phases. Lemma 4. Each fertile node is contracted within O(1) scaling phases. The number of fertile nodes in all scaling phases is O(n). It is invariant if MNC does not change. After O(1) scaling iterations the left hand side exceeds 4mΔ and so one of the arcs (i, j) must be abundant, and would be contracted. Proof. Consider the LHS of

On solving flows on compacted networks. 21 Let G* = (N*, A*) be the compacted network, with c = |N*|. Thus |A*| < c 2. If c > m 9/16, we will solve the approximate max flow problem on G in O(m 3/2 log 2 n) time. If c ≤ m 9/16, we will solve the approximate max flow problem on G in O(c 8/3 log n) time. Time to create all compacted networks is O(nm). Total number of nodes in compacted networks is O(n + m’)

22 Range of cRunning time per scaling phase Running time/c c > m 9/16 O(m 3/2 log 2 n)O(m 15/16 log 2 n) c ≤ m 9/16 O(c 8/3 log n)O(m 15/16 log 2 n) Running time for the max flow problem Time for flows in all phases: O(m 15/16 m’ log 2 n). For ε < 1/16 and for m’ < n 1+ε, time is O(nm). Time to create the networks. O(nm). (See note below) Total running time. O(nm). Running time for the max flow problem Time for flows in all phases: O(m 15/16 m’ log 2 n). For ε < 1/16 and for m’ < n 1+ε, time is O(nm). Time to create the networks. O(nm). (See note below) Total running time. O(nm). A special approach is needed if c is smaller than n ε.

23 Time for solving the flow problems Time for flows: O(m 15/16 m’ log 2 n ) = O(n m 15/16 log 2 n). Time for creating the compacted networks can be sped up to O(nm/log n). Total running time is O(nm / log n). If m = O(n), the running time is O(n 2 / log n) Time for solving the flow problems Time for flows: O(m 15/16 m’ log 2 n ) = O(n m 15/16 log 2 n). Time for creating the compacted networks can be sped up to O(nm/log n). Total running time is O(nm / log n). If m = O(n), the running time is O(n 2 / log n) When m’ = O(n), running time is O(nm / log n) That is, the number of arcs with finite capacity is O(n).

On speeding up the creation of G* 24 Time for creating a compacted network G* = (N*, A*) with |N*| = c. Time for determining all abundant paths between nodes of N* O(c m) time using search algorithms O(c m / log n) time using “bit packing” Time for creating all of the compacted networks O(nm/log n). Time for uncompacting the networks O(nm/log n) A number of technical details. Time for creating a compacted network G* = (N*, A*) with |N*| = c. Time for determining all abundant paths between nodes of N* O(c m) time using search algorithms O(c m / log n) time using “bit packing” Time for creating all of the compacted networks O(nm/log n). Time for uncompacting the networks O(nm/log n) A number of technical details.

Further improvements if U max /U min is “small”. 25 U max = max {u ij : u ij 0} After 2K phases, there are no small or medium capacity arcs. Running time for flow subroutines: O(nm 15/16 ). Running time for creating compacted networks: O(nm/log n) How large can K be so that the running time is O(nm/log n)? If m is large, can one speed up the time to create compacted network.

How large can K be? 26 Suppose that m = n γ. The running time for the first 2K phases is less O(nm/log n) if 1.m < n 4/3 and K < n 2– γ/2 – ε or 2.m ≥ n 4/3 and K < n 1/3 – ε.

A speedup if U max /U min is small and m is large. 27 Suppose that m ≥ n 4/3 and K < n 1/3 – ε. Running time for first 2K phases is O(n 1-ε/2 m). One can use fast matrix multiplication for computing the arcs of the compacted graph. O(n ) Coppersmith and Winograd [1990] O(n ) Williams [2011] Let ω =

Running times if U max /U min is small 28 Range of c time for flowstime for fast transitive closureRunning time/c c > n ω/3 ≈ n.7909 O(n 2/3 m log n)--O(m log n /n w/3 -2/3 ) = O(m / n.1242 ) c = n ω/3 ≈ n.7909 O(c 3 )O(n ω )O(n 2ω/3 ) = O(n ) Running time = O(max {nm/ n.1242, n } )

29 Relies on contraction and compaction prior to using GR If log (U max /U min ) < n 1/3- ε, then Improvement in strongly polynomial time max flows