done the function of  travelInShortestPath with provided population table