Build a Dependency Resolver

topological sort and cycle detection

Challenge 1 of GraphsIntermediate~55 minFree

Build the engine behind package managers and build systems. Model software dependencies as a directed graph, then walk it with BFS and DFS, compute a safe install order with topological sort, and detect the circular dependencies that break real builds.

5 steps

  1. 1Model the dependency graph
  2. 2Breadth-first search
  3. 3Depth-first search
  4. 4Topological sort (install order)
  5. 5Detect circular dependencies
Start step 1