Returns the shortest path from source to target in a weighted graph G.
Parameters: | G : NetworkX graph source : node
target : node
|
---|---|
Returns: | path : list
|
See also
Notes
Uses a bidirectional version of Dijkstra’s algorithm. Edge weight attributes must be numerical.
Examples
>>> G=nx.path_graph(5)
>>> print nx.dijkstra_path(G,0,4)
[0, 1, 2, 3, 4]