Returns the shortest path length from source to target in a weighted graph G.
Parameters: | G : NetworkX graph, weighted source : node label
target : node label
|
---|---|
Returns: | length : number
|
Raises: | NetworkXError :
|
See also
Notes
Edge weight attributes must be numerical.
Examples
>>> G=nx.path_graph(5) # a weighted graph by default
>>> print nx.dijkstra_path_length(G,0,4)
4