图树模板
题单介绍
## 树上算法
### 树的重心:
[P1364 医院设置](https://www.luogu.com.cn/problem/P1364):树的带权重心,模板
[CF1406C Link Cut Centroids](https://www.luogu.com.cn/problem/CF1406C):树的重心练习
[CF708C Centroids](https://www.luogu.com.cn/problem/CF708C):树的重心练习
### 树的直径:
[SP1437 PT07Z - Longest path in a tree](https://www.luogu.com.cn/problem/SP1437):树的直径模板
[CF14D Two Paths](https://www.luogu.com.cn/problem/CF14D):树的直径练习
[P1099 [NOIP2007 提高组] 树网的核](https://www.luogu.com.cn/problem/P1099):树的直径练习
[P5536 【XR-3】核心城市](https://www.luogu.com.cn/problem/P5536):树的直径练习
### LCA问题:
[P3379 【模板】最近公共祖先(LCA)](https://www.luogu.com.cn/problem/P3379):LCA模板题
[P6374 「StOI-1」树上询问](https://www.luogu.com.cn/problem/P6374):LCA练习
[P4427 [BJOI2018] 求和](https://www.luogu.com.cn/problem/P4427) :倍增变形
[P3258 [JLOI2014] 松鼠的新家](https://www.luogu.com.cn/problem/P3258):树上差分
[P6869 [COCI2019-2020#5] Putovanje](https://www.luogu.com.cn/problem/P6869):树上差分
### 树链剖分问题:
[P3384 【模板】重链剖分/树链剖分](https://www.luogu.com.cn/problem/P3384):树链剖分模板
[P2486 [SDOI2011] 染色](https://www.luogu.com.cn/problem/P2486):连续 $1$ 的合并,线段树返回 $node$ 类型以及维护 $lmx、rmx$ 等
[P3313 [SDOI2014] 旅行](https://www.luogu.com.cn/problem/P3313):树剖练习题
[P3976 [TJOI2015] 旅游](https://www.luogu.com.cn/problem/P3976):树剖练习题
[P3979 遥远的国度](https://www.luogu.com.cn/problem/P3979):树剖练习题
[GSS3 - Can you answer these queries III](https://www.luogu.com.cn/problem/SP1716):线段树版本
[GSS7 - Can you answer these queries VII](https://www.luogu.com.cn/problem/SP6779):树剖版本
## 图上算法
### 最短路:
[P4779 【模板】单源最短路径(标准版)](https://www.luogu.com.cn/problem/P4779):最短路模板
[P1144 最短路计数](https://www.luogu.com.cn/problem/P1144):最短路伴随转移
[P6175 无向图的最小环问题](https://www.luogu.com.cn/problem/P6175):floyd最小环模板
[P2738 [USACO4.1] 篱笆回路Fence Loops](https://www.luogu.com.cn/problem/P2738):最小环练习
[P1119 灾后重建](https://www.luogu.com.cn/problem/P1119):floyd最短路练习
[B3611 【模板】传递闭包](https://www.luogu.com.cn/problem/B3611):传递闭包模板
[P4306 [JSOI2010] 连通数](https://www.luogu.com.cn/problem/P4306):传递闭包
[P1396 营救](https://www.luogu.com.cn/problem/P1396):二分+最短路
[P1462 通往奥格瑞玛的道路](https://www.luogu.com.cn/problem/P1462):二分+最短路
[P3385 【模板】负环](https://www.luogu.com.cn/problem/P3385):负环模板
[P1768 天路](https://www.luogu.com.cn/problem/P1768):二分+负环(最小圈问题)
[P3199 [HNOI2009] 最小圈](https://www.luogu.com.cn/problem/P3199):二分+负环
[CF59E Shortest Path](https://www.luogu.com.cn/problem/CF59E):分层图最短路
[P3489 [POI2009] WIE-Hexer](https://www.luogu.com.cn/problem/P3489):分层图最短路
[P4568 [JLOI2011] 飞行路线](https://www.luogu.com.cn/problem/P4568):分层图最短路
[P2939 [USACO09FEB] Revamping Trails G](https://www.luogu.com.cn/problem/P2939):分层图最短路
### 并查集+最小生成树:
[P3367 【模板】并查集](https://www.luogu.com.cn/problem/P3367):并查集模板
[P3366 【模板】最小生成树](https://www.luogu.com.cn/problem/P3366):最小生成树模板
[P2024 [NOI2001] 食物链](https://www.luogu.com.cn/problem/P2024):带权并查集
[P1196 [NOI2002] 银河英雄传说](https://www.luogu.com.cn/problem/P1196):带权并查集
[P1525 [NOIP2010 提高组] 关押罪犯](https://www.luogu.com.cn/problem/P1525):并查集训练
[P1783 海滩防御](https://www.luogu.com.cn/problem/P1783):并查集训练
[P2323 [HNOI2006] 公路修建问题](https://www.luogu.com.cn/problem/P2323):最小生成树练习
### 连通分量:
[强\双连通分量模板题](https://www.luogu.com.cn/training/321966)
### 差分约束:
[P5960 【模板】差分约束算法](https://www.luogu.com.cn/problem/P5960):差分约束模板
[P3275 [SCOI2011] 糖果](https://www.luogu.com.cn/problem/P3275):差分约束练习
[CF803E Roma and Poker](https://www.luogu.com.cn/problem/CF803E):差分约束练习