Why it matters

A* is workhorse pathfinding. Understanding shapes many search algorithms.

Advertisement

The architecture

Open set: PQ by f.

Closed set: visited.

Relax neighbors with new g.

A* search flowOpen PQby f = g + hExpand min-f nodecheck goalRelax neighborsupdate g + parentAdmissible h never overestimates; consistent h obeys triangle inequality
A*.
Advertisement

How it works end to end

Heuristic h: distance estimate.

Manhattan for grids; Euclidean; landmarks.

Reconstruct path via parents.

Weighted A* (w * h) speed trade-off.