Title: Beyond the flow decomposition barrier
1Beyond the flow decomposition barrier
- Authors A. V. Goldberg and Satish Rao (1997)
Presented by Yana Branzburg Advanced Algorithms
Seminar Instructed by Prof. Haim Kaplan Tel Aviv
University, June 2007
2Introduction
- First studied in Soviet Union by the National
Commissariat of Transportation in early (19)30s
by A.N. Tolstoi - Solution for ship-ping cargo via the
railroad system
10 sources, 68 destinations, 155 links
3Introduction
- Maximum flow problem
- Use the concept of distance
- Distance is defined by arc length
- Methods so far use unit length function
- GoldbergRao use adaptive binary length function
length threshold is set relative to an estimate
of residual flow
4O(mn) barrier
- O(mn) - a natural barrier for maximum flow
algorithms - that output explicit flow decomposition (the
total path length is T(mn) in the worst case) - that augment flow one path at the time, for each
augmenting path, one arc at the time - Although the barrier does not apply to algorithms
that use preflows or data structures like dynamic
trees, no one beats it
5O(mn) barrier (cont.)
6Beyond the O(mn) barrier
- Dinics algorithm for unit-capacity networks
- Goldberg-Rao algorithm for general networks
7Background
- flow network
- G (V, E)
- source s, sink t
- capacity function u E ? 1, , U
- flow function f E ? 1, , U
- f(a) u(a)
- conservation constraint
- flow value is
8Background (cont.)
- residual capacity uf (v,w) u(v,w) f(v,w)
f(w,v) - Arc (v,w) is a residual arc if uf (v,w) gt 0
- residual flow is the difference between optimal
flow f and current flow f - In blocking flow every directed path s-t contains
an arc with residual capacity 0 - Without loss of generality assume
- G has no parallel arcs
- if arc (v,w) is in G, but (w,v) is not, add (w,v)
to G, define u(w,v)0 - either f(v,w) 0 or f(w,v) 0
9Dinics algorithm for unit-capacity networks
10Dinics algorithm for unit capacity networks
- A unit capacity network is one in which all arc
have unit capacities - Algorithm of two phases
- Find augmenting paths, until distance between s
and t is - Augment the found flow to an optimal flow
11Dinics algorithm for unit capacity networks
(cont.)
- Algorithm Dinic
- while ds a (ds stands for length of the
shortest path from s to t) - Find blocking flow in admissible network
- Compute residual network
- while there is an s-t path in the residual
network - Find an s-t path P
- Augment one unit of flow along P
- Compute residual network
12Dinics algorithm for unit capacity networks -
Analysis
- Phase I
- Find a blocking flow
- Find a s-t path
- Route one unit of flow
- Delete all arcs of the path (all saturated)
- Repeat until there is no s-t path
- Each arc is looked only once, hence O(m)
- Thus the first phase total takes O(am)
13Dinics algorithm for unit capacity networks
Analysis (cont.)
- Phase II
- Blocking flow increases the distance between s
and t by at least one - Let the vertices be partitioned into levels
- Thus, at the end of phase I, there are at least a
levels
14Dinics algorithm for unit capacity networks
Analysis (cont.)
- Lemma 1 At the end of phase I, the maximum flow
in the residual network is at most a - Proof. Case 1 a m½
- At least m½ levels and m arcs ? there is a pair
of adjacent levels Vk and Vk1 which have at
most m½ arcs between them - The cut has capacity at
most m½ ? maximum residual flow is m½
15Dinics algorithm for unit capacity networks
Analysis (cont.)
- Proof. Case 2 a 2n ?
- There exists a pair of adjacent levels Vk and
Vk1 , each of which has at most n ? nodes - Assume the contrary at least half levels must
contain more than n ? nodes - Then the total number of nodes more than
- a/2n ? n, which is a contradiction
- Thus the cut has capacity
at most n ? a
16Dinics algorithm for unit capacity networks
Analysis (cont.)
- Each iteration of phase II routes one unit of
additional flow - Since after phase I the maximum flow in the
residual network a, the maximum number of
iterations in phase II is bounded by a - One iteration of phase II is O(m)
- Thus, the second phase takes total O(am)
- Hence, Dinics algorithm for unit capacity
networks solves the maximum flow problem in - time
17Goldberg-Rao algorithm
18Length Functions
- length function l E ?R
- distance labeling d V ?R with respect to a
length function l if - d(t) 0
- for every (v,w) in E d(v) d(w) l(v,w)
- admissible arc (v,w) is a residual arc where
- d(v) gt d(w) or d(v) d(w) and l(v,w) 0
- In case of binary length function, admissible arc
satisfies d(v) d(w) l(v,w) - distance function dl(v) distance from v to t
under l - dl(v) is a distance labeling
19Length Functions (cont.)
- Claim 2 dl is the biggest distance labeling
- Proof (assume the contrary)
- d(v) gtdl(v) for some v
- w is the last node on a shortest v-t path G that
satisfies d(w) gtdl(w) - x follows w (w ?t, hence x exists)
- dl(w) lt d(w) l(w,x) d(x) l(w,x) dl(x)
- v-w concatenated with w-t is shorter than G
- Contradiction to selection of G
20Volume of Network
- A residual arc a has
- width uf(a)
- length l(a)
- volume volf,l(a) uf(a) l(a)
- network volume Volf,l Sauf(a) l(a)
- The residual flow value is upper bounded by
Volf,l /dl(s) (since any path from s to t has
length at least dl(s) gt 0) - To get a tighter bound, keep Volf,l small by
choosing a binary length function that is zero
for large residual capacity arcs
21Binary Blocking Flow Algorithm - Idea
- Ensure the algorithms terminates after not too
many augmentations by showing that every
iteration increases dl(s) - but we have zero
arcs?! - Contract strongly connected components (nodes)
formed by zero-length arcs ? - Bound the augmenting flow in a node by ? to be
able to reroute the flow in a restored node ? - Possible not to find a blocking flow ? can not
guarantee increase of dl(s) ? - Choose ? that insures small number of
non-blocking augmentations
22Confused?!
- Bold edges strongly connected components
- Edges with X are deleted for having a blocking
flow and no more capacity
23Stopping Condition of the Algorithm
- Define F - an upper bound on the residual flow
value - Update F every time our estimate improves
- Stop when F lt 1 (integral capacities)
- Initial estimate is F S(s,w)u(s,w) nU
24The Skeleton of Goldberg-Rao algorithm
- while F 1 do
- Compute ?
- while the residual capacity gt F /2
- Compute length function l, distance function dl
- Find admissible graph A(f, l, dl)
- Contract strongly connected components of A
- Find a flow of value ? or a blocking flow
- Augment the current flow, extend it to original
graph and recompute the residual graph - Update F
phase
update step
25Estimate a residual capacity
- A residual capacity uf(S,T) of an s-t cut can
serve as an upper bound - canonical cut (Sk ,Tk)
- (Sk ,Tk) is an s-t cut
- Initially (S,T) (s ,V \s ) is the current
cut - Find a canonical cut with the smallest residual
capacity - When the capacity of the found cut F /2, update
F to this capacity value
26Estimate a residual capacity (cont.)
- Claim 3 The minimum capacity canonical cut can
be found in O(m) time - Proof
- Every arc may cross at most one canonical cut
(its length at most 1) - For k 1,,dl(s), initialize uf(Sk,Tk) 0
- For every arc (v,w) if dl(v) gt dl(w), increase
uf(Sk,Tk) by uf(v,w), k dl(v) - Find minimum among all uf(Sk,Tk)
- Denote the minimum capacity canonical cut
27Binary length function
- A first estimate of a length function
- this length function will have to be modified
for reasons that will come up during time
analysis - Given l, next we show how to handle the
contraction of zero arcs
28Extending the flow inside contracted components
- Claim 4 Given a flow of value at most ?, we can
correct it to a flow of the same value in the
original graph in O(m) time - Proof (for one component)
- Choose an arbitrary vertex as a root
- Form an in-tree and an out-tree
- in-tree a rooted tree with a path from each node
to the root - out-tree a rooted tree with a path from the root
to each node
29Extending the flow inside contracted components
(cont.)
- Proof (cont.)
- For each vertex compute its flow balance sum of
flow entering minus sum of flow leaving the
vertex - Route the positive balances to the root using the
in-tree - Route the resulting flow excess from the room to
negative balances via out-tree - At most ? flow is routed to and from the root
using one arc, which residual capacity is at
least 2?
30Extending the flow inside contracted components
(cont.)
0.5?
0.5?
0.5?
?
?
?
0.5?
0.75?
0.5?
-0.75 ?
?
0.25?
?
R
-0.25 ?
?
0.25?
31Time bounds
- Reminder choice of ? must insure small number of
non blocking augmentations - Denote
- Let
- Thus, number of non blocking augmentations of
value ? is at most a in each phase - How many blocking augmentations per phase there
are? Need to show that O(a)
32Bound of number of blocking augmentations
- Lemma 5 For a 0-1 length function on the
residual graph - where M is the maximum residual capacity of a
length one arc - Proof
- Every arc crosses at most one of the canonical
cuts, for such an arc, l(a) 1 - Total capacity of length one arcs mM, there are
dl(s) canonical cuts - Thus, minimum capacity canonical cut mM / dl(s)
33Bound of number of blocking augmentations (cont.)
- For dense graphs, the following Lemma gives
better bounds - Lemma 6 For a 0-1 length function on the
residual graph - Proof
- Let
- Since , there are at most
dl(s)/2 values of k where Vk gt 2n /dl(s) - Thus, at least values of k
have Vk 2n /dl(s) - By the pigeonhole principle, there is j such that
- Vj 2n /dl(s) and Vj1 2n /dl(s)
- Since all arcs from Vj1 to Vj have length 1,
Lemma 6 holds
34Bound of number of blocking augmentations (cont.)
- Lemma 7 In every iteration of a blocking flow,
dl(s) increases by at least 1 (prove later) - Lemma 8 There are at most O(a) blocking flow
augmentations in a phase - Proof Case 1 a m½
- Using Lemma 7 after 4m½ blocking flow update
steps dl(s) 4m½ - M 2?. Thus, together with Lemma 5
35Bound of number of blocking augmentations (cont.)
- Proof. Case 2 a n ?
- Using Lemma 7 after 4n ? blocking flow update
steps dl(s) 4n ? - M 2?. Thus, together with Lemma 6
- Conclusion Each phase of the algorithm
terminates in O(a) update steps
36Finding a flow in one update step
- We use GoldbergTarjan algorithm for computing a
blocking flow X in each update step in
O(m?log(n2/m)) time - If X gt ?, return extra flow to s in O(m) time
- Place X ? units of excess at t
- Process vertices in reverse topological order
- For current vertex reduce flow on the incoming
arcs to eliminate its excess
37Time Bounds Summary
- Theorem 9 The maximum flow problem can be solved
in O(a?m?log(n2/m)?logU) time - Proof
- ?gtU all arcs are length one
- Each update step finds a blocking flow and
increases dl(s) by at least one - After a steps dl(s) a ?F aU
- After O(a) steps F a ? aU ? ?U
- Total time till ? U is O(a?m?log(n2/m))
F uf(S,T) mM /dl(s) mM /a aM aU
38Time Bounds Summary (cont.)
- Proof (cont.)
- 1?U Number of phases is O(logU), since each
phase decreases twice - Total time for these phases is O(a?m?log(n2/m)?log
U) - When ?1, F a, the algorithm ends in O(a) update
steps
39Proof of Lemma 7
- In every iteration of a blocking flow, dl(s)
increases by at least 1 - Denote
- l and dl - initial length and distance functions
- l and dl - after finding a blocking flow and
recomputing the residual graph - f and f - the flows before and after
augmentation respectively - Need to prove dl(s) lt dl (s)
40Proof of Lemma 7 (cont.)
- Claim 10 dl is a distance labeling with respect
to l - Proof
- By definition dl(v) dl(w) l(v,w)
- Need to show dl(v) dl(w) l(v,w)
- If dl(v) dl(w) trivial
- dl(v) gtdl(w) ?(w,v) is not admissible (for
admissible arc dl(w)dl(v)l(w,v)) - ? uf (v,w) uf(v,w)
- ? l(v,w) l(v,w)
41Proof of Lemma 7 (cont.)
- Claim 11 dl(s) dl (s)
- Proof
- By Claim 2 for any distance labeling d, d(v)
dl(v) - By Claim 10 dl is a distance labeling with
respect to l - ? dl(s) dl (s)
42Proof of Lemma 7 (cont.)
- We need to show dl(s) lt dl (s)
- Let G be an s-t path in Gf
- By Claim 10
- cost(v,w) dl(w) -dl(v) l(v,w) 0
- l (G) dl(s) dl(v1) c(s,v1)
- dl(v1) dl(v2) c(v1,v2)
- dl(vk) dl(t) c(vk,t)
- dl(s) dl(t) c (G) dl(s) c (G)
43Proof of Lemma 7 (cont.)
- dl (s) l (G) dl(s) c (G)
- Enough to show that along every s-t path G in Gf
there is an arc (v,w) satisfying c(v,w) gt 0
44Proof of Lemma 7 (cont.)
- dl(v) gtdl(w)
- dl(v) dl(w) l(v,w)
- lt dl(v) l(v,w) ?
- l(v,w) gt 0 ?
- dl(v) dl(w) l(v,w)
- We routed a blocking flow ? G contains arc (v,w)
that is not in A(f, l, dl) - dl(v) dl(w) either because
- (v,w) in Gf (otherwise (v,w) would be in A(f,
l, dl)) or - (v,w) not in Gf but in Gf (means that (w,v) is
in A(f, l, dl) ?dl(w) dl(v) l(v,w) ? dl(w)
dl(v))
45Proof of Lemma 7 (cont.)
- Assume the contrary that
- c(v,w) dl(w) -dl(v) l(v,w) 0
- dl(v) dl(w) ? dl(w) dl(v) and l(v,w) 0
- Case 1 - (v,w) in Gf
- 1l(v,w) gtl(v,w) 0?(w,v) is in A(f, l, dl)
- Case 2 - (v,w) not in Gf but in Gf
- (w,v) is in A(f, l, dl)
- But dl(w) dl(v) ?l (w,v) 0
46Bad Example
- dl(w) dl(v), l(w,v) 0 and l(v,w) 0
- ? uf(v,w) lt 2?
- uf(w,v) gt 2?
- uf (v,w) uf(v,w) 2? uf(v,w) 2?
- l(v,w) 0
w
v
2?- uf(v,w)
47Solution to bad example
- Distort the length function, so that such bad
arcs get length zero ahead - Might become an inner arc in a strongly connected
component - The capacity of such arcs must be at least 2? in
order to be able to route a flow of ? in flow
extension (remember example)
48A correct length function l
- Changes due to new l in Lemma 8 (p. 32)
- Case 1 - 6m½ blocking flow update steps instead
of 4m½ - Case 2 - 5n ? blocking flow update steps instead
of 4n ?
49Length function l
- (v,w) is a special arc if
- 2? uf(v,w) lt 3?
- d(v) d(w)
- uf(w,v) 3?
- Define new length function l that
- zero on special arcs
- l on all other arcs
- dl dl
- The algorithm determines admissible graph A(f,
l, dl) instead of A(f, l, dl)
50Proof of Lemma 7 using l
- dl(w) dl(v), l(w,v) 0 and l(v,w) 0
- l(w,v) 0 ? uf(w,v) 3?
- l(v,w) 0 ? uf (v,w) 3?
- (w,v) is in A(f, l, dl) ? pushing a flow (at
most ?) increased uf (v,w) - ? uf(v,w) 2?
- ? Either (v,w) is a special arc before
augmentation or uf(v,w) 3? - ? (v,w) is in A(f, l, dl) - contradiction
51Example
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
- n 6, m 10
- U 20
- F 29
- a minm½, n ? 4
- ? F /a 8
52Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 29. ? 8
53Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 29. ? 8 (S,T) 15
54Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 29. ? 8
1
8/8
2
1
Af
1
8/12
8/16
1
0
3
0/7
0/4
1
1
1
3
2
0/10
55Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 29. ? 8 (S,T) 7 ? F 7, ? 2
56Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 7. ? 2
57Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 7. ? 2 (S,T) 5
58Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 7. ? 2
59Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
0
F 7. ? 2 (S,T) 3 ? F 3, ? 1
60Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 3. ? 1
8
61Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 3. ? 1 (S,T) 2
62Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 3. ? 1
63Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 3. ? 1 (S,T) 1 ? F 1, ? 1
64Example (cont.)
while F 1 do Compute ?, l, dl while
(S,T) gt F /2 Compute l Find
A(f, l, dl) Contract SCC of A
Find a flow f f f f Extend
f to G Recompute l,dl,Gf Update F
F 1. ? 1
65Example (cont.)
66Concluding Remarks
- These results can be extended to a wide class of
length functions (not binary) to obtain same time
bounds - Open issues
- Can the flow decomposition bound be improved upon
by a strongly polynomial algorithm? For example,
O(am(logn)O(1)) - Can these results be extended to obtain better
bounds for the minimum-cost flow problem?
67Appendix
68Computing dl in linear time
- We use Dials algorithm (1969)
- Init
- Compute GT
- Mark t as reached but not scanned, Distt0
- Mark rest of the nodes as not reached,
DistvINF, v ?t - Step 1
- Choose a reached but not scanned node v with
minimal Dist - If no such node compute G back and FINISH, else
go to Step 2
69Dials algorithm (cont.)
- Step 2
- For each (v,w)
- if Dist(w ) gt Dist(v ) l(v,w), then
- Mark w as reached but not scanned
- Dist(w ) Dist(v ) l(v,w)
- Add (v,w) to the output
- Remove all arcs (u,w) from the output, u ? w
- Mark v as reached and scanned
- Go to Step 1
70Dials algorithm Example
1
node status Dist
t RnS 0
s nR INF
a nR INF
b nR INF
c nR INF
d nR INF
G
0
0
1
0
1
0
1
1
0
GT
1
71Dials algorithm Example (cont.)
node status Dist
t RnS 0
s nR INF
a nR INF
b nR INF
c nR INF
d nR INF
1
Dist(b) gt Dist(t) l(t,b)
0
RnS
distance nodes
0
1
b
72Dials algorithm Example (cont.)
node status Dist
t RnS 0
s nR INF
a nR INF
b RnS 0
c nR INF
d nR INF
RS
1
Dist(d) gt Dist(t) l(t,d)
distance nodes
0 b
1
1
RnS
d
73Dials algorithm Example (cont.)
node status Dist
t RS 0
s nR INF
a nR INF
b RnS 0
c nR INF
d RnS 1
RnS
1
Dist(a) gt Dist(b) l(b,a)
distance nodes
0 b
1 d
a
74Dials algorithm Example (cont.)
node status Dist
t RS 0
s nR INF
a RnS 1
b RnS 0
c nR INF
d RnS 1
Dist(d) gt Dist(b) l(b,d)
RS
distance nodes
0
1 d a
d
0
75Dials algorithm Example (cont.)
node status Dist
t RS 0
s nR INF
a RnS 1
b RS 0
c nR INF
d RnS 0
Dist(c) gt Dist(d) l(d,c)
distance nodes
0 d
1 a
0
RnS
c
RS
76Dials algorithm Example (cont.)
node status Dist
t RS 0
s nR INF
a RnS 1
b RS 0
c RnS 0
d RS 0
1
RnS
Dist(s) gt Dist(c) l(c,s)
distance nodes
0 c
1 a
s
77Dials algorithm Example (cont.)
node status Dist
t RS 0
s RnS 1
a RnS 1
b RS 0
c RnS 0
d RS 0
0
Dist(a) gt Dist(c) l(c,a)
distance nodes
0
1 a s
RS
a
78Dials algorithm Example (cont.)
node status Dist
t RS 0
s RnS 1
a RnS 0
b RS 0
c RS 0
d RS 0
0
RS
Dist(s) gt Dist(a) l(a,s)
distance nodes
0 a
1 s
s
79Dials algorithm Example (cont.)
node status Dist
t RS 0
s RnS 0
a RS 0
b RS 0
c RS 0
d RS 0
RS
Dist(s) gt Dist(a) l(a,s)
distance nodes
0 s
1
80Dials algorithm Example (cont.)
Final result
node status Dist
t RS 0
s RS 0
a RS 0
b RS 0
c RS 0
d RS 0
81Dials algorithm Running Time
- Build GT O(nm)
- Each arc is examined once O(m)
- By keeping bins for possible distances, perform
Step 1 in linear time O(nU) - Total O(m nU)
82References
- Beyond the Flow Decomposition Barrier, A.V.
Goldberg, Satish Rao - A Brief History Of Max-Flow, R. Khandekar,
K.Talwar - The maximum flow problem, I. Hudson
- Shortest-path forest with topological ordering,
R.B. Dial