반응형
Shortest Path Algorithms
Algorithm | Complexity | Handle Negative weight? | Properties |
---|---|---|---|
Dijkstra | O((n+m) log n) O(n^2) |
No | - Good for dense graph - Adjacency matrix is better |
Bellman-Ford | O(nm) |
Yes | - Detect negative weight cycle - Adjacency edge list is better |
DAG-based | O(n+m) |
Yes | - Graph must be acyclic - Adjacency edge list is better |
Floyd- Warshall | O(n^3) |
Yes (No negative-weight cycle) |
- Good for dense graph - Adjacency matrix is better |
반응형
'Computer Science > Algorithm' 카테고리의 다른 글
[알고리즘] 연쇄 행렬 곱셈 (Matrix-chain Multiplication) (0) | 2022.06.14 |
---|---|
[알고리즘] 스트링 편집거리 (Levenshtein Distance) (0) | 2022.06.14 |
[알고리즘] 0-1 Knapsack Problem (배낭 문제) (0) | 2022.06.14 |
[알고리즘] Graph (그래프) 용어와 표현 방법, 종류와 예시 (0) | 2022.06.14 |
[알고리즘] Backtracking, Branch & Bound (0) | 2022.06.14 |