## Graph Theory Lecture Notes 18

### Network Flows

Given a directed network 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), a second set of non-negative real numbers, xij, assigned to the arcs is called an (s, t) - feasible flow if
0 <= xij <= cij for all arcs, and
{\sum}j xij = {\sum}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 = {\sum}j xjt - {\sum}j xtj and vs = {\sum}j xjs - {\sum}j xsj .

Now, if we sum over all the vertices i, we get:
{\sum}i ( {\sum}j xij - {\sum}j xji ) = vt + vs .

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.

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

### Cuts

A partition of the vertices of the directed 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.

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

Theorem: 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 directed network, the slack, 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 chain from s to t in this graph, orient the all the edges of the chain 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 chain in the directed network, is a chain 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 chain, a larger flow is obtained by taking the smallest value of the positve slacks on forward arcs and the positve 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 chain.

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

Theorem (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 chains.

### Labeling Algorithm for Finding Flow Augmenting Chains

Some of the arcs of the directed 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.

The algorithm proceeds by scanning vertices and labeling some of them in the scanning process. When all the labeled vertices have been scanned, the algorithm stops. If t has been labeled, then an augmenting chain can be found, otherwise there is no augmenting chain.

Initially, the vertex s is labeled with the label (-).

The algorithm proceeds as follows:
Find a labeled, but unscanned vertex, call it i.

Scan i, meaning

1. for all arcs (i,j), if (i,j) is in F and j is unlabeled, then label j with (i+).
2. for all arcs (j,i), if (j,i) is in B and j is unlabeled, then label j with (i-).
Repeat until all labeled vertices have been scanned, or t has been labeled.

If t is labeled, then the augmenting chain is determined by starting with t and following the labels back until you get to s. The +'s and -'s show whether the arc is a forward or backward arc.

### Flows and Matchings in Bipartite Graphs

Given a bipartite graph (X, Y) we can form a directed network as follows:
Add a vertex s, and join it with arcs going from s to each vertex in X. Give all of these arcs a capacity of 1. Orient all the edges in the bipartite graph from X to Y. Give all of these arcs an infinite capacity. Finally, add a vertex t, and join it with arcs from each vertex in Y to t. Give all of these arcs a capacity of 1. Call this directed 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.

Since we have a direct relation between flows and matchings, we might consider what a covering of the graph corresponds to in the directed network.

Let A be a subset of X and B a subset of Y. We will consider the set K = A U B. Let S = {s} U (X-A) U B and T = {t} U (Y-B) U A, which is clearly a cut in the network.

Theorem: K is a 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 U B|.

Now, suppose that K is a 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 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.

Finally, we can now prove the theorem that stated that for a bipartite graph, the size of a maximum matching equals the size of a minimum 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 U 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.