Schedule dependent work with topological ordering
8 steps · about 3 h · Intermediate
- Define a valid topological order (guide, CP-Algorithms, 20 min)
States the edge-order property and derives the depth-first algorithm from finishing times.
- Review directed graphs and cycles (reference, Princeton University, 20 min)
Separates reachability, cycles and order in directed graphs before scheduling is attempted.
- Watch DFS create reverse postorder (interactive, University of San Francisco, 20 min)
Shows why a vertex is placed only after every dependency reachable from it is finished.
- Watch Kahn's indegree method (interactive, University of San Francisco, 20 min)
Makes the ready queue and each indegree decrement explicit, which maps naturally to task scheduling.
- Study Python's TopologicalSorter implementation (guide, Python Software Foundation, 20 min)
A standard-library implementation demonstrates incremental readiness and cycle reporting for practical jobs.
- Compare with a graph-library contract (reference, NetworkX, 15 min)
Documents the precise preconditions and errors expected when input is not a directed acyclic graph.
- Order courses from prerequisites (interactive, GeeksforGeeks, 30 min)
A compact dependency problem tests graph direction, indegrees and the incomplete-order cycle check.
- Infer and validate an unknown order (interactive, GeeksforGeeks, 35 min)
Adds graph construction and invalid-prefix cases, showing that ordering is only as sound as the constraints.