Graph Theory37 sections · 1633 units
Open in Course

Quiz: Counting Paths in a DAG

Knowledge check

Check Your Understanding

You count paths from node 11 to node nn in a DAG. For node vv, you compute paths[v] = sum of paths[u] for all predecessors uu of vv. Why must you process nodes in topological order?

  1. A.Because topological order minimizes memory usage
  2. B.Because the count depends on which topological order you choose
  3. C.Because it ensures paths[u] is finalized before you use it to update paths[v]
  4. D.Because reverse topological order gives a different count
Start the roadmap to answer the quizzes and solve the challenges