pub fn floyd_warshall<V: Eq + Hash + Clone + Debug>(graph: &Graph<V>) -> Expr
Expand description
Finds all-pairs shortest paths using the Floyd-Warshall algorithm.
The Floyd-Warshall algorithm is an all-pairs shortest path algorithm that works for both directed and undirected graphs with non-negative or negative edge weights (but no negative cycles).
§Arguments
graph
- The graph to analyze.
§Returns
An Expr::Matrix
where M[i][j]
is the shortest distance from node i
to node j
.