Network Flows
Peter Schröder
CS138A 1999
1
Flow Networks
Definitions
a flow network G=(V,E) is a directed graph
in which each edge (u,v) in E has a
nonnegative capacity c(u,v)
there are two distinguished vertices: a
source s and a sink t
for simplicity assume that every vertex lies
on some path from s to t (this implies that
the graph is connected)
CS138A 1999
2
Flow
Definition
a flow on a graph is a real valued function
VxV>R with the following properties
capacity constraint: for all u,v in V
f u, v c u, v
skew symmetry: for all u,v in V
f u, v f v, u
flow conservation: for all u in V\{s,t}
f u, v 0
vV
CS138A 1999
3
Flow
Definitions
the value of a flow is defined as
f
f s, v
vV
in the maximum flow problem we wish to
find the maximum flow from s to t in some
graph G=(V,E)
non zero net flow from u to v implies (u,v)
in E or (v,u) in E
CS138A 1999
4
Flow
Multiple sources and sinks
introduce super source and super sink with
infinite capacity connections to the
individuals sources and sinks respectively
implicit set summation convention
Lemma 1: Let G=(V,E) be a flow network
and let f be a flow in G. Then for X subset
Vf X, X 0 X, Y V f X, Y f Y, X
X, Y, Z V
CS138A 1999
XY
f X Y, Z f X, Z f Y, Z
5
Example
Use implicit set summation to prove
f f V, t
f f s, V
f V, V f V s, V
f V, V s
f V, t f V, V s t
f V, t
CS138A 1999
by definition
by Lemma 1
by Lemma 1
by Lemma 1
by flow conservation
6
Ford-Fulkerson Method
Principles behind differing
implementations
repeated update through augmenting
paths
Ford-Fulkerson-Method(G,s,t)
if1.there
is unused capacity left, use it…
2.
3.
4.
5.
CS138A 1999
initialize flow to 0
while( exists augmenting path )
augment flow f along path
return f
7
Residual Networks
Formalization of remaining flow
opportunities
given flow network G=(V,E) and flow f
define residual capacity
c f u, v cu, v f u, v
the residual flow network is induced by
they positive residual capacity Gf=(V,Ef)
where Ef consists of all pairs u,v in V with
positive residual flow capacity (note that it
can have as many as twice as many
edges)
CS138A 1999
8
Properties
Residual networks
Lemma 2: Let G=(V,E) be a flow network
with source s and sink t and f be a flow; let
Gf be the residual network induced and let
f’ be a flow in Gf then the flow sum f+f’ is a
flow in G with value |f+f’|=|f|+|f’|
Augmenting path
simple path p in residual network from s to
t
residual capacity cf(p) is minimum capacity
along
path
p
CS138A 1999
9
Residual Capacity
Property
Lemma 3: let G=(V,E) be a flow network
with flow f and p be an augmenting path in
Gf. Define
c f p if u, v is on p
fp u, v c f p if v, u is on p
0 otherwise
then fp is a flow in Gf with value |fp|=cf(p)
positive
CS138A 1999
10
Residual Capacity
Adding an augmenting flow
Corollary 4: Let G=(V,E) be a flow network
with flow f and p be an augmenting path in
Gf Let fp be defined as before; define
f’=f+fp then f’ is a flow in G with value
|f’|=|f|+|fp| greater than |f|
immediate from previous two lemmas
CS138A 1999
11
Cuts of Flow Networks
What is a cut?
a cut(S,T) is a partition of V into S and T
with s in S and t in T with net flow f(S,T)
and capacity c(S,T) (picture)
Lemma 5: let f be a flow in a flow network
G with source s and sink t and let (S,T) be
a cut of G; then f(S,T)=|f|
Corollary 6: the value of any flow f in a flow
network G is bounded from above by the
capacity of any cut of G
CS138A 1999
12
Cuts in Flow Networks
Max-flow min-cut theorem
Theorem 7: if f is a flow in a flow network
G=(V,E) with source s and sink t, then the
following conditions are equivalent:
f is a maximum flow in G
the residual network Gf contains no
augmenting paths
|f|=c(S,T) for some cut (S,T) of G
CS138A 1999
13
Basic Ford-Fulkerson
Iteratively increase flow by residual
capacity
1.
2.
3.
4.
5.
6.
7.
8.
Ford-Fulkerson(G,s,t)
for( (u,v) in E[G] )
f[u,v] = 0; f[v,u] = 0;
while( exists path p from s to t in Gf )
cf(p) = min{cf(u,v): (u,v) in p}
for( (u,v) in E[p] )
f[u,v] = f[u,v]+cf(p);
f[v,u] = -f[u,v]
CS138A 1999
14
Ford-Fulkerson
Running time: depends on method to pick
augmenting path (use BFS)
Edmonds-Karp algorithm
pick p with BFS looking for the shortest path
with unit edge lengths in the residual
network; O(VE2)
Lemma 8: when Edmunds-Karp is run on G
then for all vertices v in V\{s,t} the shortest
path distancef s, v in the residual
network Gf increases monotonically with
augmentation
CS138A 1999
15
Edmunds-Karp
Properties
Theorem 9: if the Edmonds-Karp algorithm
is run on a flow network G=(V,E) with
source s and sink t, then the total number
of flow augmentations performed by the
algorithm is at most O(VE)
CS138A 1999
16
© Copyright 2026 Paperzz