There is more material in the following Wikipedia pages. As with a lot of Wikipedia, the presentation is too dry and mathematical, so I don't require that you read it, but I provide links to it anyway:
It's pretty easy to eyeball this graph and see that it has a maximum flow of 1000. The two paths are S->A->T and S->B->T. However, if you try to determine the maximum flow using augmenting paths, and you choose the wrong path at each step, it will take 1000 iterations of the algorithm. To illustrate, suppose that the first path you choose is S->A->B->T with a flow of one. When you process this path through the residual graph, you end up with the following:
At the next iteration, suppose you choose the path S->B->A->T, again with a flow of one. The residual looks as follows:
You continue in that vein. The pictures below show how you choose S->A->B->T again, and then S->B->A->T, again:
Each time, you add one unit of flow, which means that this will take 1000 iterations. Although this example is unlikely to happen in practice, it demonstrates a need for a smart determination of paths. Below, we will present three determinations. In the third set of lecture notes, we will evaluate these experimentally on a set of graphs.
When we perform a greedy DFS on this graph, we start with edge from A to B since its flow is greater than the edge from A to D. There is only one edge leaving B. When we read node C, we traverse the edge to E, since it has the maximum flow of C's three edges. Finally, E goes to G. Thus, the first path we get is A->B->C->E->G with a flow of one.
Below, I show the flow and residual graphs when this path is processed. In the residual, the edges whose flow is reduced are colored red, and the reverse edges are colored green:
Flow | Residual |
The next greedy path through the residual is A->B->C->D->F->G, with a flow of two:
Flow | Residual |
The last path is A->D->F->G with a flow of three. Here are the final flow and residual graphs:
Flow | Residual |
The modification works as follows. When processing a node, again the algorithm traverses the node's edges, and if paths with more flow to any other nodes are discovered, then the nodes are updated. At each step, the node with the maximum flow is processed next.
We'll work an example with the same graph as above:
The maximum flow path here is A->D->F->G with a flow of three:
Flow | Residual |
The next maximum flow path is A->B->C->D->F->G with a flow of 2:
Flow | Residual |
The final path is A->B->C->E->G with a flow of one:
Flow | Residual |
Again, we use the same graph as an example:
There are two minimum hop paths: A->D->E->G and A->D->F->G. Suppose we process the former of these, with a flow of one:
Flow | Residual |
Now, there is only one minimum hop path through the residual: A->D->F->G, with a flow of two:
Flow | Residual |
At this point, there are only two paths through the residual: A->B->C->D->F->G and A->B->C->E->D->F->G. The first of these has fewer hops, so we process it. It has a flow of two:
Flow | Residual |
The final path through the residual is A->B->C->E->D->F->G with a flow of one. When we process it, we get the same flow and residual graphs as the other two algorithms:
Flow | Residual |
One thing that you should remember about network flow is that it is quite a bit slower than all of the other graph algorithms we've studied so far.
Now, in the original graph, we divide our nodes into two sets: the set determined above, and all of the remaining nodes. They are drawn purple and yellow in the original graph below:
The minimum cut is composed of all the edges that go from the source set to the sink set. These are edges AD, CD and EG, which I've drawn in red above. The sum of their capacities equals the maximum flow of six.