Return a list of nodes in a shortest path between source and target.
There may be more than one shortest path. This returns only one.
Parameters: | G : NetworkX graph source : node label
target : node label
|
---|
Examples
>>> G=nx.path_graph(5)
>>> print nx.shortest_path(G,0,4)
[0, 1, 2, 3, 4]