pub fn floyd_warshall_with_paths<G>(
graph: &G,
) -> Result<(Vec<Vec<f64>>, Vec<Vec<Option<NodeId>>>), GraphError>Expand description
Returns the shortest path (as a sequence of NodeIds) between two nodes
using a pre-computed Floyd-Warshall distance matrix and next-hop table.
Call floyd_warshall_with_paths instead of floyd_warshall if you
need path reconstruction.
§Examples
use graph_core::{AdjacencyList, Graph};
use graph_shortest_path::floyd_warshall::{floyd_warshall_with_paths, reconstruct_fw_path};
let mut g: AdjacencyList<()> = AdjacencyList::directed();
let a = g.add_node(());
let b = g.add_node(());
let c = g.add_node(());
g.add_edge(a, b, 1.0).unwrap();
g.add_edge(b, c, 1.0).unwrap();
let (dist, next) = floyd_warshall_with_paths(&g).unwrap();
assert_eq!(dist[0][2], 2.0);
// Reconstruct path a → c
let path = reconstruct_fw_path(&next, a, c);
assert_eq!(path, Some(vec![a, b, c]));