找不到该问题的综合答案。因此,将其放在此处并自己回答。
最短路径
Single Source Shortest Path
Greedy Algorithm
Works for directed and undirected graphs
Does not work for negative edges and cannot detect negative cycles
Time Complexity O(E*log(V))
Single Source Shortest Path
Dynamic Programming
Works for directed and undirected graphs
Works on negative edges and detects negative edge cycles
Time Complexity O(V*E)
All Source Shortest Path
Dynamic Programming
Works for directed and undirected graphs
Works on negative edges but cannot detect negative cycles
Time Complexity O(V3)
最小生成树
Greedy Algorithm
Starts from any vertex
Does not work for directed graphs
Does not work on disconnected graphs
An edge may be considered multiple times
Better for dense graphs
Time Complexity O(E*log(V)) with Binary heap and O(E + V*log(V)) with Fibonacci heap
Greedy Algorithm
Starts from smallest edge
Does not work for directed graphs
Works on disconnected graphs
An edge is considered only once
Better for sparse graphs
Time Complexity O (E*log(v))