postgraduate-prep/subjects/major/图论常见算法.md

15 lines
401 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 图论常见算法
### Dijkstra算法
用于求解单个源最短路问题:
1. 初始化将所有顶点的距离设为正无穷源顶点设为0
2. 迭代:从源顶点出发,遍历所有边,更新顶点的距离;
3. 检验:检查是否存在负权重环,如果有则返回错误;
4. 返回:返回所有顶点的距离。
### Bellman-Ford算法
### Bellman-Ford算法