Breadth first search in graphs.