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

AlgorithmCompleteOptimalTime ComplexitySpace Complexity
DijkstraYesYesO(V²) or O(E + V log V)O(V)
A*YesYes (with admissible heuristic)O(E)O(V)
BFSYesYes (for unweighted graphs)O(V + E)O(V)
DFSYes (if space is finite)NoO(V + E)O(V)