BFS breadth first search is another building block algorithm. It's built from a queue and a visited marker array.