← Lessons

quiz vs the machine

Platinum1810

Machine Learning

The Graph Of Thoughts

How merging and reusing reasoning nodes in a graph extends tree based search.

5 min read · advanced · beat Platinum to climb

Beyond a tree

A tree never lets two branches join. Graph of thoughts generalizes this: a thought can have several parents, so the agent can combine partial results from different paths into one stronger node.

What the graph allows

  • Merge: fuse two partial solutions into a combined one.
  • Reuse: a useful intermediate thought feeds many later steps instead of being recomputed.
  • Refine: loop back to improve an existing node with new information.

Edges represent operations like generate, aggregate, or improve, and the agent navigates this graph to reach a final node.

Why it helps

  • Tasks that split into parts and recombine fit a graph naturally, such as sorting chunks then merging them.
  • Sharing nodes cuts redundant work that a tree would duplicate.
  • Aggregation can beat any single branch by blending their strengths.

The trade off

The control logic is more complex than a tree, and deciding which nodes to merge needs a good heuristic. When the problem truly decomposes and recombines, the graph pays off; when it is a simple chain, it is overkill.

Key idea

Graph of thoughts lets reasoning nodes have multiple parents so partial results merge reuse and refine, beating a tree on tasks that decompose and recombine at the cost of more complex control logic.

Check yourself

Answer to earn rating on the learn ladder.

1. What does graph of thoughts add over tree of thoughts?

2. When is a graph of thoughts most worthwhile?