Experimental

Pathfinding Visualizer

Run Dijkstra, A*, greedy best-first and breadth-first search on the same grid and compare how many cells each explores to find the same shortest path.

Last reviewed by the Radiatus Cloud team

Results appear here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

They find the same path and do wildly different amounts of work

Dijkstra and A* both return a shortest path, and A* usually examines a fraction of the cells. The difference is the heuristic: A* adds an estimate of the remaining distance to the cost so far, which biases the search towards the goal instead of expanding evenly in all directions. On an open grid the saving is often five to ten times. Watching both explore the same map is the clearest way to see that the algorithms differ in what they explore rather than in what they return.

An admissible heuristic is what keeps A* correct

The estimate must never exceed the true remaining distance. Manhattan distance is admissible on a four-connected grid and inadmissible on an eight-connected one, where diagonal moves make the true distance shorter than the Manhattan estimate. Use the wrong one and A* returns a path quickly that is not the shortest, and nothing warns you. That single condition is the whole boundary between a correct optimisation and a plausible-looking bug.

Greedy search is fast and wrong

Greedy best-first uses only the estimate and ignores the cost already paid, which makes it very fast and gives no guarantee at all. It walks confidently into dead ends and returns whatever path it stumbles onto. It is worth running alongside the others precisely because the path it returns looks reasonable until compared with the actual shortest one, which is how the failure appears in production too.

Related tools

Frequently Asked Questions

Do Dijkstra and A* return different paths?

No, both return a shortest path. They differ in how many cells they examine to find it, and A* usually examines far fewer.

What makes a heuristic admissible?

It never overestimates the remaining distance. Manhattan distance is admissible with four-way movement and not with eight-way, where diagonals make the true distance shorter.

Why is greedy search unreliable?

It ignores the cost already paid and follows the estimate alone, so it walks into dead ends and returns whatever it finds. The path looks reasonable until compared with the shortest.

What is the difference between BFS and Dijkstra?

On a grid with equal move costs they are the same algorithm. Dijkstra generalises to weighted edges, where BFS would return the fewest moves rather than the cheapest route.

Why does A* sometimes explore as much as Dijkstra?

Because the heuristic is uninformative for that map. In a maze with many walls the straight-line estimate says little about the real distance, and A* degenerates towards Dijkstra.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Choose an algorithm and maze pattern, then search.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.