/**
[边双连通分量] poj 3177 Redundant Paths
题目同poj 3352.求至少添加几条边形成边双连通图,区别在于这里输入时要过滤掉重边。
1,tarjan 2,缩点建树 3,求叶子结点数目nlef return (nlef + 1) / 2
*/
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
#define N 5005
bool mb[N][N];
int low[N],vis[N],dfn[N],tim;
vector<int> g[N];
int n,m;
void dfs(int u,int f)
{
vis[u] = 1;
low[u] = dfn[u] = ++tim;
for(int i = 0; i < g[u].size(); ++i)
{
int v = g[u][i];
if(v != f && vis[v] == 1)
low[u] = min(low[u],dfn[v]);
if(vis[v] == 0)
{
dfs(v,u);
low[u] = min(low[u],low[v]);
}
[边双连通分量] poj 3177 Redundant Paths
最新推荐文章于 2019-08-14 21:41:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)