Return the shortest path length between the source and target.
Raise an exception if no path exists.
Parameters: | G : NetworkX graph source : node label
target : node label
|
---|
Notes
G is treated as an unweighted graph. For weighted graphs see dijkstra_path_length.
Examples
>>> G=nx.path_graph(5)
>>> print nx.shortest_path_length(G,0,4)
4