What Are the Advantages of Breadth-First Search?

If the information being sought is close to the root of where the search begins, breadth-first searching will be faster than depth-first searching. However, the total speed depends on how the information is stored.

When storing information, the structure of the information is often thought of as a tree. The root of the tree is searched first, and its branches are searched next. If the information is likely stored near the root of the tree, searching one node down on each branch before proceeding further down is more likely to yield a result faster than search the entirety of each branch before proceeding to the next.

Depending on how the data is stored, breadth-first searching may also be faster for searching the entire tree. If branches have connections with each other, it may be faster to search them together instead of having to finish a single branch before proceeding. However, these node connections are rare.

Depth-first searching is preferred if the program can determine which branch is most likely to contain the information being sought. However, depth-first search tends to be inefficient if the information sought is unlikely to appear lower on a branch. In most scenarios, reorganizing data to make it easier to search will yield better results regardless of what algorithm is searching for it.