← Problem Solving Patterns

Graph Traversal Patterns

Graph Traversal Patterns

Many interview problems become straightforward once you model them as graphs.

Tools

  • DFS for connected components and deep exploration
  • BFS for shortest path in unweighted graphs
  • Topological sort for dependency ordering

Practice

  • Number of Islands
  • Course Schedule

Practice Problems