随笔分类 -  图论

最小树形图——朱刘算法
摘要:一、相关定义 定义:设G = (V,E)是一个有向图,它具有下述性质: 最小树形图就是有向图G = (V, E)中以vi为根的树形图中权值和最小的那一个。 另一种说法:最小树形图,就是给有向带权图一个特殊的点root,求一棵以root为根节点的树使得该树的的总权值最小。 性质:最小树形图基于贪心和缩 阅读全文
posted @ 2018-08-08 14:51 Baiyi_destroyer 阅读(286) 评论(0) 推荐(0)
LCA最近公共祖先模板代码
摘要:vector模拟邻接表: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 #include<vector> 6 #include<queue> 7 #define eps 1e-8 8 # 阅读全文
posted @ 2018-08-03 17:17 Baiyi_destroyer 阅读(137) 评论(0) 推荐(0)
Nearest Common Ancestors (POJ 1330)
摘要:A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with 阅读全文
posted @ 2018-08-03 16:34 Baiyi_destroyer 阅读(129) 评论(0) 推荐(0)