Skip to content

Commit

Permalink
Fix the search object's name
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzakat authored Sep 26, 2022
1 parent 8555076 commit 8d5bc0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions algs4/breadth_first_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ def path_to(self, v):
for i in range(E):
v, w = f.readline().split()
g.add_edge(v, w)
dfs = BreadthFirstPaths(g, s)
bfs = BreadthFirstPaths(g, s)
for v in range(g.V):
if dfs.has_path_to(v):
if bfs.has_path_to(v):
print("%d to %d: " % (s, v), end='')
for x in dfs.path_to(v):
for x in bfs.path_to(v):
if x == s:
print(x, end='')
else:
Expand Down

0 comments on commit 8d5bc0b

Please sign in to comment.