Schedule dependent work with topological ordering

8 steps · about 3 h · Intermediate

  1. Define a valid topological order (guide, CP-Algorithms, 20 min)

    States the edge-order property and derives the depth-first algorithm from finishing times.

  2. Review directed graphs and cycles (reference, Princeton University, 20 min)

    Separates reachability, cycles and order in directed graphs before scheduling is attempted.

  3. 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.

  4. 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.

  5. Study Python's TopologicalSorter implementation (guide, Python Software Foundation, 20 min)

    A standard-library implementation demonstrates incremental readiness and cycle reporting for practical jobs.

  6. 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.

  7. Order courses from prerequisites (interactive, GeeksforGeeks, 30 min)

    A compact dependency problem tests graph direction, indegrees and the incomplete-order cycle check.

  8. 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.