Course catalogue

Lab0 / Learn, build, explore

DSA playground

Build a graph. Watch BFS explore it, one queue operation at a time.

0/4 checkpoints passed · Progress saved in this browser

01 / Friends and connections

Meet your graph

A graph is a collection of nodes joined by edges. Our edges work in both directions and each costs one hop. Choose a start node, then click any node to choose a destination. BFS explores only the connected region reachable from the start.

Your mini mission

Start at A and choose G as the destination. How many connections do you think you need?

GRAPH / CLUB

Friends, meet the queue.

Interactive

Click a node for its path. Drag nodes to arrange your graph.

Ad = 0STARTB?C?D?E?F?G?
Untouched In queue Current Explored Path

Put A in the queue and mark it discovered. Its distance is 0.

1 / 32
Shortest path · A to GNot discovered yetTry another destination or connect the islands.
1discover(start); queue.push(start)2while queue not empty: u = queue.shift()3  for v in neighbors(u):4    if discovered(v): skip5    else: discover(v); parent[v]=u; queue.push(v)6  mark u fully explored7done — queue is empty

Pocket checkpoint

What does one edge represent in this graph?

Choose an answer
1 / 4
Next adventure: Build a tiny calculator