bidirectional_shortest_path(G, source, target)[source]¶
Returns a list of nodes in a shortest path between source and target.
- G (NetworkX graph)
- source (node label) – starting node for path
- target (node label) – ending node for path
path – List of nodes in a path from source to target.
NetworkXNoPath– If no path exists between source and target.
This algorithm is used by shortest_path(G, source, target).