Implement BFS without the route