Replies: 15 comments 8 replies
-
定义上好像有点问题: 然而在接下来的描述以及代码中都提到了:这条不在搜索树上的边不能连接到一个非栈点中去。否则,直接按照定义编写代码会得到答案错误。 暂时还未想到很好的解决办法。另外,下文中并没有交代栈的来历。应该在这两处地方阐述清楚,建议修改 |
Beta Was this translation helpful? Give feedback.
-
最近在youtube上看的视频,英语不错的可以看一下,可视化之后就比较好理解了:https://www.youtube.com/watch?v=TyWtx7q2D7Y |
Beta Was this translation helpful? Give feedback.
-
推荐一下 https://www.byvoid.com/zhs/blog/scc-tarjan, 有一个很清晰的图示 |
Beta Was this translation helpful? Give feedback.
-
Tarjan 中的 j 应该是发音的,不然不会译为塔扬。j应该发/j/的音 |
Beta Was this translation helpful? Give feedback.
-
能不能加个缩点的代码?谢谢 |
Beta Was this translation helpful? Give feedback.
-
我总觉得前向边的定义不太准确,既然前向边是从祖先到后代的边,那么树边也是前向边啦?那么那个示意图就不够准确。返祖边(后向边)也存在同样定义上的问题。 |
Beta Was this translation helpful? Give feedback.
-
LCA的tarjan貌似不是Robert Tarjan的 |
Beta Was this translation helpful? Give feedback.
-
请问一下,如果v是被访问过且在栈中,为什么不能用 low[v] 来更新 low[u] |
Beta Was this translation helpful? Give feedback.
-
因为tarjan论文中low的定义是通过最多一条反向边能到达的最小的dfn,low[v]有可能经过了其他的反向边,所以不能用low[v]来更新。但其实如果用low[v]来更新得到的算法也是对的,因为最多一条反向边这个限制并没有什么用。。。 |
Beta Was this translation helpful? Give feedback.
-
好的,明白了,谢谢! |
Beta Was this translation helpful? Give feedback.
-
魔改了一下……能过https://codeforces.com/problemset/problem/427/C void tarjan(int u) {
if (dfn[u]) {
return;
}
low[u] = dfn[u] = ++dfcnt;
stk[++tp] = u;
instack[u] = 1;
for (auto to : g[u]) {
if (!dfn[to] || instack[to]) {
tarjan(to);
low[u] = min(low[u], low[to]);
}
}
if (dfn[u] == low[u]) {
sc++;
while (stk[tp + 1] != u) {
scc[sc].push_back(stk[tp]);
instack[stk[tp]] = 0;
tp--;
};
}
} |
Beta Was this translation helpful? Give feedback.
-
这个本来就是一个认为的概念,哪条边先dfs遍历到那条边就是树边,并没有准确的定义 |
Beta Was this translation helpful? Give feedback.
-
是他的,都是他发明的 |
Beta Was this translation helpful? Give feedback.
-
Kosaraju 算法的实现,最后循环应为 |
Beta Was this translation helpful? Give feedback.
-
好的谢谢
…---原始邮件---
发件人: "Teng ***@***.***>
发送时间: 2023年11月8日(周三) 下午5:15
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [OI-wiki/gitment] 强连通分量 (Discussion #727)
如果单纯是求强连通分量,可以证明两种写法是等价的。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
https://oi-wiki.org/graph/scc/
Beta Was this translation helpful? Give feedback.
All reactions