Skip to content

Commit 4b350c3

Browse files
Update bidirectional_search.py
1 parent 8b309e6 commit 4b350c3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

graphs/bidirectional_search.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def bidirectional_search(
4343
... 10: [6, 11],
4444
... 11: [7, 8, 9, 10],
4545
... }
46-
>>> bidirectional_search(graph, 0, 11)
46+
>>> bidirectional_search(graph=graph, start=0, goal=11)
4747
[0, 1, 3, 7, 11]
48-
>>> bidirectional_search(graph, 5, 5)
48+
>>> bidirectional_search(graph=graph, start=5, goal=5)
4949
[5]
5050
>>> disconnected_graph = {
5151
... 0: [1, 2],
@@ -54,7 +54,7 @@ def bidirectional_search(
5454
... 3: [4],
5555
... 4: [3],
5656
... }
57-
>>> bidirectional_search(disconnected_graph, 0, 3) is None
57+
>>> bidirectional_search(graph=disconnected_graph, start=0, goal=3) is None
5858
True
5959
"""
6060
if start == goal:
@@ -155,12 +155,12 @@ def main() -> None:
155155

156156
# Test case 1: Path exists
157157
start, goal = 0, 11
158-
path = bidirectional_search(example_graph, start, goal)
158+
path = bidirectional_search(graph=example_graph, start=start, goal=goal)
159159
print(f"Path from {start} to {goal}: {path}")
160160

161161
# Test case 2: Start and goal are the same
162162
start, goal = 5, 5
163-
path = bidirectional_search(example_graph, start, goal)
163+
path = bidirectional_search(graph=example_graph, start=start, goal=goal)
164164
print(f"Path from {start} to {goal}: {path}")
165165

166166
# Test case 3: No path exists (disconnected graph)
@@ -172,7 +172,7 @@ def main() -> None:
172172
4: [3],
173173
}
174174
start, goal = 0, 3
175-
path = bidirectional_search(disconnected_graph, start, goal)
175+
path = bidirectional_search(graph=disconnected_graph, start=start, goal=goal)
176176
print(f"Path from {start} to {goal}: {path}")
177177

178178

0 commit comments

Comments
 (0)