DAGs & Topological Sort
Order tasks with dependencies, find cycles in directed graphs, and compute over DAGs in topological order.
3 objectives 5 steps about 100 min
Check what you know
The lessons are coming later. The knowledge check is ready now.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Produce a topological order with Kahn's algorithm and with DFS finishing order, and report failure when the graph has a cycle.
- Detect and extract a cycle in a directed graph using three-color DFS.
- Compute longest paths, shortest paths or path counts on a DAG by processing vertices in topological order.
Lesson plan
5 steps, about 100 min · 0 of 4 lessons available so far
- Dependencies as Directed Graphs Concept · 15 min · coming later
- Two Ways to Order a DAG Worked example · 25 min · coming later
- Finding the Cycle That Blocks the Build Worked example · 20 min · coming later
- Lab: Critical Path of a Project Plan Lab · 25 min · coming later
- Check: Ordering and Cycle Problems Knowledge check · 6 questions
Practise it
Write a build-order tool that reads 'target: dependencies' lines, prints a valid order or the exact cycle, computes the critical-path duration from task times, and agrees with graphlib.TopologicalSorter on every valid input.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own Module BundlerIntermediate · 4–8 h
- Build your own Build SystemIntermediate · 4–8 h
- Build your own Deep Learning FrameworkAdvanced · 20–40 h
References
Hard prerequisites
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.