Update Breadth First Search Algorithm