Graph Traversal DFS/BFS
Cycle Detection
Topological Sort
Shortest Path
Multi-Source BFS
Union-Find
Backtracking
Weighted Graphs
Graph Transformations
patterns:
- Grid → DFS/BFS (islands)
- Dependencies → Topological sort
- Minimum steps → BFS
- Cycle detection → DFS or Union-Find
- Groups / components → Union-Find
- Weighted edges → Dijkstra (heap)
- All paths → DFS + backtracking
models:
- DFS → explore deeply, detect cycles, enumerate paths
- BFS → shortest path, level expansion