グラフが強く接続されたコンポーネントであるかどうかを確認するためのこのコードがあります
vector<int> G[2005];
int depth = 0;
void dfs(int u)
{
visited[u] = 1;
low[u] = ++depth;
for(int i=0;i<G[u].size();++i)
{
int v = G[u][i];
if(!visited[v])
dfs(v);
low[u] = min(low[u],low[v]);
}
}
私は dfs(1) を実行し、すべての頂点について、すべての頂点とすべての頂点が訪問された場合に low[u] == 1 かどうかを確認しました。これは正しいアプローチですか?あるはずですが、どういうわけか機能していません。これは私が達成しようとしていることに関する問題ですhttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=2938&mosmsg=Submission+received+with+ID+12516894