NetworkX

Previous topic

networkx.bidirectional_shortest_path

Next topic

networkx.single_source_shortest_path_length

Quick search

networkx.single_source_shortest_path

single_source_shortest_path(G, source, cutoff=None)

Return list of nodes in a shortest path between source and all other nodes reachable from source.

There may be more than one shortest path between the source and target nodes - this routine returns only one.

cutoff is optional integer depth to stop the search - only paths of length <= cutoff are returned.

See also shortest_path and bidirectional_shortest_path.