A New Approach to the Maximum-Flow Problem
description
Transcript of A New Approach to the Maximum-Flow Problem
![Page 1: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/1.jpg)
A New Approach to the Maximum-Flow ProblemAndrew V. Goldberg, Robert E. Tarjan
Presented by Andrew Guillory
![Page 2: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/2.jpg)
Outline
Background Definitions Push-Relabel Algorithm Correctness / Termination Proofs Implementation
![Page 3: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/3.jpg)
Maximum Flow Problem
Classic problem in operations research Many problems reduce to max flow
Maximum cardinality bipartite matching Maximum number of edge disjoint paths Minimum cut (Max-Flow Min-Cut Theorem)
Machine learning applications Structured Prediction, Dual Extragradient and Bregman
Projections (Taskar, Lacoste-Julien, Jordan JMLR 2006) Local Search for Balanced Submodular Clusterings
(Narasimhan, Bilmes, IJCAI 2007)
![Page 4: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/4.jpg)
Relation to Optimization
Special case of submodular function minimization
Special case of linear programming Integer edge capacities permit integer
maximum flows (constructive proof)
![Page 5: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/5.jpg)
History of Algorithms
Augmenting Paths based algorithmsFord-Fulkerson (1962) O(mU)Edmonds-Karp (1969) O(nm3)… O(n3) O(nmlog(n)) O(nmlog(U))
Push-Relabel based algorithmsGoldberg (1985) O(n3)Goldberg and Tarjan (1986) O(nmlog(n2/m))Ahuja and Orlin O(nm + n2log(U))
![Page 6: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/6.jpg)
Outline
Background Definitions Push-Relabel Algorithm Correctness / Termination Proofs Implementation
![Page 7: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/7.jpg)
Definitions
Graph G = (V, E) |V| = n |E| = m
G is a flow network if it hassource s and sink tcapacity c(v,w) for each edge (v,w) in Ec(v,w) = 0 for (v,w) not in E
![Page 8: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/8.jpg)
Definitions (continued)
A flow f on G is a real value function on vertex pairs f(v,w) <= c(v,w) for all (v,w) f(v,w) = -f(w,v)∑uf(u,v) = 0 for all v in V - {s,t}
Value of a flow |f| is ∑vf(v,t) Maximum flow is a flow of maximum value
![Page 9: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/9.jpg)
Definitions (continued again)
A preflow f on G is a real value function on vertex pairs f(v,w) <= c(v,w) for all (v,w) f(v,w) = -f(w,v)∑uf(u,v) >= 0 for all v in V - {s}
Flow excess e(v) = ∑uf(u,v) Intuition: flow into a vertex can exceed flow out
![Page 10: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/10.jpg)
Outline
Background Definitions Push-Relabel Algorithm Correctness / Termination Proofs Implementation
![Page 11: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/11.jpg)
Intuition
Starting with a preflow, push excess flow closer towards sink
If excess flow cannot reach sink, push it backwards to source
Eventually, preflow becomes a flow and in fact the maximum flow
![Page 12: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/12.jpg)
Residual Graph
Residual capacity rf(v, w) of a vertex pair is c(v, w) – f(v, w)
If v has positive excess and (v,w) has residual capacity, can push
δ = min(e(v), rf(v, w)) flow from v to w
Edge (v,w) is saturated if rf(v, w) = 0
Residual graph Gf = (V, Ef) where Ef is the set of residual edges (v,w) with rf(v, w) > 0
![Page 13: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/13.jpg)
Labeling
A valid labeling is a function d from vertices to nonnegative integersd(s) = nd(t) = 0d(v) <= d(w) + 1 for every residual edge
If d(v) < n, d(v) is a lower bound on distance to sink
If d(v) >= n, d(v) - n is a lower bound on distance to source
![Page 14: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/14.jpg)
Push Operation
Push(v,w)Precondition: v is active (e(v) > 0) and
rf(v, w) > 0 and d(v) = d(w) + 1
Action: Push δ = min(e(v), rf(v, w)) from v to w
f(v,w) = f(v,w) + δ; f(w,v) = f(w,v) – δ;e(v) = e(v) - δ; e(w) = e(w) + δ;
![Page 15: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/15.jpg)
Relabel Operation
Relabel(v)
Precondition: v is active (e(v) > 0) and
rf(v, w) > 0 implies d(v) <= d(w)
Action: d(v) = min{d(w) + 1 | (v,w) in Ef}
![Page 16: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/16.jpg)
Generic Push-Relabel Algorithm
Starting from an initial preflow
<<loop>>
While there is an active vertex
Chose an active vertex v
Apply Push(v,w) for some w or Relabel(v)
![Page 17: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/17.jpg)
Example
0/30/1
0/2
Flow Network
S T
![Page 18: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/18.jpg)
Example
4
0 0
0
3/30/1
0/2
S T
Initial preflow / labeling
![Page 19: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/19.jpg)
Example
4
0 0
0
3/30/1
0/2
S T
Select an active vertex
![Page 20: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/20.jpg)
Example
4
1 0
0
3/30/1
0/2
Relabel active vertex
S T
![Page 21: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/21.jpg)
Example
4
1 0
0
3/30/1
0/2
Select an active vertex
S T
![Page 22: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/22.jpg)
Example
4
1 0
0
3/31/1
0/2
Push excess from active vertex
S T
![Page 23: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/23.jpg)
Example
4
1 0
0
3/31/1
0/2
Select an active vertex
S T
![Page 24: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/24.jpg)
Example
4
1 1
0
3/31/1
0/2
Relabel active vertex
S T
![Page 25: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/25.jpg)
Example
4
1 1
0
3/31/1
0/2
Select an active vertex
S T
![Page 26: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/26.jpg)
Example
4
1 1
0
3/31/1
1/2
Push excess from active vertex
S T
![Page 27: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/27.jpg)
Example
4
1 1
0
3/31/1
1/2
Select an active vertex
S T
![Page 28: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/28.jpg)
Example
4
5 1
0
3/31/1
1/2
Relabel active vertex
S T
![Page 29: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/29.jpg)
Example
4
5 1
0
3/31/1
1/2
Select an active vertex
S T
![Page 30: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/30.jpg)
Example
4
5 1
0
1/31/1
1/2
Push excess from vertex
S T
![Page 31: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/31.jpg)
Example
4
5 1
0
1/31/1
1/2
Maximum flow
S T
![Page 32: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/32.jpg)
Outline
Background Definitions Push-Relabel Algorithm Correctness / Termination Proofs Implementation
![Page 33: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/33.jpg)
Correctness
Lemma 2.1 If f is a preflow, d is a valid labeling, and v is active, either push or relabel is applicable to v
Lemma 3.1 The algorithm maintains a valid labeling d
Theorem 3.2 A flow is maximum iff there is no path from s to t in Gf (Ford and Fulkerson [7])
![Page 34: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/34.jpg)
Correctness (continued)
Lemma 3.3 If f is a preflow and d is a valid labeling for f, there is no path from s to t in Gf
Proof by contradictionPath s, v0, v1, …, vl, t implies that
d(s) <= d(v0) + 1 <= d(v1) + 2 <= …
<= d(t) + l < nWhich contradicts d(s) = n
![Page 35: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/35.jpg)
Correctness (continued)
Theorem 3.4 If the algorithm terminates with a valid labeling, the preflow is a maximum flow If the algorithm terminates, all vertices have
zero excess (preflow is a flow)By Lemma 3.3 the sink is not reachable from
the sourceBy Theorem 3.2 the flow is maximum
![Page 36: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/36.jpg)
Termination
Lemma 3.5 If f is a preflow and v is an active vertex then the source is reachable from v in Gf
Lemma 3.6 A vertex’s label never decreases
![Page 37: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/37.jpg)
Termination (continued)
Lemma 3.7 At any time the label of any vertex is at most 2n – 1Only active vertex labels are changedActive vertices can reach sPath v, v0, v1, …, vl, s implies that
d(v) <= d(v0) + 1 <= d(v1) + 2 <= …
<= d(s) + l <= n + n - 1
![Page 38: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/38.jpg)
Termination (continued)
Lemma 3.8 There are at most 2n2 labeling operationsOnly the labels corresponding to V-{s,t} may
be relabeledEach of these n – 2 labels can only increaseAt most (2n – 1) (n – 2) relabelings
![Page 39: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/39.jpg)
Termination (continued)
Lemma 3.9 The number of saturating pushes is at most 2nmFor any pair (v,w) d(w) must increase by 2 between
saturating pushes from v to wSimilarly d(v) must increase by 2 between pushes
from w to vd(v) + d(w) >= 1 on the first saturating pushd(v) + d(w) <= 4n - 3 on the lastAt most 2n - 1 saturating pushes per edge
![Page 40: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/40.jpg)
Termination (continued)
Lemma 3.10 The number of nonsaturating pushes is at most 4n2m Φ = ∑v d(v) where v is active
Each nonsaturating push causes Φ to decrease by at least 1 The total increase in Φ from saturating pushes is
(2n – 1) 2nm The total increase in Φ from relabeling is
(2n – 1)(n – 2) Φ is 0 initially and Φ at termination
![Page 41: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/41.jpg)
Termination
Theorem 3.11 The algorithm terminates in O(n2m)
Total time =
# nonsaturating pushes
+ #saturating pushes
+ #relabeling operations
4n2m + 2nm + 2n2 = O(n2m)
![Page 42: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/42.jpg)
Outline
Background Definitions Push-Relabel Algorithm Correctness / Termination Proofs Implementation
![Page 43: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/43.jpg)
Implementation
At each step select an active vertex and apply either Push or Relabel
Problem: Determining which operation to perform and in the case of Push finding a residual edge
Solution: For each vertex maintain a list of edges which touch that vertex and a current edge
![Page 44: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/44.jpg)
Push/Relabel Operation
Push/Relabel(v)
Precondition: v is active
Action:
If Push(v,w) is applicable to current edge (v,w) then Push(v,w)
Else if (v,w) is not the last edge advance current edge
Else reset the current edge and Relabel(v)
![Page 45: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/45.jpg)
Push/Relabel Operation
Lemma 4.1 The push/relabel operation does a relabeling only when relabeling is applicable
Theorem 4.2 The push/relabel implementation runs in O(nm) time plus O(1) time per nonsaturating push operation
![Page 46: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/46.jpg)
O(n3) bound
We can select vertices in arbitrary order Certain vertex selection strategies give
O(n3) boundsFirst-in, first-out method (proved in paper)Maximum distance method (proved here)Wave method
![Page 47: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/47.jpg)
Maximum distance method
At each step, select the active vertex with maximum distance d(v)
Theorem The maximum distance method performs at most 4n3 nonsaturating pushes
Corollary The maximum distance method runs in time O(n3) using the push/relabel implementation
![Page 48: A New Approach to the Maximum-Flow Problem](https://reader034.fdocuments.net/reader034/viewer/2022042516/56813f6c550346895daa41f2/html5/thumbnails/48.jpg)
Proof
Consider D = maxx d(x) where x is active D only increases because of relabeling D increases at most 2n2 times D starts at 0 and ends nonnegative D changes at most 4n2 times There is at most one nonsaturating push
per node per value of D