MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / retrace_path

Method retrace_path

graphs/bidirectional_a_star.py:158–168  ·  view source on GitHub ↗

Retrace the path from parents to parents until start node

(self, node: Node | None)

Source from the content-addressed store, hash-verified

156 return successors
157
158 def retrace_path(self, node: Node | None) -> list[TPosition]:
159 """
160 Retrace the path from parents to parents until start node
161 """
162 current_node = node
163 path = []
164 while current_node is not None:
165 path.append((current_node.pos_y, current_node.pos_x))
166 current_node = current_node.parent
167 path.reverse()
168 return path
169
170
171class BidirectionalAStar:

Callers 2

searchMethod · 0.95

Calls 2

reverseMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected