0 <= x

{\sum}

(where it is understood that if there is no arc (i, j) then x

At s and t, the conservation law (the second condition above) does not hold, and we define

v_{t} = {\sum}_{j} x_{jt} - {\sum}_{j} x_{tj} and v_{s} = {\sum}_{j} x_{js} - {\sum}_{j} x_{sj} .

Now, if we sum over all the vertices i, we get:

{\sum}_{i} ( {\sum}_{j} x_{ij} - {\sum}_{j} x_{ji} ) = v_{t} + v_{s} .

But the left hand side of this equation is 0, so v_{s} = -v_{t} 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.

**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*, s_{ij} = c_{ij} - x_{ij}.

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 x_{ij} 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.

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

- for all arcs (i,j), if (i,j) is in F and j is unlabeled, then label j with (i+).
- for all arcs (j,i), if (j,i) is in B and j is unlabeled, then label j with (i-).

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.

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.