Is there any restriction on selecting path for the MaxFlow problem in datastructure?

141 Views Asked by At

In the following max flow problem, the algorithm could choose S-A-D-T path first. In that case, the algorithm will not see any more augmenting paths so it will produce 4 as the answer to the maximum flow. However, if the algorithm would select any other path first, then it would see that the max flow becomes five.

My example graph for maximum flow problem

1

There are 1 best solutions below

0
Palo On

It seems you did not notice that Ford-Fulkerson algorithm updates the residual graph in two ways:

  1. subtract path flow from all edges along the selected path
  2. add path flow along the reverse edges of the selected path

Therefore after you have selected the S-A-D-T path with flow 3, the residual graph will now contain an augmenting path S-B-D-A-C-T with flow 2, thus reaching a total flow of 5. Flow along the reverse edges just cancels the existing flow and thus only flow of 2 will remain from A to D.