Return list of nodes in a shortest path between source and all other nodes reachable from source for a weighted graph.
Returns a dictionary of shortest path lengths keyed by target.
Parameters: | G : NetworkX graph source : node label
|
---|
See also
Notes
Edge data must be numerical values for Graph and DiGraphs.
Examples
>>> G=nx.path_graph(5)
>>> path=nx.single_source_dijkstra_path(G,0)
>>> path[4]
[0, 1, 2, 3, 4]