Pathfinding Algorithm Visualizer
Explore how different pathfinding algorithms navigate through obstacles to find the shortest path from start to end.
Algorithm Options
Dijkstra's Algorithm
Dijkstra's algorithm finds the shortest path between two points in a graph. It guarantees the shortest path and works by visiting the vertices in order of their distance from the start vertex, calculated using a priority queue.
How to Use
- Click and drag on the grid to create walls (obstacles)
- Drag the green start node to reposition where the algorithm begins
- Drag the red target node to reposition where the algorithm should find a path to
- Select an algorithm from the dropdown menu
- Adjust the speed slider to control how fast the visualization runs
- Click "Visualize" to start the algorithm
- Use "Reset Grid" to clear the visualization and start over
Algorithm Comparison
Algorithm | Complete | Optimal | Time Complexity | Space Complexity |
---|---|---|---|---|
Dijkstra | Yes | Yes | O(V²) or O(E + V log V) | O(V) |
A* | Yes | Yes (with admissible heuristic) | O(E) | O(V) |
BFS | Yes | Yes (for unweighted graphs) | O(V + E) | O(V) |
DFS | Yes (if space is finite) | No | O(V + E) | O(V) |