display | more...
A method of searching a tree that always searches one level of the tree before moving on to the next. For example, the following tree:
   / | \
  B  E  F
 / \   /|\
C   D G H I
will be searched in the order ABEFCDGHI if a breadth-first search is performed on it (searching leftmost items first).

In agenda-based searching, that corresponds to the following steps:

  • Add the first node to the agenda (in this case, A).
  • Examine the first node on the agenda to see if it is the required item.
  • Otherwise, expand the node (find all its children), and add those children to the end of the agenda.
  • Repeat the second and third steps until the goal is reached.
The fact that the nodes are always added to the end of the agenda is what makes this a breadth-first search; all the siblings of a node are examined before its children are. Contrast this to depth-first search.

The advantages to breadth-first search (over depth-first search) is that it is often faster, and will always find the shortest path possible. It can also deal with looping structures without getting stuck. The disadvantage is that it takes a lot of memory, and is therefore prone to failure when all available memory is used up.

A more memory-efficient compromise between breadth-first and depth-first search is known as the iterative deepening search.