Graph & Grid Traversal · Revision Hubs

See BFS & DFS
actually run.

Two interactive hubs for every graph and grid traversal pattern — live animations, call-stack dry-runs, and full LeetCode-style code (driver + helper) with click-to-reveal comments. Built around how you actually learn.

10
BFS patterns
14
DFS patterns
24
full solutions
3D
graph demos
Why it works

Not flashcards. A pattern playground.

Every pattern pairs the intuition, the bugs you actually hit, and runnable code — so the idea sticks instead of the syntax.

⚙️

Full LeetCode-style code

Each snippet is a complete class Solution — the driver method and its helper, with authentic LC/GFG signatures you can paste and submit.

int numIslands(...) { ... dfs(i,j,g,vis); }
💬

Click-to-reveal comments

Read the code clean first. A marks lines that hide a note — click to reveal the “why”, click again to hide. Quiz yourself line by line.

cnt++;  // ★ new island
▶️

Live animations & 3D

Watch the queue fill, the recursion stack grow, the grid flood — synced to the code line lighting up as it executes. Real graphs render in 3D.

queue → level → dist  // step through
The hubs

Pick a traversal. Dive in.

Separate, focused hubs — BFS for levels, distances and shortest paths; DFS for recursion, components, cycles and backtracking.

How it works

Three passes per pattern.

Get the intuition

Read “when to use”, the key insight, and a plain-language analogy — plus the bugs you’ll actually hit.

Watch it run

Step through the animation while the matching code line highlights, so the mechanism — not the syntax — lands.

Own the code

Read the full driver + helper clean, then click lines to reveal comments and test whether you really know why each step is there.

Ready?

Start with the DFS hub.

14 patterns, full solutions, click-to-reveal comments and call-stack dry-runs — all in one page.

Launch the DFS hub