Finding shortest values between the cities in a da

2019-01-29 10:46发布

问题:

I have a dataframe with cities and distance between other cities from each city. My dataset looks like,

df,

 From City      City A  City B City C  City D
 City A                 2166    577     175
 City B         2166            1806    2092
 City C         577     1806            653
 City D         175     2092    653 

im planning to visit all the cities, I am trying to find in which order by cities I can travel with the shortest distance. I want to end with a starting position. start point and end point should be same.

Is there a way to find this shortest distance across all the cities, or any other approach is available. please help.