5 questions to test your understanding
You run a topological sort algorithm on a directed graph and observe that Kahn's algorithm terminates with only 4 of the 6 nodes placed in the output. What can you conclude?
For the dependency graph A → C, B → C, B → D, A → D, which of the following is a valid topological ordering?
A DAG with 5 nodes can have more than one valid topological ordering.
A graph with a directed cycle has multiple valid topological orderings, since you can start the cycle at different points.
How does Kahn's algorithm naturally detect that a graph contains a cycle, without any explicit cycle-checking code?