Function pathfinding::edmondskarp_matrix
[−]
[src]
pub fn edmondskarp_matrix<C>(
source: usize,
sink: usize,
capacities: &Array2<C>
) -> (Vec<((usize, usize), C)>, C) where
C: Zero + Signed + Bounded + PartialOrd + Copy,
Compute the maximum flow that can go through a directed graph using the Edmonds Karp algorithm. The graph is described via an adjacency matrix.
A maximum flow going from source
to sink
will be computed, and the various
flow values along with the total will be returned.
source
is the source node (the origin of the flow).sink
is the sink node (the target of the flow).capacities
is a matrix describing the capacities.capacities[i][j]
represents the non-negative capacity fromi
toj
.
Note that the capacity type C must be signed as the algorithm has to deal with negative residual capacities.
Panics
This function will panic if the capacities
matrix is not a square matrix.