题目大意:给你一个网络组,每台机子与其他机子的关系,让你找到所有的割点,如果没有割点,输出无这道题目就是最直接的求割点问题,我在这里用的是邻接矩阵来存储机子之间的关系割点问题的求解需要对深度优先搜索序数有比较好的理解dfn[]用于存储当前的优先搜索序数,low[]存储当前点通过子节点或是回路所能达到...
分类:
其他好文 时间:
2014-08-01 13:26:51
阅读次数:
220
写这个就是为了手写一份好用的求割点模板:
吐槽下,题目中的 Each of the next at most N lines contains the number of a place followed by the numbers of some places to which there is a direct line from this place. 这个at most是不可信的,应...
分类:
其他好文 时间:
2014-07-18 11:29:34
阅读次数:
232
Tarjan算法。1.若u为根,且度大于1,则为割点2.若u不为根,如果low[v]>=dfn[u],则u为割点(出现重边时可能导致等号,要判重边)3.若low[v]>dfn[u],则边(u,v)为桥(封死在子树内),不操作。求割点时,枚举所有与当前点u相连的点v:1.是重边: 忽略2.是树边: T...
分类:
其他好文 时间:
2014-06-15 11:46:09
阅读次数:
165
一、基本概念:1.割点:若删掉某点后,原连通图分裂为多个子图,则称该点为割点。2.割点集合:在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。3.点连通度:最小割点集合中的顶点数。4.割边(桥):删掉它之后,图...
分类:
其他好文 时间:
2014-06-09 15:43:52
阅读次数:
344
求割点
const int maxn = 1010;
vector a[maxn], bcc[maxn];
int pre[maxn];
int low[maxn];
bool iscut[maxn];
int bccno[maxn];
int cnt[maxn];
int dfs_clock;
int bcc_cnt;
int n;
struct Edge
{
int u, v;
};...
分类:
其他好文 时间:
2014-06-08 05:54:36
阅读次数:
270
题意:求一个无向图的,去掉两个不同的点后最多有几个连通分量。
思路:枚举每个点,假设去掉该点,然后对图求割点后连通分量数,更新最大的即可。算法相对简单,但是注意几个细节:
1:原图可能不连通。
2:有的连通分量只有一个点,当舍去该点时候,连通分量-1;
复习求割点的好题!
#include
#include
#include
using namespace std;
i...
分类:
其他好文 时间:
2014-05-23 07:56:52
阅读次数:
317
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=251
测模版:
#include
#include
#include
#include
#include
#include
using namespace std;
#define ...
分类:
其他好文 时间:
2014-04-29 13:31:21
阅读次数:
542