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