AI Agent Architecture — ReAct, Memory, Planning and Multi-Agent Systems · Reasoning — How an LLM Thinks Before Acting
BFS vs DFS in ToT — Strategies for Searching Thought Space
Reasoning — How an LLM Thinks Before Acting
Introduction
Tree of Thoughts does not define a single search strategy — the choice between BFS (breadth-first search) and DFS (depth-first search) drastically changes the tradeoffs between cost, quality, and state memory. This lesson analyzes both algorithms in the context of thought space: when BFS is optimal, when DFS, how to implement both in Python pseudocode, and how hybrids (beam search, MCTS) combine their advantages.