Dinic’ Max Flow Algorithm
Slides by Dominik Scheder
Dinic Max Flow Algorithm Slides by Dominik Scheder Part I Dinic - - PowerPoint PPT Presentation
Dinic Max Flow Algorithm Slides by Dominik Scheder Part I Dinic Algorithm in General Flow Networks 2 4 2 1 3 3 1 2 3 t 3 3 1 2 s 4 4 2 1 3 3 3 3 2 4 2 1 3 3 1 2 3 t 3 3 1 2 s 4 4 2 1 3 3 3 3
Dinic’ Max Flow Algorithm
Slides by Dominik Scheder
Dinic’ Algorithm in General Flow Networks
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
4 2 2 1 1 1 3 3 3 3 3 3 4 4 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 3 3 3 3 3 4 4 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 3 3 3 3 3 4 4 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 3 3 3 3 3 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 3 3 3 3 3 2 3 3
s t
Now lets greedily route as much flow as possible in this network!
4 2 2 1 1 1 3 3 3 3 3 3 2 3 3
s t
4 2 2 1 1 1 3 3 3 3 3 3 2 3 3
s t Find an s-t-path with depth-first search.
4 2 2 1 1 1 3 3 3 3 3 3 2 3 3
s t Find an s-t-path with depth-first search.
4 2 2 1 1 1 3 3 3 3 3 3 2 3 3
s t Find an s-t-path with depth-first search.
4 2 2 1 1 1 3 3 3 3 3 3 2 3 3
s t Find an s-t-path with depth-first search.
4 2 2 1 1 1 3 3 3 3 3 3 2 3 3
s t Find an s-t-path with depth-first search.
4 2 2 1 1 1 3 3 3 3 3 3 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 3 3 3 3 3 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 3 3 3 3 3 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 3 3 3 2 3 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 3 3 3 2 3 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 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search.
3 1 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search.
3 1 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search.
3 1 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search.
3 1 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search.
3 1 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search.
3 1 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search.
3 1 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search. Delete dead ends.
3 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search. Delete dead ends.
3 2 1 1 3 3 3 3 2 3 2 3 3
s t Find an s-t-path with depth-first search. Delete dead ends. Route flow.
3 2 1 1 3 3 3 3 2 3 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 3 3 3 2 3 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 3 3 3 1 3 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 3 3 3 1 3 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 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search.
2 1 1 3 3 3 3 1 3 2 3 3
s t Find an s-t-path with depth-first search. Delete dead ends.
1 3 3 3 3 1 3 2 3
s t Find an s-t-path with depth-first search. Delete dead ends.
1 3 3 3 3 1 3 2 3
s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.
1 3 3 3 3 1 3 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 3 3 3 1 3 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 3 3 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 3 3 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 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search.
2 3 3 3 2 2 3
s t Find an s-t-path with depth-first search. Delete dead ends.
2 3 3 3
s t Find an s-t-path with depth-first search. Delete dead ends.
2 3 3 3
s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible.
2 3 3 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 3 3 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.
1 1 1
s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible. Update capacities.
1 1 1
s t Find an s-t-path with depth-first search. Delete dead ends. Route as much flow as possible. Update capacities. Repeat.
1 1 1
s t Find an s-t-path with depth-first search.
1 1 1
s t Find an s-t-path with depth-first search.
1 1 1
s t Find an s-t-path with depth-first search.
1 1 1
s t Find an s-t-path with depth-first search.
1 1 1
s t Find an s-t-path with depth-first search.
1 1 1
s t Find an s-t-path with depth-first search.
1 1 1
s t Find an s-t-path with depth-first search.
1 1 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 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (2) (2) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (2) (2) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (2) (2) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (2) (3) (1) (1) (1) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (2) (3) (1) (1) (1) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
(1) (1) (2) (3) (1) (1) (1) (1) (1)
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 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 3 3 3 3 3 4 4 2 3 3 1
s t
2 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 3 3 3 3 3 4 4 2 3 3 1
s t
2 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 3 3 3 3 3 4 4 2 3 3 1
s t
2 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 2 2 2 3 2 4 4 2 3 3 1
s t
2 3 2
Collect the flow of this phase.
1 1 2 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)!
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
4 2 2 1 1 1 3 3 3 3 3 3 4 4 2 3 3 1
s t
2 3 2
dist(s, t) = 4 in the original network.
2 1 1 1 2 2 2 3 2 4 4 2 3 3 1
s t
2 3 2 1 1 2 1 1 1 1 2 1 1 1
dist(s, t) = 4 in the original network.
2 1 1 1 2 2 2 3 2 4 4 2 3 3 1
s t
2 3 2 1 1 2 1 1 1 1 2 1 1 1
dist(s, t) = 4 in the original network. Back edges go backwards. Not part of any length-4-path.
2 1 1 1 2 2 2 3 2 4 4 2 3 3 1
s t
2 3 2 1 1 2 1 1 1 1 2 1 1 1
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.
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?
Proof.
Proof. There are at most m edges in the network.
Proof. There are at most m edges in the network. After every depth-first search we delete at least
Proof. There are at most m edges in the network. After every depth-first search we delete at least
where di is the number of edges deleted as dead ends.
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is:
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m
i=1(n + di))
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m
i=1(n + di)) = O (nm + m i=1 di)
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m
i=1(n + di)) = O (nm + m i=1 di)
= O (nm + m)
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches is: O (m
i=1(n + di)) = O (nm + m i=1 di)
= O (nm + m) = O (nm)
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches 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.
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches 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.
where di is the number of edges deleted as dead ends. Thus, the total running time of all (at most m) depth-first searches 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.
O(n2m) steps.
Dinic’ 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!
removes k edges.
removes k edges. Thus, each phase performs at most m/k depth first searches.
removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends.
removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k
i=1 (k + di)
removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k
i=1 (k + di)
i=1 di
removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k
i=1 (k + di)
i=1 di
removes k edges. Thus, each phase performs at most m/k depth first searches. Every depth-first search takes time O(k + di), where di is the number of edges deleted as dead ends. Number of steps performed in phase stage is: O m/k
i=1 (k + di)
i=1 di
There are at most n − 2 phases.
Dinic’ algorithm finds a maximum flow in O(nm) steps.
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.
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
phases, and thus O(n2/3m) steps.
Number 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.
Lemma 1. On a network with unit capacities, Dinic’ algorithm performs at most 2√m phases, and thus O(m1.5) steps.
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.
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.
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.
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+1 Vk
Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk
Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk 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+1 Vk 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+1 Vk 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+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m
k ≤ m t for some i.
Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m
k ≤ m t 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+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m
k ≤ m t for some i.
S := V0 ∪ V1 ∪ . . . ∪ Vi. cap(S, V \ S) = |Ei| ≤ m
t .
is an s-t-cut!
Vi := {v | dist(s, v) = i in Gt}. s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Ei := {(u, v) ∈ E | u ∈ Vi, v ∈ Vi+1} |E0| + |E1| + . . . + |Ek−1| ≤ m. |Ei| ≤ m
k ≤ m t for some i.
S := V0 ∪ V1 ∪ . . . ∪ Vi. cap(S, V \ S) = |Ei| ≤ m
t .
maxflow(Gt) ≤ m
t .
is an s-t-cut!
Gt := the residual network after t phases.
Gt := the residual network after t phases. maxflow(Gt) ≤ m
t .
Gt := the residual network after t phases. maxflow(Gt) ≤ m
t .
Every phase increases the flow by at least 1.
Gt := the residual network after t phases. maxflow(Gt) ≤ m
t .
Every phase increases the flow by at least 1. At most t + m
t phases.
Gt := the residual network after t phases. maxflow(Gt) ≤ m
t .
Every phase increases the flow by at least 1. At most t + m
t phases.
At most 2√m phases (setting t = √m).
Gt := the residual network after t phases. maxflow(Gt) ≤ m
t .
Every phase increases the flow by at least 1. At most t + m
t 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) ≤ m
t .
Every phase increases the flow by at least 1. At most t + m
t 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
phases, and thus O(n2/3m) steps.
Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O
phases, and thus O(n2/3m) steps. Proof.
Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O
phases, and thus O(n2/3m) steps.
s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk
Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O
phases, and thus O(n2/3m) steps.
s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k.
Lemma 2. On a network with unit capacities, Dinic’ algorithm performs at most O
phases, and thus O(n2/3m) steps.
s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most
n 2n/k = k 2 sets Vi can be big.
s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most
n 2n/k = k 2 sets Vi can be big.
s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most
n 2n/k = k 2 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+1 Vk Vi is big if |Vi| ≥ 2n/k. At most
n 2n/k = k 2 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+1 Vk Vi is big if |Vi| ≥ 2n/k. At most
n 2n/k = k 2 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+1 Vk Vi is big if |Vi| ≥ 2n/k. At most
n 2n/k = k 2 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) ≤ 4n2
k2 ≤ 4n2 t2 .
s t . . . . . . . . . . . . V0 V1 Vi Vi+1 Vk+1 Vk Vi is big if |Vi| ≥ 2n/k. At most
n 2n/k = k 2 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) ≤ 4n2
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
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
phases, and thus O(n2/3m) steps.
O(n2m) steps.
algorithm finds a maximum flow in O(m1.5) steps.
algorithm finds a maximum flow in O(n2/3m) steps.