liveBook · Manning

Parent pointer

As explained in Grokking Algorithms, Second Edition

A parent pointer is a recorded predecessor node that identifies the preceding step in a path to another node.

A parent pointer records which node led to another node along the best path found so far. In a table, the parent column sits beside each node’s cost and changes whenever a cheaper route is discovered. section 9.3

Following a trade path

When the poster is processed in Dijkstra’s algorithm, it becomes the parent of the bass guitar and drum set as their costs are established. To recover the final route, follow each node’s parent backward until reaching the starting node. section 9.3

How Grokking Algorithms, Second Edition covers it

How deep it goes
Defines parent assignment during neighbor updates and connects it to reconstructing the final path.
Examples
Uses a trading graph in which the poster becomes the parent of the bass guitar and drum set.
What it assumes
Assumes familiarity with graph nodes, edges, costs, and Dijkstra’s four-step process.
What you can do after
Apply it to track predecessors and recover a route after calculating costs with Dijkstra’s algorithm.
How it connects
Connects parent pointers with Dijkstra’s algorithm, graphs, weighted edges, node costs, and shortest paths.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Algorithms, Second Edition. The section links point to the parts of the book it draws on.