tarjan求无向图的割点的伪代码

省选前的晚上,非常爽啊 

void dfs(int u)

{
static counter=0;
int children=0;
visit[u]=1; 
dfn[u]=low[u]=++counter;
while(遍历每一个有边连接的点v)
{
if(!visit[v])
{
fa[v]=u;
children++;
dfs(v);
low[u]=min(low[u],low[v]);
if(!fa[u]&&children>1) printf();
if(fa[u]&&low[v]>=dfn[u])printf();
}
else if(v!=fa[u])
low[u]=min(low[u],dfn[v]);
}
posted @ 2017-04-14 23:18  OcahIBye  阅读(290)  评论(0编辑  收藏  举报