change the structure of getShortestPath