Method
find_path_dfs
(
self, start: str, end: str, path: Optional[List[str]] = None
)
Source from the content-addressed store, hash-verified
| 12 | self.graph = graph |
| 13 | |
| 14 | def find_path_dfs( |
| 15 | self, start: str, end: str, path: Optional[List[str]] = None |
| 16 | ) -> Optional[List[str]]: |
| 17 | path = path or [] |
| 18 | |
| 19 | path.append(start) |
| 20 | if start == end: |
| 21 | return path |
| 22 | for node in self.graph.get(start, []): |
| 23 | if node not in path: |
| 24 | newpath = self.find_path_dfs(node, end, path[:]) |
| 25 | if newpath: |
| 26 | return newpath |
| 27 | |
| 28 | def find_all_paths_dfs( |
| 29 | self, start: str, end: str, path: Optional[List[str]] = None |
Callers
nothing calls this directly
Tested by
no test coverage detected