after bfs,dfs and topo sort