



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Maximum Flow
A flow network is a directed graph where: Each edge (u, v) has a capacity c(u, v) ≥ 0. If (u, v) is not an edge, then c(u, v) = 0. There is a source vertex s and a sink vertex t. A flow f (u, v) satisfies the following constraints:
for all (u, v), f (u, v) ≤ c(u, v) for all (u, v), f (u, v) = −f (v, u) for all u except s and t, (^) Σ v∈V
f (u, v) = 0
We want to maximize the flow F from s to t:
F = (^) Σ v∈V
f (s, v) = (^) Σ v∈V
f (v, t)
Algorithms for maximum flow can be used for liquids flowing through pipes, parts through assembly lines, current through electrical networks, information through communication networks, the maximum matching in a bipartite graph, and the minimum-size cut of a graph.
Ford-Fulkerson Method
Let f (·, ·) be a flow. Define residual capacity cf
cf (u, v) = c(u, v) − f (u, v)
Define residual edges Ef to be the edges with positive residual capacity.
Ef = {(u, v) ∈ V × V : cf (u, v) > 0 }
Ford-Fulkerson(G, s, t, c) for each edge (u, v) in G do f [u, v] ← 0 f [v, u] ← 0 while ( P ← a path from s to t in Ef ) do x ← min{cf (u, v) : (u, v) ∈ P } for each edge (u, v) in P do f [u, v] ← f [u, v] + x f [v, u] ← −f [u, v]
A maximum flow is found because every path from s to t is at full capacity.
Edmonds-Karp Algorithm
This algorithm uses the shortest augmenting path (found by BFS). Running time is O(V E^2 ).
Lemma: Residual path lengths do not decrease. Suppose the distance from s to v decreases. Let v be the closest vertex where this happens. Some vertex u becomes adjacent to v (otherwise v could not be closer). This implies (v, u) is on augmenting path, but this means u is farther from s than v. A contradiction, so distances do not decrease.
Lemma: Each edge is critical O(V ) times. A cf (u, v) is minimum on each augmenting path. This implies (u, v) removed from residual edges. For (u, v) to reappear as a residual edge, (v, u) must be on augmenting path. Because distance to v cannot decrease, distance to u must have increased. Thie implies each edge can be minimal O(V ) times.
Push-Relabel Algorithms
The excess flow into vertex u is defined as
e(u) = (^) Σ v∈V
f (v, u)
u is overflowing if e(u) > 0.
Flow goes from “higher” to “lower” vertices. h is a height function if h(s) = |V |, h(t) = 0, and
(u, v) ∈ Ef implies h(u) ≤ h(v) + 1 h(u) > h(v) + 1 implies (u, v) 6 ∈ Ef
Initialize-Preflow(G, s) for each vertex u in G do h[u] ← e[u] ← 0 for each edge (u, v) in G do f [u, v] ← f [v, u] ← 0 h[s] ← number of vertices for each vertex u in Adj[s] do f [s, u] ← c[s, u] f [u, s] ← −c[s, u] e[u] ← c[s, u] e[s] ← e[s] − c[s, u]
16
13
10
12
14
4 7
20
4
s 9 t
v v
v v
2
3 4
1 s t
v v
v v
2
3 4
1 16
13
16
13
10
12
14
4 7
20
4
s 9 t
v v
v v
2
3 4
1 12
14
s 4 t
v v
v v
2
3 4
1 16
13
Residual Networks Flow Values
16
13
6
12
14
8 7
20
4
s 9 t
v v
v v
2
3 4
1 12
14
s 4 t
v v
v v
2
3 4
1 16
(^134)
7
19
16
13
6
12
14
8 7 4
s 9 t
v v
v v
2
3 4
(^119) 1
12
11
s t
v v
v v
2
3 4
1 12
(^114)
7
19
Residual Networks Flow Values