pub fn path_reconstruct(prev: &[Option<usize>], end: usize) -> Vec<usize>Expand description
Reconstructs the path to end from a prev array produced by a shortest-path algorithm.
Returns the path as a vector of node indices from source to end.
Returns an empty vector if end is unreachable (i.e., prev[end] chain doesn’t reach a node
with prev[node] == None that was the source).