Returns the shortest path length from source to target in a weighted graph G.
Raise an exception if no path exists.
Parameters: | G : NetworkX graph, weighted source : node label
target : node label
|
---|
See also
Notes
Edge data must be numerical values for Graph and DiGraphs.
Examples
>>> G=nx.path_graph(5) # a weighted graph by default
>>> print nx.dijkstra_path_length(G,0,4)
4