Lecture 12
Lecture 12
Graph Theory
Lecture - 12
06/15/2025
• Forexample, the graph in Figure below is a
transport network. Here vertex a is the source, the
sink is at vertex z, and capacities are shown
beside each edge. Since c(a, b) + c(a, g) = 5 + 7
= 12, the amount of the commodity being
transported from a to z cannot exceed 12. With
c(d, z) + c(h, z) = 5 + 6 = 11, the amount is
further restricted to be no greater than 11.
Example
06/15/2025
• In
the Figure below, the flow into vertex g is 5, but
the flow out from that vertex is 2 + 2 = 4.
Hence the function f is not a flow in this case.
Example
06/15/2025
• For the network in Figure below, only the edge (h,
d) is saturated. All other edges are unsaturated.
The value of the flow in this network is
06/15/2025
• For
the network in Figure below, s-t cuts are
{{s ,a}, {s, c}}, {{s, c}, {a, c}, {a, b}}, etc. The
minimum s-t cut is {{a, b}, {d, b}, {d, t}} which
has capacity as 12+7+4 = 23.
06/15/2025
Some Properties of Flows
06/15/2025
Flow Network
10
06/15/2025
Flow
• Capacity Constraint: On any edge e we have f(e) ≤
c(e).
• Flow Conservation: For any vertex v ≠ {s, t}, flow
in equals flow out:
• Subject to these constraints, we want to maximize
the total flow into t. For instance, imagine we want to
route message traffic from the source to the sink, and
the capacities tell us how much bandwidth we’re
allowed on each edge.
11
Example
06/15/2025
• Our goal is to push as much flow as possible from
s to t in the graph. The rules are that no edge can
have flow exceeding its capacity, and for any
vertex except for s and t, the flow into the vertex
must equal the flow out from the vertex.
Example (Contd.)
06/15/2025
• Inthe above graph, what is the maximum flow
from s to t? Answer: 5. Using “capacity[flow]”
notation, the positive flow looks as in Figure
below. Note that the flow can split and rejoin
itself.
Example (Contd.)
06/15/2025
• Howcan you see that the above flow was really
maximum? Notice, this flow saturates the a → c
and s → b edges, and, if you remove these, you
disconnect t from s. In other words, the graph has
an “s-t cut” of size 5 (a set of edges of total
capacity 5 such that if you remove them, this
disconnects the source from the sink).
06/15/2025
Minimum s-t Cut
•A minimum s-t cut in a flow network G is a cut of
minimum value, that is, min{c〈S, T〉 : 〈S, T〉 is an s-t
cut}.
• Example: The s-t cut 〈{s, x, v}, {w, t} 〉 = {(x, w), (v,
t)} appears in Figure below. The capacity of the cut c〈S,
T〉 = c(x, w) + c(v, t) = 13. Notice that (w, v) is a
backward arc and hence its capacity is not included in
the capacity of the cut.
06/15/2025
Example
• The flow f (in parentheses) and s-t cut 〈S, T〉 shown in
Figure below illustrate Fact of flow conservation. In
particular, val(f) = 6, and the flow across the cut, f〈S,
T〉, equals f(x, w) + f(v, t) – f(w, v) = 2 + 5 – 1 = 6.
Max-Flow Min-Cut Theorem
06/15/2025
• Therelationship between the maximum-flow
problem and its dual, the minimum cut problem, is
an example of strong max-min duality that occurs
between certain optimization problems and their
dual problems.
• Let f be the current flow in a network G = (V, E, s,
t, c). An arc (v, w) ∈ E is increasable if f(v, w) <
c(v, w) and is reducible if f(v, w) > 0.
• Let
I denote the set of all increasable arcs, and let
R be the set of all reducible arcs. (Of course, in
general, I ∩ R ≠ ).
Max-Flow Min-Cut Theorem
06/15/2025
• Given a flow f in a network G = (V, E, s, t, c), the
residual network Gf = (V, Ef , s, t, cf ) has vertex-set
V, and the arc-set Ef is constructed from network G as
follows: for each arc (v, w) ∈ E, if arc (v, w) ∈ Ef, then
create an arc (v, w) in Gf , and label it with a residual
capacity cf (v, w) = c(v, w) – f(v, w); if arc (v, w) ∈ R,
then create an arc (w, v) in Gf , and label it cf (w, v) =
f(v, w).
• Given a flow f in a network G = (V, E, s, t, c), a flow-
augmenting path P for network G is a directed s-t
path in the residual network Gf . The capacity of
flow-augmenting path P , is given by
06/15/2025
Example
• The current flow f in the network G shown at the top
in Figure below has value 9. The corresponding
residual network Gf is shown at the bottom.
06/15/2025
Example
• There are exactly two directed paths from s to t in
the residual network, each corresponding to a
different flow-augmenting path for increasing the
flow. One of them is the directed path s → v → w → t
in the network Gf . The arc (v, w) in path P
corresponds to the reducible arc (w, v) in network G.
Notice that cf (p) = 1.
06/15/2025
Example
Few possible cuts in the graph are shown in the
graph and weights of each cut are as follows:
Cut1=25, Cut2=12, Cut3=16, Cut4=10, Cut5=15. As
mentioned, these are only few possible cuts but
considering any valid cut would not have weight less
than Cut4.
Minimum Cut Problem
06/15/2025
•A cut is a node partition (S, T) such that s is in S and
t is in T.
Minimum Cut Problem
06/15/2025
•A cut is a node partition (S, T) such that s is in S and
t is in T.
Minimum Cut Problem
06/15/2025
•A cut is a node partition (S, T) such that s is in S and
t is in T.
Maximum Flow Problem
06/15/2025
Flow
06/15/2025
Flow
06/15/2025
Maximum Flow Problem
06/15/2025
Max-Flow Min-Cut Theorem
06/15/2025
06/15/2025
Example: Algorithm Application
06/15/2025
Iteration – 1
06/15/2025
Iteration – 1
06/15/2025
Iteration – 2
06/15/2025
Iteration – 2
06/15/2025
Iteration – 3
06/15/2025
Iteration – 3
06/15/2025
Iteration – 4
06/15/2025
Iteration – 4
06/15/2025
Max-Flow Value
06/15/2025
Ford-Fulkerson Algorithm
FordFulkerson(Graph G,Node S,Node T):
Initialize flow in all edges to 0
while (there exists an augmenting path(P) between
S and T in residual network graph):
Augment flow between S to T along the path P
Update residual network graph
return
06/15/2025
• An augmenting path is a simple path from
source to sink which do not include any cycles
and that pass only through positive weighted
edges. A residual network graph indicates how
much more flow is allowed in each edge in the
network graph. If there are no augmenting
paths possible from S to T, then the flow is
maximum. The result i.e., the maximum flow
will be the total flow out of source node which
is also equal to total flow into the sink node.
06/15/2025
Example
Graph G
Residual Graph Gf
06/15/2025
Example
Graph G
Residual Graph Gf
06/15/2025
Example
Graph G
Residual Graph Gf