Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 01 · DSA · The toolbox · about 16 min to read

Play it as a journeyTutor comes with a plan

Graphs (BFS, DFS, Dijkstra, topological sort)

Graphs
Graphs · Open board

Dots and the lines between them, the shape this whole lesson is built on. The same picture backs routing in Networking (How a parcel finds any house on earth), the graph data model in Data Models and Query Languages, and the dataflow DAGs in Batch Processing.

Before you start. You need only arrays: a numbered list where you can jump straight to slot i. Nothing about graphs is assumed here, every new word below is shown doing something before it gets named.

Lesson 7 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1735: Königsberg, the walk nobody could finish
  • One-way streets and toll roads
  • Which runner finds it first
  • The cheapest path, not the fewest hops
  • An order that respects what comes first
  • Connecting every landmass as cheaply as possible

Terms it explains: vertices, edges, graph, breadth-first search, depth-first search, Dijkstra's algorithm, topological sort, directed, undirected, weighted, queue, stack, priority queue, directed acyclic graph, cycle, sparse, dense, {A-B, B-C, C-D}, A*, adjacency list, adjacency matrix, Bellman-Ford, BFS, DAG, DFS, Dijkstra, directed vs undirected, in-degree, MST, relax an edge, sparse vs dense, union-find, vertex/edge.

Lab

Every find walks a chain of houses up to the root. In the worst order, how long can that chain get, and what keeps it short?

Drag Cables joined to the end, then switch The habits and watch Tallest chain fall from 31 to 5.

Open The short chains

Review DSA