Assumption: Every edge capacity \(c(e)\) is an integer in \([1,C]\)
Integrality invariant: Throughout Ford-Fulkerson, every edge flow \(f(e)\) and residual capacity \(c_f(e)\) is an integer
Pf: By induction on the number of augmenting paths \(\quad\qed\)
Theorem: Ford-Fulkerson terminates after at most \(\mathit{val}(f^*) \leq nC\) augmenting paths, where \(f^*\) is a max flow (consider cut \(A = \{s\}\); assumes no parallel edges)
Pf: Each augmentation increases value of flow by at least \(1\) \(\qed\)
Corollary: The running time of Ford-Fulkerson is \(O(mnC)\)
Pf: Can use either BFS or DFS to find an augmenting path in \(O(m)\) time \(\qed\)
Assumption: Every edge capacity \(c(e)\) is an integer in \([1,C]\)
Integrality theorem: There exists an integral max flow \(f^*\) (\(f(e)\) is an integer for every \(e\))
Pf: Since Ford-Fulkerson terminates, theorem follows from integrality invariant (and augmenting path theorem) \(\quad\qed\)
Q: Is generic Ford-Fulkerson algorithm poly-time in input size (\(m\), \(n\), and \(\log C\))?
A: No. If max capacity is \(C\), then algorithm can take \(\geq C\) iterations
each augmenting path sends only 1 unit of flow (number of augmenting paths is \(2C\))
Bad news: Number of augmenting paths can be exponential in input size
The Ford-Fulkerson algorithm is guaranteed to terminate if the edge capacities are ...
Use care when selecting augmenting paths
Pathology: When edge capacities can be irrational, no guarantee that Ford-Fulkerson terminates (or converges to a maximum flow)!
Intuition: Let \(r > 0\) satisfy \(r^2 = 1 - r\)
\[\begin{eqnarray} r = \frac{\sqrt{5} - 1}{2} & \quad\Rightarrow\quad & r^2 = 1 - r \\ r \approx 0.618 & \quad\Rightarrow\quad & r^4 < r^3 < r^2 < r < 1 \end{eqnarray}\]
flow after augmenting path:
Theorem: the Ford-Fulkerson algorithm may not terminate; moreover, it may converge to a value not equal to the value of the maximum flow
Pf:
Use care when selecting augmenting paths
Pathology: When edge capacities can be irrational, no guarantee that Ford-Fulkerson terminates (or converges to a maximum flow)!
Goal: Choose augmenting paths so that
Choosing augmenting paths with
Dinitz invented algorithm in response to a pre-class exercise by Adelson-Velsky
Overview: Choosing augmenting paths with "large" (though not necessarily largest) bottleneck capacity
Capacity-Scaling(G) Foreach edge e in E: f(e) <- 0 Delta <- largest power of 2 <= C While(Delta >= 1) // body of this loop is Delta-scaling phase Gf(Delta) <- Delta-residual network of G with respect to flow f While(there exists an s-t path P in Gf(Delta)) f <- Augment(f, c, P) Update Gf(Delta) Delta <- Delta / 2 Return f
Assumption: All edge capacities are integers between \(1\) and \(C\)
Invariant: The scaling parameter \(\Delta\) is a power of 2
Pf: Initially a power of 2; each phase divides \(\Delta\) by exactly 2 \(\qed\)
Integrality invariant: Throughout the algorithm, every edge flow \(f(e)\) and residual capacity \(c_f(e)\) is an integer.
Pf: Same as for generic Ford-Fulkerson \(\qed\)
Assumption: All edge capacities are integers between \(1\) and \(C\)
Theorem: If capacity-scaling algorithm terminates, then \(f\) is a max flow
Pf:
Lemma 1: There are \(1 + \lfloor\log_2 C\rfloor\) scaling phases
Lemma 2: Let \(f\) be the flow at the end of a \(\Delta\)-scaling phase. Then, the max-flow value \(\leq \mathit{val}(f) + m\Delta\)
Lemma 3: There are \(\leq 2m\) augmentations per scaling phase
Lemma 1: There are \(1 + \lfloor\log_2 C\rfloor\) scaling phases
Pf: Initially \(C / 2 < \Delta \leq C\); \(\Delta\) decreases by a factor of \(2\) in each iteration \(\qed\)
Lemma 2: Let \(f\) be the flow at the end of a \(\Delta\)-scaling phase. Then, the max-flow value \(\leq \mathit{val}(f) + m\Delta\)
Pf:
Lemma 3: There are \(\leq 2m\) augmentations per scaling phase
Pf:
Lemma 1: There are \(1 + \lfloor\log_2 C\rfloor\) scaling phases
Lemma 2: Let \(f\) be the flow at the end of a \(\Delta\)-scaling phase. Then, the max-flow value \(\leq \mathit{val}(f) + m\Delta\)
Lemma 3: There are \(\leq 2m\) augmentations per scaling phase
Theorem: the capacity-scaling algorithm takes \(O(m^2 \log C)\) time
Pf:
Q: How to choose next augmenting path in Ford-Fulkerson?
A: Pick one that uses the fewest edges (can find via BFS)
Shortest-Augmenting-Path(G) Foreach e in E: f(e) <- 0 Gf <- residual network of G with respect to flow f While(there exists an s-t path P in Gf) P <- Breadth-First-Search(Gf) f <- Augment(f, c, P) Update Gf Return f
Lemma 1: The length (number of edges) of a shortest augmenting path never decreases. (Pf later)
Lemma 2: After at most \(m\) shortest-path augmentations, the length of a shortest augmenting path strictly increases (Pf later)
Theorem: The shortest-augmenting-path algorithm take \(O(m^2n)\) time
Pf:
Defn: Given a digraph \(G = (V,E)\) with source \(s\), its level graph is defined by:
Which edges are in the level graph of the following digraph?
Defn: Given a digraph \(G = (V,E)\) with source \(s\), its level graph is defined by:
Key property: \(P\) is a shortest \(s \leadsto v\) path in \(G\) iff \(P\) is an \(s \leadsto v\) path in \(L_G\)
Lemma 1: The length (number of edges) of a shortest augmenting path never decreases
Pf:
Lemma 2: After at most \(m\) shortest-path augmentations, the length of a shortest augmenting path strictly increases
Pf:
Lemma 1: The length (number of edges) of a shortest augmenting path never decreases. (Pf later)
Lemma 2: After at most \(m\) shortest-path augmentations, the length of a shortest augmenting path strictly increases (Pf later)
Theorem: The shortest-augmenting-path algorithm take \(O(m^2n)\) time
Note: \(\Theta(mn)\) augmentations necessary for some flow networks
Start by constructing level graph \(L_G\) of original graph \(G\)
Two phases of augmentations
Normal Augmentation Phase:
Special Augmentation Phase:
Phase of normal augmentations (within a phase, length of shortest augmenting path does not change)
Dinitz(G) Foreach e in E: f(e) <- 0 Gf <- residual network of G with respect to flow f Initialize(Gf) Initialize(Gf) LG <- level-graph of Gf // residual network, not G! If(t not reached) // found max-flow Stop P <- empty set Goto Advance(s) // assuming LG,P,s,t,Gf,f are accessible in following functions Advance(v) If(v=t) Augment(P) Update Gf Remove saturated edges from LG P <- empty set Goto Advance(s) If(there exists edge (v,w) in LG) Add edge (v,w) to P Goto Advance(w) Else Goto Retreat(v) Retreat(v) If(v=s) // switch to special phase Goto Initialize(Gf) Else Delete v (and all incident edges) from LG Remove last edge (u,v) from P Goto Advance(u)
How to compute the level graph \(L_G\) efficiently?
Lemma: A phase can be implemented to run in \(O(mn)\) time
Pf:
Lemma: A phase can be implemented to run in \(O(mn)\) time
Theorem: Dinitz' algorithm runs in \(O(mn^2)\) time
Pf:
year | method | # augmentations | running time | |
---|---|---|---|---|
1955 | augmenting path | \(nC\) | \(O(mnC)\) | |
1972 | fattest path | \(m \log(mC)\) | \(O(m^2\log n \log(mC))\) | \(*\) |
1972 | capacity scaling | \(m \log C\) | \(O(m^2 \log C)\) | \(*\) |
1985 | improved capacity scaling | \(m \log C\) | \(O(mn \log C)\) | \(*\) |
1970 | shortest augmenting path | \(mn\) | \(O(m^2n)\) | \(\dagger\) |
1970 | level graph | \(mn\) | \(O(mn^2)\) | \(\dagger\) |
1983 | dynamic trees | \(mn\) | \(O(mn\log n)\) | \(\dagger\) |
\(m\) edges, \(n\) nodes, integer capacites in \([1,C]\)
\(*\): fat paths; \(\dagger\): shortest paths
year | method | worst case | discovered by |
---|---|---|---|
1951 | simplex | \(O(mn^2C)\) | Dantzig |
1955 | augmenting paths | \(O(mnC)\) | Ford-Fulkerson |
1970 | shortest augmenting paths | \(O(mn^2)\) | Edmonds-Karp, Dinitz |
1974 | blocking flows | \(O(n^3)\) | Karzanov |
1983 | dynamic trees | \(O(mn\log n)\) | Sleator-Tarjan |
1985 | improved capacity scaling | \(O(mn\log C)\) | Gabow |
1988 | push-relabel | \(O(mn\log(n^2/m))\) | Goldberg-Tarjan |
1998 | binary blocking flows | \(O(m^a\log(n^2/m)\log C)\) | Goldberg-Rao |
2013 | compact networks | \(O(mn)\) | Orlin |
2014 | interior-point methods | \(\tilde O (mm^b\log C)\) | Lee-Sidford |
2016 | electrical flows | \(\tilde O (m^c C^d)\) | Mądry |
20xx | ??? | ??? | ??? |
\(m\) edges, \(n\) nodes, integer capacities in \([1,C]\)
\(a=3/2\), \(b=1/2\), \(c=10/7\), \(d=1/7\)
Push-relabel algorithm (section 7.4) increases flow one edge at a time instead of one augmenting path at a time.
Caveat: Worst-case running time is generally not useful for predicting or comparing max-flow algorithm performance in practice
Best in practice: Push-relabel method with gap relabeling: \(O(m^{3/2})\) in practice
Computer vision: different algorithms work better for some dense problems that arise in applications to computer vision