๐Ÿ” Pathfinding Algorithm Visualizer

Interactive tool for learning BFS, DFS, Uniform Cost Search, and A*

๐Ÿ“š How to Use:

  • Click and drag on the grid to draw walls
  • Click on Start (green) or End (red) to move them
  • Select an algorithm and click "Run Algorithm" to visualize
  • Use "Step Through" mode to execute the algorithm step by step
  • Compare All to see all four algorithms side by side
50ms
Start
End
Wall
Current
Visited
Path

๐Ÿ”ต Breadth-First Search (BFS)

Strategy: Explores all neighbors at current depth before moving deeper. Uses a queue (FIFO).

Guarantees: Shortest path in unweighted graphs. Complete.

Complexity: O(V + E) time and space.

๐ŸŸฃ Depth-First Search (DFS)

Strategy: Explores as far as possible along each branch. Uses a stack (LIFO).

Guarantees: Not optimal. May find long paths first.

Complexity: O(V + E) time, O(V) space.

๐ŸŸก Uniform Cost Search (UCS)

Strategy: Always expands the node with lowest path cost. Uses a priority queue.

Guarantees: Optimal path in weighted graphs. Complete.

Complexity: O(b^(C*/ฮต)) where C* is optimal cost.

๐ŸŸข A* Search

Strategy: Uses f(n) = g(n) + h(n) where g is cost so far and h is heuristic estimate to goal.

Guarantees: Optimal if heuristic is admissible. Most efficient optimal algorithm.

Complexity: Depends on heuristic quality. Better than UCS in practice.