summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanshika Mishra <74042272+vanshika230@users.noreply.github.com>2023-03-29 22:01:30 +0530
committerGitHub <noreply@github.com>2023-03-29 22:01:30 +0530
commitfbf8f5dc1b2f3a5a10f0f8cc0cc5578d4f08e3ef (patch)
tree0f5d329184f54e8b57e8a50acde1b38bba63d02a
parentfc79e238b304544ee432bbb7fea050675b95163e (diff)
downloadnetworkx-fbf8f5dc1b2f3a5a10f0f8cc0cc5578d4f08e3ef.tar.gz
Added Docstring Example for Bidirectional Shortest Path (#6570)
* Docstring Example for Bidirectional Shortest Path * output correction * graph simplified * retrigger checks
-rw-r--r--networkx/algorithms/shortest_paths/unweighted.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/networkx/algorithms/shortest_paths/unweighted.py b/networkx/algorithms/shortest_paths/unweighted.py
index 3d304184..7a964f0f 100644
--- a/networkx/algorithms/shortest_paths/unweighted.py
+++ b/networkx/algorithms/shortest_paths/unweighted.py
@@ -216,6 +216,13 @@ def bidirectional_shortest_path(G, source, target):
NetworkXNoPath
If no path exists between source and target.
+ Examples
+ --------
+ >>> G = nx.Graph()
+ >>> nx.add_path(G, [0, 1, 2, 3, 0, 4, 5, 6, 7, 4])
+ >>> nx.bidirectional_shortest_path(G, 2, 6)
+ [2, 1, 0, 4, 5, 6]
+
See Also
--------
shortest_path