finished better dfs, bfs, bipartite_dfs, bipartite_bfs