## Graph Theory Lecture Notes 11

### Flows and Cuts in Networks

A capacitated single source-single sink network is a directed graph D, with each arc (i, j) assigned a positive real number cij called the capacity of the arc, and two distinguished vertices called a sink (t) and a source (s). The source has out-degree of at least one and the sink has in-degree of at least one. (In almost all of the examples we consider the source will have in-degree of 0 and the sink will have out-degree of 0, but this is not required in the definition.) We shall refer to these as (s,t)-networks.

Given an (s,t)-network, a second set of non-negative real numbers, xij, assigned to the arcs is called an (s,t) - feasible flow if

1. 0 xij cij for all arcs, and
2. j xij = j xji for all vertices i, except s and t
(where it is understood that if there is no arc (i, j) then xij = 0.). At s and t, the conservation law (the second condition above) does not hold, and we define

vt = j xjt - j xtj and vs = j xsj - j xjs .

Now, if we sum over all the vertices i, we get: i ( j xij - j xji ) = vs - vt .
But the left hand side of this equation is 0, so vs = vt and we call this common value v, and define it to be the value of the flow.

For the above example, the value of that flow is 3.

The problem we wish to investigate is how to find the a feasible flow of maximum value.

### Solving the Maximum-Flow Problem

#### Cuts

A partition of the vertices of the (s,t)-network D into two sets, one containing s, called S, and the other containing t, called T, is called a cut. A cut can also be determined from, and is usually identified with, the set of arcs starting in S and ending in T. The capacity of a cut is the sum of the capacities on these arcs. A minimum cut is a cut with the minimum capacity.

Proposition 12.1.5: The value of any feasible flow is less than or equal to the capacity of any cut.

Corollary 12.1.7: If the value of some feasible flow equals the capacity of some cut, then the flow is a maximum flow and the cut is a minimum cut.

For any arc (i,j) of the (s,t)-network, its slack is defined as, sij = cij - xij.

A simple algorithm for finding a larger flow is to find a path from s to t such that all the arcs on the path have positive slack. We can add the smallest slack on these arcs to each xij of the path to obtain a larger flow. Unfortunately, this procedure does not always lead to a maximum flow.

Consider the underlying graph of the directed network. Given a path from s to t in this graph, orient the all the edges of the path from s to t. Now, compare this orientation with the orientation that these arcs have in the original network. If the orientation is the same for an arc, it will be called a forward arc, if the orientation is opposite, the arc is called a backward arc. A flow augmenting path in the (s,t)-network, is a path from s to t in the underlying graph, so that each forward arc has positive slack and each backward arc has a positive flow. Given a flow augmenting path, a larger flow is obtained by taking the smallest value of the positive slacks on forward arcs and the positive flows on backward arcs and adding this value to the flow on all forward arcs and subtracting it from the flow on all backward arcs of the path.

Theorem 12.2.3: A feasible flow is maximum if and only if there are no flow augmenting paths in the network.

Theorem 12.2.4 (Max Flow - Min Cut Theorem, Ford, Fulkerson and Elias): The value of the maximum flow of a directed network is the capacity of a minimum cut.

In order to use these theorems to find the maximum value of a flow in a network, we need an algorithm to find flow augmenting paths.

### Labeling Algorithm for Finding Flow Augmenting Paths

Some of the arcs of the (s,t)-network will be considered as members of two sets, F and B.

F consists of all arcs that have positive slack and B consists of all arcs that have a positive flow. Notice that these sets are not disjoint. A forward arc in F or a backward arc in B is called a usable arc.

The algorithm proceeds by growing a tree, starting at s, in the underlying graph, using only usable arcs as frontier edges. If the tree eventually includes t we have found a flow augmenting path, otherwise the tree vertices form one set of a minimum cut.

Algorithm:

Initialize the tree S = {s}, a counter i = 1, and label s with 0.
While S does not contain t do
a. Locate a usable arc as a frontier edge with the smallest labeled endpoint.
b. If w is the unlabeled endpoint, and v the labeled endpoint
Set back(w) = v.
Label w with i.
Let i := i + 1;
Put w in T.
If there is no usable arc, return the cut S, V-S.
If t is in S, the flow augmenting path is obtained from reading the vector back() starting at t.

For a given (s,t)-network, we can find the maximum flow by starting with all arcs having 0 flow, then finding a flow augmenting path and adjusting the flows accordingly. Repeat this until there are no further flow augmenting paths.

### Matchings, Transversals and Vertex Covers

A set M of edges in a graph G is called a matching of G if no two edges in set M have an endpoint in common. A maximum matching of graph G is a matching of G with the greatest number of edges while a maximal matching is a matching which is not contained in any larger matching. While any maximum matching is certainly maximal, the reverse is not generally true. In the above graph, {a}, {b,d}, and {c,e} are all maximal matchings, but only the last two are maximum matchings.

Job Assignment Problem revisited

Given a bipartite graph (X, Y) we can form an (s,t)-network as follows:
Add a vertex s, and join it with arcs going from s to each vertex in X. Orient all the edges in the bipartite graph from X to Y. Finally, add a vertex t, and join it with arcs from each vertex in Y to t. Give all of the arcs leaving s or entering t a capacity of 1, but the arcs between X and Y will get infinite capacity. Call this network N.

Notice that any feasible flow of N where all the flow values are integers (necessarily either 0 or 1), corresponds to a matching of the original graph (the matching consists of the edges which correspond to arcs between X and Y which have positive flow), and vice versa, any matching of the graph gives rise to a feasible flow. The value of the flow is the number of edges in the matching.

#### Vertex Covers

Let G be a graph and C a subset of the vertices of G. The set C is a vertex cover of graph G if every edge of G is incident with at least one vertex in C. A minimum vertex cover is a vertex cover with the least number of vertices. Proposition 12.4.5: Let M be a matching in a graph G, and let C be a vertex cover of G. Then |M| |C|.

Corollary 12.4.6: Let M be a matching and let C be a vertex cover of a graph G such that |M| = |C|. Then M is a maximum matching and C is a minimum vertex cover.

The converse of this corollary is not necessarily true, but it is true for bipartite graphs as we shall see below.

Since we have a relationship between matchings in a bipartite graph and flows in the corresponding network, we should consider what a vertex cover looks like in the network.

Let A be a subset of X and B a subset of Y. We will consider the set K = A B. Let S = {s} (X-A) B and T = {t} (Y-B) A, which is clearly a cut in the network. Theorem: K is a vertex covering of the graph if and only if (S,T) is a cut of the network of finite capacity.

Pf: Suppose (S,T) is a cut of finite capacity. Then no arcs from X to Y are in this cut, in particular there are none from X-A to Y-B in the cut. So, all arcs from A go to Y-B, and all arcs from X-A go to B. Therefore, every edge of the graph has one vertex in A or one vertex in B, and so, K is a covering. Note that the arcs in the cut that start at s all go to A, and those that end at t all start in B, each having capacity 1, so the capacity of the cut is |A B|.

Now, suppose that K is a vertex covering of the graph. Let A be the intersection of K with X and B the intersection of K with Y. Form S and T as before. Consider an arc from a vertex in S to one in T. If this arc starts at s, it must go to A (and so, has capacity 1). If it starts in X-A, it must go to B since K is a vertex covering, so such an arc does not go to T. If it starts in B, then it must go to t, and so, has capacity 1. Thus, all arcs from S to T have finite capacity, so the cut (S, T) has finite capacity.

Theorem 12.4.7: (König, 1931) Let G be a bipartite graph. Then the size of a maximum matching equals the size of a minimum vertex cover.

Pf: Consider the associated network of the bipartite graph. Change the infinite capacities to 2's, this will not change any flows. All capacities are integers, so the maximum flow exists and will have integer values. The value of this flow is the number of edges in a maximum matching, call it n. By the Ford-Fulkerson theorem, n is the minimum capacity of any (S, T) cut. The trivial cut, S = {s}, has finite capacity, so the minimum will have to be finite. By the previous theorem, any cut with the minimum capacity corresponds to a covering with |A B| = n. But now, there exists a cover with n vertices and a matching with n edges, so the cover must be a minimum cover.

An interesting application of this result is:

Theorem 12.4.8: (König-Egerváry, 1931) Let A be a 0-1 matrix. The the maximum number of 1's in the matrix, no two of which lie in the same row or column, is equal to the minimum number of rows and columns that together contain all the 1's in A.