shortest_path(graph,
source)
|
|
Return the shortest path distance between source and all other nodes
using Dijkstra's algorithm.
- Parameters:
graph (graph) - Graph.
source (node) - Node from which to start the search.
- Returns: tuple
- A tuple containing two dictionaries, each keyed by target nodes.
-
Shortest path spanning tree (each key points to previous node
in the shortest path transversal)
-
Shortest distance from given source to each target node
Inaccessible target nodes do not appear in either
dictionary.
Attention:
All weights must be nonnegative.
|