Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings
Back to syllabus

Graphs

6 chapters · 15 challenges · The Neon Grid

Understand the idea, practise through play, then prove it in code. Choose your next quest below.

Visual introduction to this topic
Start here · 3 minute mental model

What is a graph?

A graph models entities as vertices and relationships as edges. Unlike a tree, it may contain cycles, multiple routes, and disconnected regions.

Think of a game world map. Camps are vertices and roads are edges. Several roads may reach the same camp, so the explorer must remember where they have already been.

Explore connections while visited state prevents loops and duplicate work.

Choose the representation

Adjacency lists are compact; matrices make edge checks direct.

DFS or BFS

Depth-first follows a route; breadth-first finds fewest edges in an unweighted graph.

Mark visited at the right time

Late marking can queue the same vertex repeatedly or loop forever.

What you will learn firstIsland Signals

Flood one component at a time

Begin the guided lesson

Your chapter route

Island Signals

Continue
Source reviewed

Built from authoritative material

This track is checked against the sources below. Visual traces still carry their own complete or guided coverage label, so unfinished explanations are not presented as complete executions.

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead