0% found this document useful (0 votes)
19 views

Recitation_Flows

The document outlines the learning objectives and key concepts related to network flows, including flow-augmenting paths, residual graphs, and maximum matchings in bipartite graphs. It provides examples and problems for students to practice identifying flow capacities and constructing flow networks. Additionally, it explains how to use maximum flow algorithms to find maximum-size matchings in bipartite graphs.

Uploaded by

pvcreationsx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Recitation_Flows

The document outlines the learning objectives and key concepts related to network flows, including flow-augmenting paths, residual graphs, and maximum matchings in bipartite graphs. It provides examples and problems for students to practice identifying flow capacities and constructing flow networks. Additionally, it explains how to use maximum flow algorithms to find maximum-size matchings in bipartite graphs.

Uploaded by

pvcreationsx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

CSCI 3104 Recitation- Network Flows

Michael Levet

1 Learning Objectives
The primary goal of recitation this week is to become familiar with key terminology and constructions related
to network flows. In particular, we have the following learning outcomes.

ˆ Students will correctly identify the amount of flow that can be pushed in both the forward and backward
directions of edges.

ˆ Students will correctly identify flow-augmenting paths, including the amount of flow that can be pushed
along such paths.

ˆ Students will correctly identify paths that are not flow-augmenting and provide correct justification as
to why the paths are not flow-augmenting.

ˆ Students will construct residual graphs.

ˆ Students will identify matchings on graphs.

ˆ Students will determine the sizes of maximum matchings.

ˆ Students will use maximum flow procedures to determine maximum-size bipartite matchings.

2 Network Flows
3/4
B D
0/10 2/10

s 0/2 1/6 0/3 t


0/10 2/2

2/9
C E

Figure 1. Consider the flow network N .

(Recommended) Problem 1. Consider the flow network N . How much flow can be pushed in the forward
direction along the edge (B, D)? That is, how much flow can be pushed from B → D?

Example 1. While we can push flow forward across an edge, we can also push flow backwards. The intuition
is that we re-route flow along a flow-augmenting path. However, only existing flow can be re-routed.

(a) Consider the edge (D, C) in the flow network N above, which has a capacity of 6 units of flow and
currently has 1 unit of flow being routed through it. So we can push 5 units of flow from D → C, or we
can push 1 unit of flow backwards from C → D.

(b) Consider the edge (E, D). As there is no flow being pushed from E → D, we cannot push any flow
backwards from D → E.

1
(Recommended) Problem 2. Consider the flow network N above.

(a) How much flow can be pushed in the backward direction along the edge (B, D)? That is, how much flow
can be pushed from D → B?

(b) How much flow can be pushed in the backward direction along the edge (B, C)? That is, how much flow
can be pushed from C → B?

The goal of the Network Flow problem is to maximize the amount flow that we can route from a source vertex
s to a destination (or sink ) vertex t. The approach is to find a path through which we can push positive flow
and then push as much flow as possible. Such paths are called flow-augmenting paths.

(Recommended) Problem 3. Consider the flow networks N above. Determine whether each path is a
flow-augmenting path. If the given path is flow-augmenting, then clearly indicate the maximum amount of
flow that can be pushed through the path. If the given path is not flow-augmenting, then clearly explain why
the path fails to be flow-augmenting.

For the purpose of this problem, do not update N after considering a flow-augmenting path. That is, you
should work part (b) without considering part (a), and so on. The point of this problem is solely to identify
flow-augmenting paths.

(a) s → B → D → t.

(b) s → C → B → D → t.

(c) s → C → E → t.

(d) s → C → E → D → t.

(e) s → C → D → t.

(Recommended) Problem 4. Find a flow augmenting path in N that was not listed in Problem 3 . Clearly
indicate the maximum amount of flow that can be pushed through this path.

Remark 1. Finding flow-augmenting paths can be challenging, particularly as we can push flow in both the
forward and backwards directions. To this end, we introduce the residual graph. Informally, the residual graph
replaces each directed edge in a flow network with at most weighted two edges. The weights on the edges
indicate how much flow can be pushed along a given direction. Should we not be able to push any flow along
an edge in the original flow network, then the corresponding directed edge is omitted in the residual graph.
We make this precise with the following definition.

Definition 1. Let N (V, E, cap, f ) be a flow network, where V is our vertex set, E is our edge set, cap : E → R≥0
identifies our edge capacities, and f : E → R≥0 identifies the amount of flow being pushed across each edge.
The residual graph R(V, E, w) is a directed, weighted graph with the same vertex set as N . For each directed
edge (u, v) ∈ E, we include at most two directed edges in R, as follows:

ˆ If cap((u, v)) − f ((u, v)) > 0, we include the edge (u, v) in E(R) with weight w((u, v)) = cap((u, v)) −
f ((u, v)). That is, the edge (u, v) in R indicates that we can push cap((u, v)) − f ((u, v)) units of flow
from u → v.

ˆ If f ((u, v)) > 0, we include the edge (v, u) in E(R) with weight w((u, v)) = f ((u, v)). That is, the edge
(v, u) in R indicates that we can push f ((u, v)) units of flow in the backwards direction along the edge
(u, v) in N . That is, in N , we can push f ((u, v)) units of flow from v → u.

Note that if cannot push flow in a given direction, then we do not include a directed edge in the residual graph
R.

Example 2. Recall the flow graph N at the top of Page 1. We construct the residual graph R corresponding
to N , which is pictured below.

2
ˆ In N , we have the directed edge (B, D) which has a capacity of 4 and 3 units of flow being pushed
through it.

– As we can push at most 1 more unit of flow in the B → D direction, we include the directed edge
(B, D) in the residual graph R, with the weight of (B, D) as 1.
– As we have 3 units of flow being pushed from B → D, we can push at most 3 units of flow in the
D → B direction. So we also include the directed edge (D, B) in the residual graph R. The weight
of the (D, B) edge in R is 3, indicating we can push 3 units of flow from D → B in the original flow
network N .

ˆ In N , we hvae the directed edge (s, C), which has a capacity of 10 an no flow being pushed through it.
For this reason, we only include the directed edge (s, C) with weight 10 in the residual graph R. As there
is no flow being pushed through the (s, C) edge, we do not include the edge (C, s) in R.

The rationale for including the remaining edges in the residual graph R is similar.

1
B D
3 8
10
2
1
s 2 3 t
5
10 2

7
C E
2

(Recommended) Problem 5. Draw the residual graph corresponding to the flow network N pictured below.

9/9

5/5
B D
1/6 4/7

s 6/6 t
3/3 2/7

4/8
C E

6/6

3 Applications of Network Flows: Bipartite Matching


A key application of finding maximum flows is in constructing maximum-size matchings in bipartite graphs. We
begin with the notion of a matching before examining how network flows are useful in constructing matchings
in bipartite graphs.

3
3.1 Preliminaries- Bipartite Matchings
We begin with the definition of a matching.

Definition 2. Let G(V, E) be a simple, undirected graph. A matching M is a subset of E(G) such that if
{i, j}, {u, v} ∈ M are distinct edges, then {i, j} ∩ {u, v} = ∅. That is, no two distinct edges in M touch or
share any endpoints.

Remark 2. The above definition of a matching makes sense, even if the graph is not bipartite. We illustrate
with the next example.

Example 3. Consider the cycle graph C3 pictured below.

3 2

The graph C3 has four matchings.

ˆ Let M1 = {12}. As M1 only has one edge, no two distinct edges in M1 share a common endpoint. So
M1 is a matching. By similar argument, M2 = {23} and M3 = {13} are also matchings.

ˆ Let M4 = ∅. As M4 does not contain any edges, it vacuously satisfies the definition of a matching.

It is natural to ask whether we can add any edges to a matching. To this end, we again consider M1 = {12}.
Observe that as 23 shares the endpoint 2 with 12, the set {12, 23} is not a matching. By similar argument,
{12, 13} and {13, 23} are also not matchings. Clearly, {12, 23, 13} is also not a matching. So the four matchings
listed above are the only matchings of C3 .

(Recommended) Problem 6. Consider the cycle graph C4 pictured below.

1 2

4 3

Do the following.

(a) How many matchings of size 0 does C4 have? List them.

(b) How many matchings of size 1 does C4 have? List them.

(c) How many matchings of size 2 does C4 have? List them.

(d) How many matchings of size 3 does C4 have? List them.

(e) How many matchings of size 4 does C4 have? List them.

Remark 3. It is of particular interest in algorithm design (as well as in graph theory, and application areas
such as algorithmic economics) to find a matching in the graph G with largest cardinality. We call such
matchings maximum, and the size of such a matching is called the matching number of G. We denote the
matching number of G as ν(G).

(Recommended) Problem 7. Determine ν(G) for the following graphs.

(a) G = C3 .

(b) G = C2n+1 (n ≥ 1).

4
(c) G = C4 .

(d) G = C2n (n ≥ 2).

(e) G = K2,3 . [Refer back to Page 3, Example 6 of my Graph Theory notes on Canvas for the definition of
the Complete Bipartite Graph.]

(f) G = Km,n .

3.2 Using Network Flows to Find Maximum Matchings in Bipartite Graphs


We now describe how to use maximum flow algorithms to find maximum-size matchings in bipartite graphs.
˙ E). We proceed as follows.
Suppose we are given a bipartite graph G(L∪R,

ˆ First construct a flow network N (V, E, cap) in the following manner:

– V (N ) = V (G) ∪ {s, t}. That is, N has precisely the same vertices as G, and then we add a source
vertex s and a sink vertex t.
– For each edge {i, j} ∈ E(G) where i ∈ L and j ∈ R, we add a directed edge (i, j) with capacity 1 in
N.
– For each u ∈ L, we add a directed edge (s, u) with capacity 1 in N .
– For each v ∈ R, we add a directed edge (v, t) with capacity 1 in N .

ˆ Next, we compute the maximum flow f ∗ that we can push from s → t in N .

ˆ We construct the matching M ⊂ E(G) corresponding to f ∗ by including the edges {i, j} ∈ E(G) if and
only if f ∗ ((i, j)) = 1. That is, the saturated edges from L → R in N are precisely the edges in the
corresponding maximum matching of G.

Example 4. We now work through an example of this construction. Let G be the graph pictured below.

y1

x1 y2

x2 y3

ˆ Step 1: We begin by constructing the corresponding flow network N :

y1

0/1 0/1 0/1

0/1 0/1 0/1


s x1 y2 t
0/1 0/1 0/1

0/1
x2 y3

5
ˆ Step 2: We now find a maximum flow. We stress that the selection of our flow-augmenting
paths below is a choice. There are other valid choices; that is, our selection is in a sense
arbitrary.

– Observe that we have a flow-augmenting path s → x1 → y2 → t, allowing us to push 1 unit of flow


from s → t. This yields the updated flow network:

y1

0/1 0/1 0/1

1/1 1/1 1/1


s x1 y2 t
0/1 0/1 0/1

0/1
x2 y3

– Observe that we have a flow-augmenting path s → x2 → y1 → t, allowing us to push 1 unit of flow


from s → t. This yields the updated flow network:

y1

1/1 0/1 1/1

1/1 1/1 1/1


s x1 y2 t
1/1 0/1 0/1

0/1
x2 y3

There are no more flow-augmenting paths. So we now have a maximum flow on N .

ˆ Step 3: We now construct the matching on G based on our maximum flow on N . Since the edges (x1 , y2 )
and (x1 , y2 ) are saturated on N , our corresponding maximum matching M = {{x1 , y2 }, {x2 , y1 }}.

Remark 4. We note that other maximum flows on N would yield different maximum matchings. We leave it
as an exercise for the reader to find the other maximum matchings of G.

(Recommended) Problem 8. Let G = K3,4 . The goal of this problem is to use the network flow reduction
to find a maximum matching of G.

(a) Construct the corresponding flow network N .

(b) Find a maximum flow on N . Clearly identify each flow-augmenting path and the amount of flow you can
push through said path.

(c) Use the maximum flow from part (b) to determine the corresponding maximum matching on G.

You might also like