Testing for a correct topological sorting of a DAG.