pub fn shortest_path<N, E, Ix>(
graph: &Graph<N, E, Ix>,
source: &N,
target: &N,
) -> Result<Option<Path<N, E>>>
👎Deprecated since 0.1.0-beta.2: Use
dijkstra_path
for future compatibility. This function will return PathResult in v1.0Expand 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
§Time Complexity
O((V + E) log V) where V is the number of vertices and E is the number of edges. Using a binary heap (min-heap) priority queue implementation.
§Space Complexity
O(V) for the distance array and predecessor tracking.
§Deprecation Notice
This function will be updated in v1.0 to return a standardized PathResult
type
that provides more detailed information about the path and search process.
The current API will remain available but deprecated.