Lakaw.

A* vs Dijkstra pathfinding visualizer
Speed 60 cells/s
A* Manhattan-distance heuristic
Visited
0
Path
Cost
Iterations
Dijkstra No heuristic (h = 0)
Visited
0
Path
Cost
Iterations
Start
Goal
Wall
A* visited
Dijkstra visited
Frontier (open set)
Final path

A* is a best-first search that expands the node with the lowest f = g + h — the cost-so-far (g) plus an admissible heuristic estimate to the goal (h). With an admissible heuristic it is guaranteed to find the optimal path while exploring far fewer nodes than uninformed search.

Dijkstra is the special case where h = 0 — a uniform-cost search that radiates outward equally in every direction. It is optimal but explores every node cheaper than the goal, which is why it visits so many more cells.

Why the heuristic matters: h steers the search toward the goal, pruning the half of the search space Dijkstra wastes exploring away from it. A bigger (but still admissible) heuristic prunes more without sacrificing optimality.

Heat map colors each visited cell by its g score (distance from the start) — cool blue is near the start, warm orange is far.

low g
high g

Frontier (dashed, pulsing) marks cells currently in the open set — discovered but not yet committed — showing the live edge of the search.

Keyboard shortcuts

Space play / pause S step R reset M random maze C clear walls H heat map F frontier 16 presets