Weighted terrain only affects Dijkstra & A*. BFS/DFS treat all passable cells as cost 1.

A* uses an estimate of remaining distance to focus the search.

idle
Nodes visited
0
Path length
-
Status
idle
Start Goal Wall Mud (3) Water (5) Visited Frontier Path

Click empty squares to draw walls. Drag the green start or red goal to move them.

📋 Open frontier (data structure contents)
Position (r,c) g (cost from start) h (heuristic) f = g + h Note

BFS/DFS don't use g/h/f: they pop by FIFO/LIFO order. Dijkstra uses g only. A* sorts by f.

✨ Featured comparison
Featured comparison

Race A* against BFS on the same maze. Watch the frontier, visited count, and path length before deciding which algorithm actually did less work.

Open the race panel after the main grid, then compare A* and BFS on the exact same obstacle layout.

🏁 Race two algorithms on the same maze

Both algorithms search the maze you built above, one node-expansion per tick. Watch how many cells each opens before reaching the goal: that's why "A* explores fewer nodes than BFS" is a measured result, not a slogan.

vs
A* · nodes 0
BFS · nodes 0
🧭 Visual explanation

Live state to watch
No state captured yet. Run or adjust the applet first.
Misread to avoid

📚 Lesson tour (5 steps)
Step 1/5: -

-

📝 Worksheet (3 questions)

Q1. BFS on the demo maze. Is the path BFS finds always the shortest?

Q2. Same maze, DFS. Compared to BFS's path length, DFS finds a path that is:

Q3. A* with admissible Manhattan heuristic vs BFS on the same maze. Number of nodes visited by A* is:

🧪 Student response packet

Predict which search will do less work, run a comparison, then explain how the frontier and heuristic changed the result.

State snapshot appears here.
♿ Text and keyboard support

Text and keyboard support

Keyboard path

  • Use Tab and Shift+Tab to move through controls.
  • Use Enter or Space on buttons, and arrow keys on sliders or select controls.
  • The visual region is focusable and described by the state summary below.

Text state summary

Reduced motion and non-visual support

Reduced-motion settings are honored where possible. The current state is also available as text, so the main result does not depend only on color, animation, or spatial position.

Accessibility note: this layer gives a text equivalent for the applet state. It does not replace a full human screen-reader audit.