solved the problem of travelInShortestPath