breadth first search algorithm implementation (unweighted edges)