图论
文章平均质量分 92
Fooooooo
这个作者很懒,什么都没留下…
展开
-
欧拉回路
欧拉路:从起点到终点不重不漏的走过每一条边的路 欧拉回路:欧拉路的终点是起点 欧拉图:存在欧拉回路的图即欧拉图 欧拉图的判定: 一张无向图为欧拉图,当且仅当无向图连通,且每个点的度数都是偶数 欧拉图中每个结点为偶数度数,即只要到达一个结点,必然存在一条尚未走过的边可以离开该结点 反过来依然成立,每个点度数为偶数的连通图必然存在欧拉回路 欧拉路的存在性判定: 一张无向图中存在欧拉路,当且仅当无向...原创 2020-05-07 21:31:18 · 245 阅读 · 0 评论 -
tarjan有向图缩点
void tarjan(int x){ low[x]=dfn[x]=++num; s[++top]=x; v[x]=1; for(int i=head[x];i;i=nex[i]){ int y=e[i]; if(!dfn[y]){ tarjan(y); low[x]=min(low[x...原创 2020-03-16 21:06:59 · 162 阅读 · 0 评论 -
LCA最近公共祖先模板
#include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; #define N 100010 int n,m,t; int head[N],nex[N<<1],w[N&...原创 2020-03-12 16:53:20 · 92 阅读 · 0 评论 -
割边判定法则 搜索桥与求e-DCC(边双连通分量) 缩点
若(x,y)是桥,当且仅当 y是x的子节点,且dfn[x]<low[y] #include<iostream> using namespace std; const int N =10010; int head[N],nex[N<<1],e[N<<1],tot; int dfn[N],low[N],n,m,num; bool bridge[N<<...原创 2020-03-16 09:30:07 · 237 阅读 · 0 评论 -
割点判定法则 tarjan搜索割点 求v-DCC 割点
如果以x为根的搜索子树中存在一个 dfn[x]<=low[y] (若x为根则需两个或以上) 则x为割点 #include<iostream> using namespace std; const int N =10010; int head[N],nex[N<<1],e[N<<1],tot; int dfn[N],low[N],n,m,num,root; ...原创 2020-03-16 12:29:03 · 360 阅读 · 0 评论