@@ -17,7 +17,7 @@ def find_path_dfs(self, start, end, path=None):
17
17
return path
18
18
for node in self .graph .get (start , []):
19
19
if node not in path :
20
- newpath = self .find_path (node , end , path [:])
20
+ newpath = self .find_path_dfs (node , end , path [:])
21
21
if newpath :
22
22
return newpath
23
23
@@ -29,7 +29,7 @@ def find_all_paths_dfs(self, start, end, path=None):
29
29
paths = []
30
30
for node in self .graph .get (start , []):
31
31
if node not in path :
32
- newpaths = self .find_all_path (node , end , path [:])
32
+ newpaths = self .find_all_paths_dfs (node , end , path [:])
33
33
paths .extend (newpaths )
34
34
return paths
35
35
@@ -42,7 +42,7 @@ def find_shortest_path_dfs(self, start, end, path=None):
42
42
shortest = None
43
43
for node in self .graph .get (start , []):
44
44
if node not in path :
45
- newpath = self .find_shortest_path (node , end , path [:])
45
+ newpath = self .find_shortest_path_dfs (node , end , path [:])
46
46
if newpath :
47
47
if not shortest or len (newpath ) < len (shortest ):
48
48
shortest = newpath
@@ -87,7 +87,7 @@ def main():
87
87
>>> print(graph1.find_shortest_path_dfs('A', 'D'))
88
88
['A', 'B', 'D']
89
89
>>> print(graph1.find_shortest_path_bfs('A', 'D'))
90
- ['A', 'B', 'C ']
90
+ ['A', 'B', 'D ']
91
91
"""
92
92
93
93
0 commit comments