Graph Theory37 sections · 1633 units
Open in CourseQuiz: Counting Paths in a DAG
Knowledge check
Check Your Understanding
You count paths from node to node in a DAG. For node , you compute paths[v] = sum of paths[u] for all predecessors of . Why must you process nodes in topological order?
- A.Because topological order minimizes memory usage
- B.Because the count depends on which topological order you choose
- C.Because it ensures
paths[u]is finalized before you use it to updatepaths[v] - D.Because reverse topological order gives a different count