I have a dataset with start and end locations in 2 seperate columns. The data is shuffled. The end location is the new start location in another row. How can I sort this to get an output like this
Before
Barcelona -> Paris
Madrid ->New York
Paris -> Madrid
After:
Barcelona -> Paris
Paris -> Madrid
Madrid ->New York
...