1 void dfs(int v,int u) 2 { 3 int child=0; 4 dfn[v]=low[v]=++dfn_cut; 5 vs[v]=1; 6 for (int i=0;i<map[v].size();i++) 7 { 8 int w=map[v][i]; 9 if (!vs[w]) 10 { 11 child++; 12 dfs(w,v); 13 low[v]=min(low[v],low[w]); 14 if (child>1&&v==1) flag[v]=1; 15 if (v!=1&&low[w]>=dfn[v]) flag[v]=1; ///判断割点 16 /// if (v!=1&&low[w]>dfn[v])判断桥 17 } 18 else if (w!=u&&u!=-1) low[v]=min(low[v],dfn[w]); 19 } 20 }
时间: 2024-11-17 21:48:45