求割点和桥的DFS

//无向图求割点和桥 void dfs(int cur,int fa,int deep,int &time) { visit[cur] =1; DFN[cur] = LOW[cur] = deep; int soncnt = 0; for(int i=0; i=DFN[cur])//割点 { cutv[cur] = 1; } if(cur==ROOT&&soncnt>=2)//割点 { cutv[cur] = 1; } if(LOW[v]>DFN[cur])//桥 { Brige[cur][v] = 1; } } else if(v!=fa) { LOW[cur] = MIN(DFN[v],LOW[cur]); } } LEAVE[cur] = time++; }

【求割点和桥的DFS】

    推荐阅读