Tarjan:
int cnt = 0;
vector<int> G[MAXN];
int pre[MAXN],low[MAXN];
void DFS(int u,int p)
{
low[u] = pre[u] = ++cnt;
for(auto v : G[u])
{
if(!pre[v])
{
DFS(v,u);
low[u] = min(low[u],low[v]);
}
else if(pre[v] < pre[u] && v != fa)
{
low[u] = min(low[u],pre[v]);
}
}
}
int cnt = 0;
vector<int> G[MAXN];
int pre[MAXN],low[MAXN],iscut[MAXN];
void DFS(int u,int p)
{
low[u] = pre[u] = ++cnt;
int child = 0;
for(auto v : G[u])
{
if(!pre[v])
{
child ++;
DFS(v,u);
low[u] = min(low[u],low[v]);
if(low[v] >= pre[u])
{
iscut[u] = 1;
}
}
else if(pre[v] < pre[u] && v != p)
{
low[u] = min(low[u],pre[v]);
}
}
if(p <= 0 && child == 1)
{
iscut[u] = 0;
}
}
int cnt = 0;
vector<int> G[MAXN],isbridge[MAXN];
int pre[MAXN],low[MAXN],iscut[MAXN];
void DFS(int u,int p)
{
low[u] = pre[u] = ++cnt;
int child = 0;
for(int i = 0;i < G[u].size();i++)
{
int v = G[u][i];
if(!pre[v])
{
child ++;
DFS(v,u);
low[u] = min(low[u],low[v]);
if(low[v] > pre[u])
{
isbridge[u][i] = 1;
}
}
else if(pre[v] < pre[u] && v != p)
{
low[u] = min(low[u],pre[v]);
}
}
}