AA Session02
AA Session02
Advanced Algorithms
)(17‐34‐532
It is assumed that the source and the sink are the only source and
destination of the material, respectively; all the other vertices can
serve only as points where a flow can be redirected without consum‐
ing or adding any amount of the material. In other words, the to‐
tal amount of the material entering an intermediate vertex must be
equal to the total amount of the material leaving the vertex. This
condition is called the flow‐conservation requirement.
If we denote the amount sent through edge (i, j) by xij , then for any in‐
termediate vertex i, the flow‐conservation requirement can be expressed
by the following equality constraint:
where the sums in the left‐ and right‐hand sides express the total inflow
and outflow entering and leaving vertex i, respectively.
This quantity, the total outflow from the source—or, equivalently, the
total inflow into the sink—is called the value of the flow. We denote it
by v . It is this quantity that we will want to maximize over all possible
flows in a network.
We can solve the above linear programming problem by the simplex method
or by another algorithm for general linear programming problems.
A greedy approach:
Suppose we start with zero flow: f (e) = 0 for all e. Clearly this respects
the capacity and conservation conditions; the problem is that its value is
0. We now try to increase the value of f by “pushing” flow along a path
from s to t, up to the limits imposed by the edge capacities.
k For each edge e = (u, v) of G on which f (e) < ce , there are ce − f (e)
“leftover” units of capacity on which we could try pushing flow forward.
So we include the edge e = (u, v) in Gf , with a capacity of ce − f (e).
We will call edges included this way forward edges.
k For each edge e = (u, v) of G on which f (e) > 0, there are f (e) units
of flow that we can “undo” if we want to, by pushing flow backward. So
we include the edge e′ = (v, u) in Gf , with a capacity of f (e). Note that
e′ has the same ends as e, but its direction is reversed; we will call edges
included this way backward edges.
Note that each edge e in G can give rise to one or two edges in Gf : If 0 <
f (e) < ce it results in both a forward edge and a backward edge being
included in Gf . Thus Gf has at most twice as many edges as G. We will
sometimes refer to the capacity of an edge in the residual graph as a residual
capacity, to help distinguish it from the capacity of the corresponding edge
in the original flow network G.
We often refer to any s‐t path in the residual graph as an augmenting path.
The result of augment(f, P ) is a new flow f ′ in G, obtained by increasing
and decreasing the flow values on edges of P .
Fact: f ′ is indeed a flow in G. (The proof is omitted.)
The Ford‐Fulkerson algorithm is really quite simple. What is not at all clear
is whether its central While loop terminates, and whether the flow re‐
turned is a maximum flow.
(Surprisingly, the final flow always turns out to be maximal, irrespective of
a sequence of augmenting paths.)