标签:pre ++ else cut lang 相关 int lan cpp
// 割边
void tar(int x,int in_e)
{
dfn[x] = low[x] = ++cnt;
for(int i=hd[0][x],y=vr[i]; i; i=nt[i],y=vr[i])
if(!dfn[y])
{
tar(y,i);
low[x] = min(low[x],low[y]);
if(low[y]>dfn[x]) bri[i]=bri[i^1]=true;
} else
if(i != (in_e^1)) low[x]=min(low[x],dfn[y]);
}
//割点
void tar(int x)
{
dfn[x] = low[x] = ++cnt;
if(rt==x && !hd[x])
{
dcc[++dcnt].clear();
dcc[dcnt].push_back(x);
return;
}
sta[++tp] = x;
for(int i=hd[x],y=vr[i]; i; i=nt[i],y=vr[i])
if(!dfn[y])
{
tar(y);
low[x] = min(low[x],low[y]);
if(low[y]>=dfn[x])
{
++flg;
if(flg>1 || x!=rt) cut[x]=true;
dcc[++dcnt].clear();
int z;
do{
z=sta[tp--];
dcc[dcnt].push_back(z);
} while(z!=y);
dcc[dcnt].push_back(x);
}
}
else low[x] = min(low[x],dfn[y]);
}
标签:pre ++ else cut lang 相关 int lan cpp
原文地址:https://www.cnblogs.com/tztqwq/p/14224784.html