Module M25 · 25 of 35 in teaching order · Intermediate

Topological Sort

Ordering dependencies with Kahn’s algorithm or DFS, and detecting cycles.

Lessons

  1. Ordering tasks so every dependency comes first: in-degrees, the queue of sources, why Kahn’s algorithm is correct, how it detects a cycle, tie-breaking and O(V + E).

Topics this module covers

The full module scope. Topics without a lesson above are not written yet.

  • DAG
  • dependencies
  • indegree/outdegree
  • Kahn
  • DFS
  • cycle detection
  • scheduling

Builds toward