Finds the maximum flow of a directed graph, given a source and destination node.
MaxFlow(
arcSources,
arcTargets,
arcCapacities,
sourceNode,
destNode,
numNodes,
algorithm = "Preflow"
)
A named list containing three entries: 1) "flows": a vector corresponding to the flows of arcs in the graph, 2) "cut_values": a vector of cut-values of the graph's nodes, and 3) "cost": the total cost of the flows in the graph, i.e. the maxflow value.
Vector corresponding to the source nodes of a graph's edges
Vector corresponding to the destination nodes of a graph's edges
Vector corresponding to the capacities of nodes of a graph's edges
The source node
The destination node
The number of nodes in the graph
Choices of algorithm include "Preflow" and "EdmondsKarp". "Preflow" is the default.
For details on LEMON's implementation, including differences between the algorithms, see https://lemon.cs.elte.hu/pub/doc/1.3.1/a00611.html.