created function : travelInShortestPath