Joint query set 1 & dfs & bfs & unionMerge & bipartite graph
0 some basics
Judge whether the whole graph is connected
Use dfs to judge whether the whole graph is connected:
// if not connected, return false
vecctor<int> stack = {0};
vector<bool> vis(graph.size(), false);
vis[0] = true;
int visCnt = 1;
// dfs to check if connected
whil ...
Posted on Mon, 29 Nov 2021 13:23:28 -0500 by php_tom