Live demo · NAILA Search lab

Watch the frontier change.

One operation at a time. Explore queues, stacks, and heuristic priorities.

Set up a search

Search lab

Walk through the search

Breadth-first · Step 1 of 7

1425152SABCDG
CurrentFrontierExploredPath
Initialize with S

Frontier · next to remove is on the left

  1. S

Explored: None yet

Frontier values, in removal order
Nodeg(n)
S0
  1. Breadth-first · Step 1 of 7

    1425152SABCDG
    CurrentFrontierExploredPath
    Initialize with S

    Frontier · next to remove is on the left

    1. S

    Explored: None yet

    Frontier values, in removal order
    Nodeg(n)
    S0
  2. Breadth-first · Step 2 of 7

    1425152SABCDG
    CurrentFrontierExploredPath
    Expand S
    ENQUEUE A
    ENQUEUE B

    Frontier · next to remove is on the left

    1. A
    2. B

    Explored: S

    Frontier values, in removal order
    Nodeg(n)
    A1
    B4
  3. Breadth-first · Step 3 of 7

    1425152SABCDG
    CurrentFrontierExploredPath
    Expand A
    ENQUEUE C
    ENQUEUE D

    Frontier · next to remove is on the left

    1. B
    2. C
    3. D

    Explored: S, A

    Frontier values, in removal order
    Nodeg(n)
    B4
    C3
    D6
  4. Breadth-first · Step 4 of 7

    1425152SABCDG
    CurrentFrontierExploredPath
    Expand B

    Frontier · next to remove is on the left

    1. C
    2. D

    Explored: S, A, B

    Frontier values, in removal order
    Nodeg(n)
    C3
    D6
  5. Breadth-first · Step 5 of 7

    1425152SABCDG
    CurrentFrontierExploredPath
    Expand C
    ENQUEUE G

    Frontier · next to remove is on the left

    1. D
    2. G

    Explored: S, A, B, C

    Frontier values, in removal order
    Nodeg(n)
    D6
    G8
  6. Breadth-first · Step 6 of 7

    1425152SABCDG
    CurrentFrontierExploredPath
    Expand D

    Frontier · next to remove is on the left

    1. G

    Explored: S, A, B, C, D

    Frontier values, in removal order
    Nodeg(n)
    G8
  7. Breadth-first · Step 7 of 7

    1425152SABCDG
    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.

Independent practice example. These graph data and conventions are not extracted from your course. Set them to match your assignment before comparing results.

Algorithm

Breadth-first

Neighbor order / priority ties
DFS push order

With listed order, the last pushed neighbor is removed first.

Edit graph6 nodes · 7 edges
NAILA’s Search lab practice graphRuns in your browser

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.

  1. 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.

  2. 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.

  3. 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.

NAILA’s own Search lab in the Streamlit app, at step 3 of 6 of the A* walkthrough on the practice graph: Expand A, INSERT C, INSERT D; frontier B, C, D with g, h and f values; explored S, A
The original in NAILA, at the same step: A* step 3 of 6 on the practice graph.

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.

Back to the portfolio