AlgoScope

Graph

Data structurebeginnerGraph Structuresalso called undirected graph

Vertices joined by edges; the model for networks, maps and dependencies.

Decision · step 2 of 8BFS and DFS: Breadth-first from 0
001121345u

Dequeue 0, distance 0. Its adjacency list: 1, 2. New: 1, 2, each at distance 1, enqueued.

Open in the player →or start at step 2

What you will see

Draggable vertices, edges between them; degree counted as edges light up.

How bfs and dfs works →

Cost

add vertexO(1)
add edgeO(1)
neighboursO(deg)
SpaceO(V + E)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.

Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.

Taught by the same lesson

BFS and DFS covers these too, in the same run.