pub fn shortest_path<N, E, Ix>(
graph: &Graph<N, E, Ix>,
source: &N,
target: &N,
) -> Result<Option<Path<N, E>>>
Expand description
Finds the shortest path between source and target nodes using Dijkstra’s algorithm
§Arguments
graph
- The graph to search insource
- The source nodetarget
- The target node
§Returns
Ok(Some(Path))
- If a path existsOk(None)
- If no path existsErr(GraphError)
- If the source or target node is not in the graph