Dinic's algorithm
In optimization theory, the Dinic's algorithm is a strongly polynomial algorithm for computing the maximum flow in a flow network. The algorithm runs in O(V2E) time and is similar to Edmonds-Karp algorithm, which runs in O(VE2) time. Dinic's algorithm runs faster based on the idea of level graph and blocking flow.
Definition
Let G = ((V, E), c, s, t) be a network with c(u,v) and f(u,v) being the flow and the capacity of the edge (u,v) respectively.
- The residual capacity is a mapping cf : V×V→R+ defined as,
- if (u,v)∈E,
- cf (u,v) = c(u,v) - f(u,v)
- cf (v,u) = f(u,v)
- cf (u,v) = 0 otherwise
- if (u,v)∈E,
- The residual graph is the graph Gf = ((V, Ef), cf|Ef, s, t), where
- Ef = {(u,v)∈V×V : cf (u,v) > 0}
- An augmenting path is an s-t path in the residual graph Gf.
- Define dist(v) to be the number of edges in the shortest path from s to t in Gf. Then the level graph of Gf is the graph GL = (V, EL, cf|EL, s, t), where
- EL = {(u,v)∈Ef : dist(v) = dist(u) + 1}
- A blocking flow is an s-t flow f such that the graph G' = (V,EL', s, t) with EL' = {(u,v) : f(u,v) < cf|EL(u,v)} contains no s-t path.
Algorithm
Dinic's Algorithm
- Input: A network G = ((V, E), c, s, t).
- Output: An s-t flow f of maximum value.
- Set f(e) = 0 for each e in E.
- Construct GL from Gf of G. If dist(t) = ∞, stop and output f.
- Find a blocking flow f ' in GL.
- Augment flow f by f ' and go back to step 2.
Analysis
It can be shown that the number of edges in each blocking flow increases by at least 1 each time and thus there are at most n-1 blocking flows in the algorithm, where n is the number of vertices in the network. The level graph GL can be constructed by Breadth-first search in O(E) time and a blocking flow in each level graph can be found in O(VE) time. Hence, the running time of Dinic's algorithm is O(V2E).
Using a data structure called dynamic trees, the running time of finding a blocking flow in each phase can be reduced to O(E log(V)) and therefore the running time of Dinic's algorithm can be improved to O(VE log(V)).
Example
The following is a simulation of the Dinic's algorithm. In the level graph GL, the vertices with labels in red are the values dist(v). The paths in blue form a blocking flow.
History
The Dinic's algorithm was published by E. A. Dinic in 1970, earlier than Edmonds-Karp algorithm, which was published in 1972 but was discovered earlier. They independently showed that in the Ford-Fulkerson method, if each augmenting path is the shortest one, the length of the augmenting paths is non-decreasing.
See Also
References
- Yefim Dinitz (2006). "Dinitz' Algorithm: The Original Version and Even's Version". In Oded Goldreich, Arnold L. Rosenberg, and Alan L. Selman (ed.). Theoretical Computer Science: Essays in Memory of [[Shimon Even]] (PDF). Springer. pp. 218–240. ISBN 978-3540328803.
{{cite book}}
: URL–wikilink conflict (help)CS1 maint: multiple names: editors list (link) - B. H. Korte, Jens Vygen (2008). "8.4 Blocking Flows and Fujishige's Algorithm". Combinatorial Optimization: Theory and Algorithms (Algorithms and Combinatorics, 21). Springer Berlin Heidelberg. pp. 174–176. ISBN 978-3-540-71844-4.