parent map

A dict recording, for each vertex a search reaches, the vertex it was reached from, so the path can be rebuilt afterwards.

In more detail

To reconstruct a path, start at the destination and follow parents back to the source, then reverse the list. BFS and Dijkstra's algorithm both fill one in as they run.

Related terms

Taught in

References