MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / retrace_path

Method retrace_path

graphs/greedy_best_first.py:168–178  ·  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

166 ]
167
168 def retrace_path(self, node: Node | None) -> Path:
169 """
170 Retrace the path from parents to parents until start node
171 """
172 current_node = node
173 path = []
174 while current_node is not None:
175 path.append((current_node.pos_y, current_node.pos_x))
176 current_node = current_node.parent
177 path.reverse()
178 return path
179
180
181if __name__ == "__main__":

Callers 1

searchMethod · 0.95

Calls 2

reverseMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected