Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Max flows in O(nm) time, and sometimes less. by James B. Orlin MIT Sloan School."— Presentation transcript:

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

2 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 2 4 1 2 3 1 A maximum Flow s 1 t 2 3/4 1/1 2/2 2/3 1/1

3 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.

4 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

5 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

6 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

7 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

8 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 9 The Residual Network s 1 2 t 8/10 7/8 1/1 6/10 5/6 s 1 2 t 2 1 1 4 1 8 5 6 7 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 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 2 1 1 4 1 8 5 6 7 The Residual Network G(x)

11 Δ-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.

12 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.) 1 2 3 4 5 6 ≥ 2 Δ 1 2 3 4 5 5-6 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.

13 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). 12 3 4 t s ≥ 2 Δ 1 2 3 4 3-t s-1 We also can contract Δ abundant cycles.

14 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. 14 1 2 3 4 6 5 ≥ 2 Δ Before compaction 12 3 4 After compaction

15 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Δ 5 1 2 3 4 s t 6 7 We partition the arcs of the contracted graph into three groups. From here on, we ignore the Δ-small arcs.

16 Δ-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. 5 1 2 3 4 s t 6 7 critical node critical arc medium non-critical arc Each arc is critical for O(1) scaling phases.

17 Δ-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 5 1 2 3 4 s t 6 7 3 5 4 2 2 compactible node

18 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. 18 5 1 2 3 4 s t 6 7 3 5 4 2 2 5 1 2 3 s t 7 3 4 2

19 19 5 1 2 3 4 s t 6 7 3 5 4 2 2 5 1 2 3 s t 7 3 4 2 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 + α).

20 On the number of nodes in compacted networks 20 5 1 2 3 s t 7 3 4 2 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

21 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 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 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).

24 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.

25 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.

26 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 – ε.

27 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 2.376 ) Coppersmith and Winograd [1990] O(n 2.3727 ) Williams [2011] Let ω = 2.3727

28 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 1.5818 ) Running time = O(max {nm/ n.1242, n 2.5818 } )

29 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


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

Similar presentations


Ads by Google