breadth first search to find all paths