Minor Fixes for Topological Sort and DAG

Minor Fixes for Topological Sort and DAG