A* Search vs Dijkstra
Same maze, same speed, first to the exit wins. On this maze A* Search gets there first and turns gold.
The numbers
- A* explored
- 2,417 cells
- A* path
- 301 steps
- Dijkstra explored
- 2,527 cells
- Dijkstra path
- 301 steps
A* Search
A* search explores the cells that look closest to the exit first, while still guaranteeing the shortest path. More on A* Search.
Dijkstra
Dijkstra's algorithm always expands the cell with the lowest distance from the start, so it finds the shortest path. More on Dijkstra.
FAQ
Which is faster in a maze, A* Search or Dijkstra?
On this maze A* Search reached the exit first, after exploring 2,417 cells to 2,527. On other mazes the result can flip; press New race to try another.
How is the race fair?
Both solvers run on the same maze and explore the same number of cells per frame. Whoever explores fewer cells before reaching the exit finishes first and turns gold.
Which one finds the shorter path?
Both found paths of the same length (301 steps) here.