-----------------------------------------------------------------------------
COMP 731 - Data Struc & Algorithms - Lecture 27 - Thursday, September 7, 2000
-----------------------------------------------------------------------------
Today:
o Max Flow
A problem on a directed graph.
Given: a directed graph G=(V,E), s,t in V,
a "capacity" c: E -> R+
if (u,v)\not\in E, the c(u,v)=0.
Find: a "maximum s->t flow":
What is a maximum flow? :: describe examples in traffic engineering,
pipes carrying water,
electrical distribution systems.
First, it is a flow:
A flow is a function f: V x V -> R such that
(1) skew symmetry: f(x,y) = - f(y,x)
// just a convenient convention; there's not "really" any negative flow.
(2) conservation of flow at interior vertices:
for all vertices v other than s and t,
sum f(v,w) = 0
w
(3) capacity constraints: f(x,y) <= c(x,y)
-------------------
| figure of p. 85 |
-------------------
an edge (v,w) is *saturated* if f(v,w) = c(v,w)
The value of a flow, |f|, is the amount of flow exiting from s
(or entering t):
sum_v f(s,v)
A flow f^* is maximal if there is no flow g with value greater than |f^*|.
How to find a maximum flow?
We will use the idea of an *augmenting path*
For any flow graph (G=(V,E),c,s,t) and any flow f for it, we can define
the *residual graph* as the graph with the same vertex set V,
an edge set which has all the edges with "residual capacity"
c(v,w) - f(v,w) > 0,
and a new capacity function
c'(v,w) = c(v,w) - f(v,w).
-------------------
| figure of p. 88 |
-------------------
An augmenting path is an s->t path in the residual graph.
If there is an augmenting path then the flow is not maximal, because you
can push additional flow along the augmenting path.
This give us an algorithm for maximal flow:
[Ford Fulkerson]
start with the zero flow
repeat
find an augmenting path in the residual graph
argument the flow
until s and t become disconnected in the residual graph
-------------------
Do Same Example
-------------------
What can we say about the efficiency?
It is not very good.
If the capacities are integers, then each augmentation increase the
value of the flow by at least one, so the total
time will be
O(m |f^*|)
Such a bad case really can happen: see the example on page 91.
If the capacities are not integers, the situation is even worse.
The algorithm may run forever, and it might not even converge to the
right answer! See page 91-92 for an example.
Max-Flow/Min Cut Theorem
------------------------
An s-t cut in an edge-weighted graph (G=(V,E), c), where s and t are
distinct vertices, is a partition of V into disjoint sets (S,T)
such that s\in S and t\in T. The *value* of a cut (S,T) is
sum c(x,y)
x in S
y in T
Theorem [Max Flow / Min Cut]
............................
Let (G,c,s,t) be a flow graph.
Then the value of a maximal flow = The value of a minimum cut
Now prove the theorem
How do you compute a minimum cut?? Go over it again: the
set of vertices reachable from s in the residual graph.