Decide BFS vs DFS fast
- **Shortest path in unweighted graph** → BFS
- **Connected components / flood fill** → DFS or BFS
- **Cycle detection / prerequisites** → topological (Kahn) or DFS colors
- **Tree level order** → BFS
- **Subtree properties** → DFS returning aggregates
Graph interview checklist
1. Directed or undirected?
2. Weighted?
3. How is the graph given (edges, adj list, matrix)?
4. Can there be cycles / disconnected nodes?
Practice
Course Schedule (cycle in directed graph) + Serialize Tree. Draw the state machine on the whiteboard.