Implemented BFS shortest path search.