# CMPSCI 311: Theory of Algorithms

### Min Cuts and Max Flows

Questions are in black, answers in blue.

A flow diagram is a labeled directed graph like this example which I have gratefully lifted from

`www.ms.ic.ac.uk/jeb/or/netflow.html`:

``````
3          5            3
------>(2)-------->(5)------
/        ^ <------   |       \
/        1|       4\  |2       \
/   2      |    1    \ v    1    >
>(1)-------->(3)-------->(6)-------->((8))
\          ^           |         >
\         |2          |2       /
\   3    |     2     v      5/
------>(4)-------->(7)------
``````

The edge labels represent the capacity of the edge. A flow is an assignment of an amount, from zero to the capacity, to each edge that has zero net flow in or out of each intermediate vertex. The max-flow problem is to input the diagram and output a flow with the maximum amount leaving the source node and entering the sink node.

A cut is a set of vertices including the source but not the sink. The capacity of a cut is the total capacity of all edges from vertices in the cut to those not in it. The min-cut is the cut of smallest size. The min-cut max-flow theorem says that the min-cut and max-flow always have the same size.

• Question 1: Find the min-cut and the max-flow in the example above.

The vertex set {1,3,4} forms a cut of size 7, because there are four edges out of it: (1,2) of size 3, (3,2) of size 1, (3,6) of size 1, and (4,7) of size 2. There is a flow of size 7 as well:

``````
(1,2) has flow 3
(1,3) has flow 2
(1,4) has flow 2       #1 has 3+2+2 = 7 out
(2,5) has flow 4       #2 has 3+1-4 = 0
(3,2) has flow 1
(3,6) has flow 1       #3 has 2-1-1+0 = 0
(4,3) has flow 0
(4,7) has flow 2       #4 has 2-0-2 = 0
(5,6) has flow 1
(5,8) has flow 3       #5 has 4-1-3 = 0
(6,2) has flow 0
(6,7) has flow 1
(6,8) has flow 1       #6 has 1+1-0-1-1 = 0
(7,8) has flow 3       #7 has 2-2 = 0
#8 has 3+1+3 = 7 in
``````

• Question 2: How many cuts are there in a flow diagram with \$n\$ vertices? Is brute-force search for the min-cut a good general way to find the max-flow?

Any set of vertices containing the source and not containing the sink forms a cut. So we may union the source with an arbitrary subset of the n-2 intermediate vertices, and there are 2n-2 of these subsets. As n gets large brute-force search will quickly become prohibitive, though one might imagine searching 64 sets in the example.

• Question 3: Argue that the max-flow cannot have greater size than the min-cut.

The total net flow across the cut is equal to the size of the flow, because the side with the source has that much more flow created than destroyed, and the side with the sink has that much less. The net flow across the cut is no larger than the flow along edges from the source side to the sink side (flows in the other direction reduce the net flow). This must be bounded by the sum of the sizes of the capacities of these edges, which by definition is the size of the cut.

• Question 4: Argue that the min-cut cannot have greater size than the max-flow. (Hint: Assume we have a flow that is smaller than every cut. Prove that there is an augmenting path -- a path from the source to the sink that uses some positive amount of excess capacity on each edge. Then argue that this shows the given flow is not maximum.)

Assume we are given a flow with size f and that every cut has size at least f+a where a is a positive number. We will construct an augmenting path. Consider the graph of unsaturated edges, which are those edges that are not fully used by the flow. If this edge did not have a path from s to t, then there would be a cut C made up of those edges reachable from s on this graph, and all the edges of this cut would be fully used by the flow. But this is impossible since the flow has size f and the cut has capacity at least f+a.