At my job we are trying to create paths among nodes. So, one of the results are in two columns (i, j) and we would like to create a path from that data, trying to do something like this, the column i have the control over the j, but then the second row controls the others, and so on. Thus, we can know te path of moving in these 5 nodes o points (x,y)
I have a data frame like this:
i j
1 2 3
2 3 4
3 1 5
4 5 2
5 4 1
...and I need it like this, i ir order with j:
i j
1 1 5
2 5 2
3 2 3
4 3 4
5 4 1... and so on
The final solution should be something like this: 1->5->2->3->4->1