Animated example of a breadth-first search. Black: explored, grey: queued to be explored later on BFS on Maze-solving algorithm Top part of Tic-tac-toe game tree Breadth-first search (BFS) is an algorithm for searching a tree data structure for a node that satisfies a given property. It starts at the tree root and explores all nodes at the present depth prior to moving on to the nodes at the next
![Breadth-first search - Wikipedia](https://cdn-ak-scissors.b.st-hatena.com/image/square/4b559a3595200bbddca178ff101314da50241534/height=288;version=1;width=512/https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2F3%2F33%2FBreadth-first-tree.svg%2F1200px-Breadth-first-tree.svg.png)