Dinic’ Max Flow AlgorithmSlides by Dominik Scheder
Part IDinic’ Algorithm in General Flow Networks
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t
Find out which edges lie on a shortest s-t-path,
2 3
2
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t
Find out which edges lie on a shortest s-t-path,
2 3
2
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t
Find out which edges lie on a shortest s-t-path,
and forget the rest for the time being.
2 3
2
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find out which edges lie on a shortest s-t-path,
and forget the rest for the time being.
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Now lets greedily route as much flow as possiblein this network!
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
Route as much flow through it as possible: 1 unit.
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
Route as much flow through it as possible: 1 unit.
(1)
(1)(1)
(1)
4 2
2 1
1
1 3
33
3
33
2 3 3
s
t
Find an s-t-path with depth-first search.
Route as much flow through it as possible: 1 unit.
(1)
(1)(1)
(1)
Update capacities.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
Route as much flow through it as possible: 1 unit.
Update capacities.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
Route as much flow through it as possible: 1 unit.
Update capacities. Repeat!
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.
3 1
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.
3
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.
3
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route flow.
3
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route flow.
(1)
(1)
(1)
(1)
3
2
1
1 3
33
3
23
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route flow.
(1)
(1)
(1)
(1)
Update capacities.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route flow.Update capacities.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route flow.Update capacities. Repeat!
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.
2
1
1 3
33
3
13
2 3 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.
1 3
33
3
13
2 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.
1 3
33
3
13
2 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.
1 3
33
3
13
2 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.
(1)
(1)
(1)
(1)
1 3
33
3
13
2 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.
(1)
(1)
(1)
(1)
Update capacities.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.Update capacities.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.Update capacities. Repeat!
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.
2
33
3
2
2 3
s
t
Find an s-t-path with depth-first search.Delete dead ends.
2
33
3
s
t
Find an s-t-path with depth-first search.Delete dead ends.
2
33
3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.
2
33
3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.
(2)
(2) (2)
(2)
2
33
3
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.
(2)
(2) (2)
(2)
Update capacities.
11
1
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.Update capacities.
11
1
s
t
Find an s-t-path with depth-first search.Delete dead ends.Route as much flow as possible.Update capacities. Repeat.
11
1
s
t
Find an s-t-path with depth-first search.
11
1
s
t
Find an s-t-path with depth-first search.
11
1
s
t
Find an s-t-path with depth-first search.
11
1
s
t
Find an s-t-path with depth-first search.
11
1
s
t
Find an s-t-path with depth-first search.
11
1
s
t
Find an s-t-path with depth-first search.
11
1
s
t
Find an s-t-path with depth-first search.
11
1
s
t
Find an s-t-path with depth-first search.Delete dead ends.
t
Find an s-t-path with depth-first search.Delete dead ends.The source s has been deleted. The phase ends.
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(2)
(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(2)
(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(2)
(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(3)
(1)
(1)
(1)
(1) (1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(3)
(1)
(1)
(1)
(1) (1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(3)
(1)
(1)
(1)
(1) (1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(3)
(1)
(1)
(1)
(1) (2)
(1)(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(3)
(1)
(1)
(1)
(1) (2)
(1)(1)
(1)
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(3)
(1)
(1)
(1)
(1) (2)
(1)(1)
(1)
Observation: Only edges on a shortest s-t-path carry flow.
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
(1)
(1)(2)
(3)
(1)
(1)
(1)
(1) (2)
(1)(1)
(1)
Observation: Only edges on a shortest s-t-path carry flow.
Build residual network (and introduce back edges)!
2 1
1
1
22
2
32
44
2 3 3
1
s
t2 3
2
Collect the flow of this phase.
1
12
1
1
1
1 2
1
11
Observation: Only edges on a shortest s-t-path carry flow.
Build residual network (and introduce back edges)!
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
4 2
2 1
1
1 3
33
3
33
44
2 3 3
1
s
t2 3
2
dist(s, t) = 4 in the original network.
2 1
1
1
22
2
32
44
2 3 3
1
s
t2 3
2
1
12
1
1
1
1 2
1
11
dist(s, t) = 4 in the original network.
2 1
1
1
22
2
32
44
2 3 3
1
s
t2 3
2
1
12
1
1
1
1 2
1
11
dist(s, t) = 4 in the original network.
Back edges go backwards. Not part of any length-4-path.
2 1
1
1
22
2
32
44
2 3 3
1
s
t2 3
2
1
12
1
1
1
1 2
1
11
dist(s, t) = 4 in the original network.
Back edges go backwards. Not part of any length-4-path.
dist(s, t) > 4 in the residual network.
Runtime Analysis
dist(s, t) increases in every phase.
dist(s, t) increases in every phase.
At most n− 2 phases.
dist(s, t) increases in every phase.
At most n− 2 phases.
Every phase performs a couple of depth-first searches.
dist(s, t) increases in every phase.
At most n− 2 phases.
Every phase performs a couple of depth-first searches.
How many?
dist(s, t) increases in every phase.
At most n− 2 phases.
Every phase performs a couple of depth-first searches.
How many?
How much time does each take?
Claim. Each phase performs at most m depth-first searches.
Claim. Each phase performs at most m depth-first searches.
Proof.
Claim. Each phase performs at most m depth-first searches.
Proof. There are at most m edges in the network.
Claim. Each phase performs at most m depth-first searches.
Proof. There are at most m edges in the network.
After every depth-first search we delete at leastone edge.
Claim. Each phase performs at most m depth-first searches.
Proof. There are at most m edges in the network.
After every depth-first search we delete at leastone edge.
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
O (∑m
i=1(n+ di))
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
O (∑m
i=1(n+ di)) = O (nm+∑m
i=1 di)
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
O (∑m
i=1(n+ di)) = O (nm+∑m
i=1 di)
= O (nm+m)
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
O (∑m
i=1(n+ di)) = O (nm+∑m
i=1 di)
= O (nm+m)
= O (nm)
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
O (∑m
i=1(n+ di)) = O (nm+∑m
i=1 di)
= O (nm+m)
= O (nm)
Thus, each phase takes O(nm) steps.
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
O (∑m
i=1(n+ di)) = O (nm+∑m
i=1 di)
= O (nm+m)
= O (nm)
Thus, each phase takes O(nm) steps.
Dinic’ algorithm performs at most n− 2 phases.
Observation. The ith depth-first search takes time O(n+ di),where di is the number of edges deleted as dead ends.
Thus, the total running time of all (at most m) depth-firstsearches is:
O (∑m
i=1(n+ di)) = O (nm+∑m
i=1 di)
= O (nm+m)
= O (nm)
Thus, each phase takes O(nm) steps.
Dinic’ algorithm performs at most n− 2 phases.
Dinic’ algorithm performs O(n2m) steps.
Theorem. Dinic’ algorithm finds a maximum flow inO(n2m) steps.
Part IIDinic’ Algorithm in Unit Capacity Networks
s
t
All capacities are 1
s
t
All capacities are 1
k := dist(s, t). Here, k = 4.
s
t
All capacities are 1
Ignore edges not on a shortest s-t-path.
k := dist(s, t). Here, k = 4.
s
t
All capacities are 1
Ignore edges not on a shortest s-t-path.
k := dist(s, t). Here, k = 4.
s
t
All capacities are 1
Ignore edges not on a shortest s-t-path.
k := dist(s, t). Here, k = 4.
s
t
Find s-t-path by depth-first search.
s
t
Find s-t-path by depth-first search.
s
t
Find s-t-path by depth-first search.
s
t
Find s-t-path by depth-first search.
s
t
Find s-t-path by depth-first search.
s
t
Find s-t-path by depth-first search.
Route 1 unit of flow.
s
t
Find s-t-path by depth-first search.
Route 1 unit of flow.
Update capacities.
s
t
Find s-t-path by depth-first search.
Route 1 unit of flow.
Update capacities.
s
t
Find s-t-path by depth-first search.
Route 1 unit of flow.
Update capacities. This deletes k edges!
Observation. Let k = dist(s, t). Every capacity updateremoves k edges.
Observation. Let k = dist(s, t). Every capacity updateremoves k edges.
Thus, each phase performs at most m/k depth firstsearches.
Observation. Let k = dist(s, t). Every capacity updateremoves k edges.
Thus, each phase performs at most m/k depth firstsearches.
Every depth-first search takes time O(k+ di), where di isthe number of edges deleted as dead ends.
Observation. Let k = dist(s, t). Every capacity updateremoves k edges.
Thus, each phase performs at most m/k depth firstsearches.
Every depth-first search takes time O(k+ di), where di isthe number of edges deleted as dead ends.
Number of steps performed in phase stage is:
O(∑m/k
i=1 (k + di))
Observation. Let k = dist(s, t). Every capacity updateremoves k edges.
Thus, each phase performs at most m/k depth firstsearches.
Every depth-first search takes time O(k+ di), where di isthe number of edges deleted as dead ends.
Number of steps performed in phase stage is:
O(∑m/k
i=1 (k + di))= O
(m+
∑m/ki=1 di
)
Observation. Let k = dist(s, t). Every capacity updateremoves k edges.
Thus, each phase performs at most m/k depth firstsearches.
Every depth-first search takes time O(k+ di), where di isthe number of edges deleted as dead ends.
Number of steps performed in phase stage is:
O(∑m/k
i=1 (k + di))= O
(m+
∑m/ki=1 di
)= O(m).
Observation. Let k = dist(s, t). Every capacity updateremoves k edges.
Thus, each phase performs at most m/k depth firstsearches.
Every depth-first search takes time O(k+ di), where di isthe number of edges deleted as dead ends.
Number of steps performed in phase stage is:
O(∑m/k
i=1 (k + di))= O
(m+
∑m/ki=1 di
)= O(m).
There are at most n− 2 phases.
Theorem. On a network in which all capacities are 1,Dinic’ algorithm finds a maximum flow in O(nm) steps.
Theorem. On a network in which all capacities are 1,Dinic’ algorithm finds a maximum flow in O(nm) steps.
even better:
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most
√m phases, and thus
O(m1.5) steps.
Theorem. On a network in which all capacities are 1,Dinic’ algorithm finds a maximum flow in O(nm) steps.
even better:
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most
√m phases, and thus
O(m1.5) steps.
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Part IIINumber of Phases in Unit Capacity Networks
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Proof. Let t ∈ N, to be determined later.
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Proof. Let t ∈ N, to be determined later.
Consider Gt, the residual network after t phases.
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Proof. Let t ∈ N, to be determined later.
Consider Gt, the residual network after t phases.
k := dist(s, t) ≥ t in Gt.
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Proof. Let t ∈ N, to be determined later.
Consider Gt, the residual network after t phases.
k := dist(s, t) ≥ t in Gt.
Vi := {v | dist(s, v) = i in Gt}.
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Proof. Let t ∈ N, to be determined later.
Consider Gt, the residual network after t phases.
k := dist(s, t) ≥ t in Gt.
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}
|E0|+ |E1|+ . . .+ |Ek−1| ≤ m.
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}
|E0|+ |E1|+ . . .+ |Ek−1| ≤ m.
|Ei| ≤ mk ≤mt for some i.
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}
|E0|+ |E1|+ . . .+ |Ek−1| ≤ m.
|Ei| ≤ mk ≤mt for some i.
S := V0 ∪ V1 ∪ . . . ∪ Vi.
is an s-t-cut!
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}
|E0|+ |E1|+ . . .+ |Ek−1| ≤ m.
|Ei| ≤ mk ≤mt for some i.
S := V0 ∪ V1 ∪ . . . ∪ Vi.
cap(S, V \ S) = |Ei| ≤ mt .
is an s-t-cut!
Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1}
|E0|+ |E1|+ . . .+ |Ek−1| ≤ m.
|Ei| ≤ mk ≤mt for some i.
S := V0 ∪ V1 ∪ . . . ∪ Vi.
cap(S, V \ S) = |Ei| ≤ mt .
maxflow(Gt) ≤ mt .
is an s-t-cut!
Gt := the residual network after t phases.
Gt := the residual network after t phases.
maxflow(Gt) ≤ mt .
Gt := the residual network after t phases.
maxflow(Gt) ≤ mt .
Every phase increases the flow by at least 1.
Gt := the residual network after t phases.
maxflow(Gt) ≤ mt .
Every phase increases the flow by at least 1.
At most t+ mt phases.
Gt := the residual network after t phases.
maxflow(Gt) ≤ mt .
Every phase increases the flow by at least 1.
At most t+ mt phases.
At most 2√m phases (setting t =
√m).
Gt := the residual network after t phases.
maxflow(Gt) ≤ mt .
Every phase increases the flow by at least 1.
At most t+ mt phases.
At most 2√m phases (setting t =
√m).
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Gt := the residual network after t phases.
maxflow(Gt) ≤ mt .
Every phase increases the flow by at least 1.
At most t+ mt phases.
At most 2√m phases (setting t =
√m).
Lemma 1. On a network with unit capacities, Dinic’algorithm performs at most 2
√m phases, and thus
O(m1.5) steps.
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Proof.
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Proof. Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Proof. Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Proof. Vi := {v | dist(s, v) = i in Gt}.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
At most n2n/k =k2 sets Vi can be big.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
At most n2n/k =k2 sets Vi can be big.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
At most n2n/k =k2 sets Vi can be big.
Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1.
......
Vi Vi+1
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
At most n2n/k =k2 sets Vi can be big.
Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1.
|E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2
k2 .
......
Vi Vi+1
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
At most n2n/k =k2 sets Vi can be big.
Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1.
|E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2
k2 .
......
Vi Vi+1
S := V0 ∪ V1 ∪ . . . Vi is an s-t-cut.
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
At most n2n/k =k2 sets Vi can be big.
Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1.
|E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2
k2 .
......
Vi Vi+1
S := V0 ∪ V1 ∪ . . . Vi is an s-t-cut.cap(S, V \ S) ≤ 4n
2
k2 ≤4n2
t2 .
s t...
......
...V0
V1 Vi Vi+1 Vk+1Vk
Vi is big if |Vi| ≥ 2n/k.
At most n2n/k =k2 sets Vi can be big.
Thus, V0, . . . , Vk contains two consecutive “small” sets Vi, Vi+1.
|E(Vi, Vi+1)| ≤ |Vi| · |Vi+1| ≤ 4n2
k2 .
......
Vi Vi+1
S := V0 ∪ V1 ∪ . . . Vi is an s-t-cut.cap(S, V \ S) ≤ 4n
2
k2 ≤4n2
t2 .maxflow(Gt) ≤
Gt := the residual network after t phases.
Gt := the residual network after t phases.
maxflow(Gt) ≤ 4n2
t2 .
Gt := the residual network after t phases.
maxflow(Gt) ≤ 4n2
t2 .
Every phase increases the flow by at least 1.
Gt := the residual network after t phases.
maxflow(Gt) ≤ 4n2
t2 .
Every phase increases the flow by at least 1.
At most t+ 4n2
t2 phases.
Gt := the residual network after t phases.
maxflow(Gt) ≤ 4n2
t2 .
Every phase increases the flow by at least 1.
At most t+ 4n2
t2 phases.
At most 5n2/3 phases (setting t = n2/3).
Gt := the residual network after t phases.
maxflow(Gt) ≤ 4n2
t2 .
Every phase increases the flow by at least 1.
At most t+ 4n2
t2 phases.
At most 5n2/3 phases (setting t = n2/3).
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Gt := the residual network after t phases.
maxflow(Gt) ≤ 4n2
t2 .
Every phase increases the flow by at least 1.
At most t+ 4n2
t2 phases.
At most 5n2/3 phases (setting t = n2/3).
Lemma 2. On a network with unit capacities, Dinic’algorithm performs at most O
(n2/3
)phases, and thus
O(n2/3m) steps.
Theorem. Dinic’ algorithm finds a maximum flow inO(n2m) steps.
Theorem. On a network with unit capacities, Dinic’algorithm finds a maximum flow in O(m1.5) steps.
Theorem. On a network with unit capacities, Dinic’algorithm finds a maximum flow in O(n2/3m) steps.