Graph
Vertices joined by edges; the model for networks, maps and dependencies.
Decision · step 2 of 8BFS and DFS: Breadth-first from 0
Dequeue 0, distance 0. Its adjacency list: 1, 2. New: 1, 2, each at distance 1, enqueued.
What you will see
Draggable vertices, edges between them; degree counted as edges light up.
Cost
| add vertex | O(1) |
|---|---|
| add edge | O(1) |
| neighbours | O(deg) |
| Space | O(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.
Leads to
Topics that need this one first.
Taught by the same lesson
BFS and DFS covers these too, in the same run.