标签:style blog color for ar div log sp size
1 void tarjan(int u) 2 { 3 dfn[u]=low[u]=++dfs_clock; 4 stack_push(u); 5 6 for (int c=head[u];c;c=nxt[c]) 7 { 8 int v=to[c]; 9 if (!dfn[v]) 10 { 11 tarjan(v); 12 low[u]=min(low[u],low[v]); 13 } 14 else if (!scc[v]) 15 low[u]=min(low[u],dfn[v]); 16 } 17 18 if (low[u]==dfn[u]) 19 { 20 scc_cnt++; 21 int cur; 22 for (;;) 23 { 24 scc_size[scc_cnt]++; 25 cur=stack_pop(); 26 scc[cur]=scc_cnt; 27 if (cur==u) 28 break; 29 } 30 } 31 }
标签:style blog color for ar div log sp size
原文地址:http://www.cnblogs.com/vb4896/p/3939953.html