这题是又有重边又有自环吗?

P8436 【模板】边双连通分量

Sakuya_maid @ 2023-10-04 15:20:59

如题,所以不能

    low[u] = dfsn[u] = ++ timestamp;

    stk.push(u);
    in_stk[u] = true;

    for(int i = h[u]; ~i; i = ne[i])
    {
        int v = e[i];

        if(v == f)continue;//different

        if(!dfsn[v])
        {
            tarjan(v, u);//different

            low[u] = min(low[u], low[v]);

            if(dfsn[u] < low[v])
            {
                is_bridge[i] = is_bridge[i ^ 1] = true;
            }
        }
        else if(in_stk[v])//different
        low[u] = min(low[u], dfsn[v]);
    }

只能如下吗

    low[u] = dfsn[u] = ++ timestamp;

    stk.push(u);
    in_stk[u] = true;

    for(int i = h[u]; ~i; i = ne[i])
    {
        int v = e[i];

    // if(v == f)continue;//different

        if(!dfsn[v])
        {
            tarjan(v, i);//different

            low[u] = min(low[u], low[v]);

            if(dfsn[u] < low[v])
            {
                is_bridge[i] = is_bridge[i ^ 1] = true;
            }
        }
        else if(i != (f ^ 1))//different
        low[u] = min(low[u], dfsn[v]);
    }

|