Jump to content

Dinic's algorithm

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tcshasaposse (talk | contribs) at 04:59, 17 July 2009 (Created page with 'In optimization theory, the '''Dinic's algorithm''' is a strongly polynomial algorithm for computing the maximum flow in a flow network. The algorit...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

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×VR+ defined as,
  1. if (u,v)∈E,
    cf (u,v) = c(u,v) - f(u,v)
    cf (v,u) = f(u,v)
  2. cf (u,v) = 0 otherwise
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.
  1. Set f(e) = 0 for each e in E.
  2. Construct GL from Gf of G. If dist(t) = ∞, stop and output f.
  3. Find a blocking flow f ' in GL.
  4. 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.

G Gf GL
1.

The blocking flow consists of

  1. {s, 1, 3, t} with 4 units of flow,
  2. {s, 1, 4, t} with 6 units of flow, and
  3. {s, 2, 4, t} with 4 units of flow.

Therefore the blocking flow is of 14 units and the value of flow | f | is 14. Note that each augmenting path in the blocking flow has 3 edges.

2.

The blocking flow consists of

  1. {s, 2, 4, 3, t} with 5 units of flow.

Therefore the blocking flow is of 5 units and the value of flow | f | is 14 + 5 = 19. Note that each augmenting path has 4 edges.

3.

Since t cannot be reached in Gf. The algorithm terminates and returns a flow with maximum value of 19. Note that in each blocking flow, the number of edges in the augmenting path increases by at least 1.

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.