- Dijkstra's Shortest path from one node to all nodes
- modified BFS for shortest path from single source to single dest in unweighted graph
- Bellman-Ford Shortest path from one node to all nodes, negative edges allowed, negative cycles allowed
- Floyd-Warshall Shortest path between all pairs of vertices, negative edges allowed
-
Prim Native implementation O(V2) Dense graph
-
Prim PQ implementation (ElogV) Sparse graph
-
Kruskal Union-Find implementation (ElogV) Larger Sparse graph
- DFS (undirected graph)
- Tarjan’s Algorithm
BFS Kahn
DFS
- One or few queries, BFS or DFS
- Many queries - use preprocessing Floyd-Warshall Algorithm -> transitive closure
