Added function to get shortest path from BFS