|
Calling Sequence
|
|
MaxFlow(G, s, t)
|
|
Parameters
|
|
G
|
-
|
weighted graph
|
s
|
-
|
vertex of the graph (source)
|
t
|
-
|
vertex of the graph (sink)
|
|
|
|
|
Description
|
|
•
|
The MaxFlow command solves the s to t maximum flow problem using edge weights of G as the flow capacities between vertices. If G is not a weighted graph then every edge is taken to have a capacity of 1. If G is a multigraph every edge is taken to have a capacity equal to its multiplicity. An undirected Graph is treated as a directed graph with edges in both directions, but the output flow matrix will be directional.
|
•
|
This command returns two things: the optimal value for the maximum flow from the vertex s to the vertex t and a sparse matrix of the flows at each edge which achieve that optimal flow. The maximum flow value is unique, while the flow matrix may be one of several possible flows that achieve that maximum.
|
•
|
MaxFlow uses the Push-Relabel (Push-Preflow) algorithm of Goldberg et al. (see Introduction to Algorithms, Cormen, Leiserson, Rivest, 2nd edition). The complexity is where is the number of vertices of G and is the number of edges.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (4) |
The values in F can be used to show the flows on the network N
>
|
|
| (5) |
>
|
|
>
|
|
The input to MaxFlow does not have to be a network, or even be a weighted graph
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
|
|
References
|
|
|
Cormen, Thomas H., Leiserson, Charles E., Rivest, Ronald L., and Stein, Clifford. Introduction to Algorithms, 2nd edition. Cambridge, Mass., MIT Press, 2001.
|
|
|
Compatibility
|
|
•
|
The GraphTheory[MaxFlow] command was updated in Maple 2024.
|
|
|
|