When NOT to Use

Avoid forcing this pattern

Avoid forcing this pattern when:

  • Weighted edges with different costs: BFS assumes uniform edge weights. Use Dijkstra's algorithm for weighted graphs.
  • Need to explore all paths, not just shortest: BFS stops at first path found. Use DFS or backtracking for exhaustive search.
  • Memory constrained with large frontier: BFS stores entire frontier level in memory.

For wide graphs, consider iterative deepening.