Generalized DFS with topological sort order built on vertex visit callback