Skip to content

Graph Representation and Adjacency Intuition

Simulation loading

Open Model Lab is preparing the live lab, controls, and graph surface for this concept.

Wrap-up

What you learned

Recommended next
Open concept testCheck whether the core ideas are ready without leaving this concept.
Read next
Breadth-First Search and Layered FrontiersUse adjacency with a queue frontier

Key takeaway

  1. Adjacency is the local neighborhood information available from the current node.
  2. The first frontier widens or narrows because different graph starts have different neighbor sets.
  3. Traversal rules reuse the same graph structure but change the order in which the frontier is handled.

Common misconception

A graph algorithm starts by applying a queue or stack rule before local structure matters.

The honest first move is local: read the direct neighbors of the current node.

  1. Neighbor set

    Lists the nodes you can reach from v by one edge.

  2. First frontier

    The first frontier is exactly the start node's neighbor set.

Why it behaves this way

Explanation

A graph should first feel like a map of direct connections, not a picture you have to understand all at once. This bench keeps one labeled graph, one active frontier, and one adjacency readout together so you can read the current neighborhood before the search language gets more formal.

Adjacency is the first useful question: which nodes can the current node reach by one edge right now? Once that local neighborhood is clear, breadth-first and depth-first search become two ways of organizing the same next-step options.

Key ideas

01The first useful graph reading is local adjacency: which nodes are one edge away from the current node.
02The frontier is the set of discovered next candidates that are waiting to be explored.
03Changing the start node changes the first neighborhood and the first frontier, even when the graph itself stays the same.

Worked examples

Worked examples

Open examples when you want to see the same idea walked through step by step.

Frozen walkthrough

Step through the frozen example

Frozen walkthrough
Read the first neighborhood from the bench before you name BFS or DFS.

Supporter unlocks saved study tools, exact-state sharing, and the richer review surfaces that support this guided flow.

View plans
Frozen valuesUsing frozen parameters

On the layered campus graph, what does starting at A tell you immediately?

Graph layout

Layered campus

Start node

A

Traversal mode

B, C

1. Read the direct neighbors

Node A touches B and C directly, so those two nodes are the first adjacent candidates.

2. Turn those neighbors into the first frontier

After the first expansion, the claimed next-step frontier is [B, C] rather than the whole graph.

3. Connect that local picture to later search rules

Breadth-first and depth-first search will organize that frontier differently, but they still start from the same local adjacency picture.

First-neighborhood summary

From A, the first frontier is B and C.
Adjacency is the local structure that every later search rule has to respect.

Quick test

Loading saved test state.

Bench tools and share links

Keep stable concept links and exact-state sharing tucked away until you actually need to relaunch or share the bench.

Try this setup

Jump to a named bench state or copy the one you are looking at now. Shared links reopen the same controls, graph, overlays, and compare context.

Saved setups

Saved setups are a Supporter study tool. Stable concept links still work for everyone.

Checking saved setup access

Open Model Lab is resolving whether this bench can save locally, sync to an account, or open Supporter-only compare tools.

Copy current setup

Exact-state sharing is part of Supporter. Stable concept and section links still stay available.

Stable links

Progress and next steps

Keep progress signals, starter-track handoffs, and review prompts available without letting them compete with the live lesson flow.

Progress

Loading progress

Loading saved concept progress for this browser or synced account before showing completion status.