FordFulkerson Class |
The FordFulkerson class represents a data type for computing a Maximum st-flow and Minimum st-cut in a flow network.
This implementation uses the Ford-Fulkerson algorithm with the Shortest augmenting path heuristic. The constructor takes time proportional to E V (E + V) in the worst case and extra space (not including the network) proportional to V, where V is the number of vertices and E is the number of edges. In practice, the algorithm will run much faster. Afterwards, the inCut() and value() methods take constant time.
If the capacities and initial flow values are all integers, then this implementation guarantees to compute an integer-valued maximum flow. If the capacities and floating-point numbers, then floating-point roundoff error can accumulate.
Namespace: Algs4Net
public class FordFulkerson
The FordFulkerson type exposes the following members.
Name | Description | |
---|---|---|
![]() | FordFulkerson |
Compute a maximum flow and minimum cut in the network G
from vertex s to vertex t. |
Name | Description | |
---|---|---|
![]() | InCut |
Returns true if the specified vertex is on the s side of the mincut. |
![]() ![]() | MainTest |
Demo test the FordFulkerson data type. |
For additional documentation, see Section 6.4 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class FordFulkerson implementation by the respective authors.