algo: bfs_topo works on graph