Detecting DAG with more than one root.