Dijkstra and A*

Draw walls or move the endpoints, then switch algorithms to compare how the search spreads across the same grid.

A* · expanded 0 · searching

Click/drag to draw walls. Drag the square (start) or ring (goal) to move them.

What you are looking at

Walls
Cells the search cannot traverse.
Start and goal
The movable endpoints of the search.
Expansion front
The growing area explored by the current algorithm.

Try this

  1. Switch between Dijkstra and A* to see A* head more directly toward the goal.
  2. Draw a wall with a gap across the route to see the search run again and look for a way through.

Key idea

Dijkstra expands from the cheapest known position. A* also estimates the remaining distance to guide its search.