Developer tool
Dijkstra's Algorithm Visualizer
Watch Dijkstra's algorithm expand by cumulative cost to find a lowest-cost path through weighted terrain.
About this tool
How Dijkstra explores
Dijkstra's algorithm always expands the reachable cell with the smallest known cost. That makes it a reliable way to find lowest-cost paths when every movement cost is non-negative.
Paint weighted cells near the direct route, then run the visualizer. Dijkstra's will take a longer route in steps when it costs less overall, unlike BFS and DFS.
How it works
Try this visualizer
- 1Set up the grid
Draw walls or weighted cells, then place the start and goal nodes.
- 2Run the algorithm
Use Dijkstra's algorithm to study weighted shortest paths, routing, and priority-queue search.
- 3Compare the outcome
Use the links above to run another algorithm against the same kind of map.
Common questions
Dijkstra Visualizer FAQ
Can I draw my own obstacles?
Yes. Choose Wall, Weight, Erase, Move start, or Move goal, then drag across the grid before running the selected algorithm.
Do weighted cells change every algorithm?
Weighted cells change the displayed path cost for every run, but only Dijkstra's and A* use those costs when choosing their route.
Does the visualizer run in my browser?
Yes. The grid and every search run stay in your browser; nothing you draw is uploaded or stored.