Live demo · NAILA Search lab
Watch the frontier change.
One operation at a time. Explore queues, stacks, and heuristic priorities.
Search lab
Walk through the search
Breadth-first · Step 1 of 7
Initialize with SFrontier · next to remove is on the left
- S
Explored: None yet
| Node | g(n) |
|---|---|
| S | 0 |
Breadth-first · Step 1 of 7
CurrentFrontierExploredPath Initialize with SFrontier · next to remove is on the left
- S
Explored: None yet
Frontier values, in removal order Node g(n) S 0 Breadth-first · Step 2 of 7
CurrentFrontierExploredPath Expand S ENQUEUE A ENQUEUE BFrontier · next to remove is on the left
- A
- B
Explored: S
Frontier values, in removal order Node g(n) A 1 B 4 Breadth-first · Step 3 of 7
CurrentFrontierExploredPath Expand A ENQUEUE C ENQUEUE DFrontier · next to remove is on the left
- B
- C
- D
Explored: S, A
Frontier values, in removal order Node g(n) B 4 C 3 D 6 Breadth-first · Step 4 of 7
CurrentFrontierExploredPath Expand BFrontier · next to remove is on the left
- C
- D
Explored: S, A, B
Frontier values, in removal order Node g(n) C 3 D 6 Breadth-first · Step 5 of 7
CurrentFrontierExploredPath Expand C ENQUEUE GFrontier · next to remove is on the left
- D
- G
Explored: S, A, B, C
Frontier values, in removal order Node g(n) D 6 G 8 Breadth-first · Step 6 of 7
CurrentFrontierExploredPath Expand DFrontier · next to remove is on the left
- G
Explored: S, A, B, C, D
Frontier values, in removal order Node g(n) G 8 Breadth-first · Step 7 of 7
CurrentFrontierExploredPath Remove G: goal reached. Path cost = 8.Frontier · next to remove is on the left
Empty
Explored: S, A, B, C, D
Path: S → A → C → G
Graph search with duplicate suppression. A* reopens a node when a cheaper path is found. Its optimality depends on the heuristic; this lab does not assume admissibility. BFS minimizes depth, not weighted path cost.
Shortcuts: comma and full stop step back and forward.
The Search lab from NAILA, Faisal Alburti’s AI study app, with its own algorithms, practice graph, heuristics and wording. It needs no API key, and nothing you type leaves the page.
How it works
Queues, stacks and priorities.
- 01 · Enqueue and push
Queues and stacks
Breadth-first removes the oldest frontier node first, and Depth-first the newest. Both skip a neighbor that is already explored or already on the frontier.
- 02 · Insert
Heuristic priorities
Greedy best-first ranks the frontier by h(n), and A* by g(n) + h(n). Ties break by node name, or by the order nodes were added.
- 03 · Reopen
Reopening
A* keeps the cheapest g(n) found for each node and reopens an explored node when a cheaper path appears. Every search tests for the goal when it removes a node, and stops after 500 steps.

Ported from NAILA, Faisal Alburti’s AI study app. The Search lab is one of its four workspaces and works without an API key. This page is a TypeScript port of its teaching/search_lab.py and ui/search_lab.py (commit e8d0ce8), checked against step traces from the original Python. The graph drawing is this page’s view of the same data; NAILA shows each step as the frontier, explored set and table. The practice graph and heuristics are NAILA’s own practice example, not course material.