# CMPSCI 311: Theory of Algorithms

### Finding Maximum Flows

Please answer the questions during the discussion period.

Our analysis of max flows and min cuts last week leads to an algorithm (called the Ford-Fulkerson method) for finding max flows in a flow diagram. The residual graph for a flow is the flow diagram that labels each edge with the capacity in each direction, if any, not used by the flow. For example, if an edge can take from 0 to 6 units in one direction and 4 are currently going across it, the residual graph shows 2 units in the forward direction and 4 in the backward direction.

An augmenting path is a path of non-zero edges in the residual graph. If there is an augmenting path, we can increase the flow along it by an amount equal to its lowest-labeled edge. (If there is no augmenting path, then there is a cut equal to the flow capacity and the flow is maximum.) The Ford-Fulkerson method is to keep finding an augmenting path and increasing the flow as long as you can. It always works on integer flows, but not always quickly:

``````
1000       1000
------>(2)------
/        ^       \
/         |        \
/          |         v
>(1)         1|        ((4))
\          |         ^
\         |        /
\  1000  |  1000 /
------>(3)------

``````

• Question 1: Consider the flow diagram above. Explain how starting from a zero flow, we can find 2000 augmenting paths in succession, of capacity 1 each, before finding the optimal flow of 2000 from vertex 1 to vertex 4.

• Question 2: The Edmonds-Karp algorithm is to employ Ford-Fulkerson but always use an augmenting path that contains as few edges as possible. How do you find such a path, and how long does it take?

• Question 3: An augmenting path fills an edge if after the flow is increased by the path, the edge is at its capacity. In [CLRS] they prove that using Edmonds-Karp, no edge can be filled more than n times before the flow is maximum (n is the number of vertices and e the number of edges). Using this fact and the answer to Question 2, find a big-O bound on the running time of Edmonds-Karp.

• Question 4: The maximum matching problem is to input a bipartite graph and find a subset of the edges such that (a) no two edges share a vertex, and (b) the subset is as large as possible. Explain how to reduce the maximum matching problem to the max-flow problem.

Last modified 1 December 2003