Breadth first search on graph