Topological sort, implemented by DFS on Graph.