In computer science, breadth-first search (BFS) is a method used for traversing a graph. It starts at an arbitrary item of a graph and explores all of the neighbor items at the present depth prior to moving on to the items at the next depth level. A breadth-first search done on a tree (data structure) is called a level-order traversal.