Algorithm briefing
Breadth-First Search
BFS explores the maze in layers. In an unweighted grid, the first path found is guaranteed to be shortest.
Unweighted graphShortest pathQueue
Live step
Press Find path to start exploring from S toward E.
How to read the grid
Explored cells show where the algorithm has searched. Frontier cells are discovered but not yet processed. The yellow route is the final path when one exists.
BFS and Dijkstra find shortest paths on this equal-cost grid. A* uses a distance heuristic. DFS finds a route when one exists, but does not guarantee the shortest.
Keyboard shortcuts
Space play/pause · R reset search · N new maze