Given a set of I={0,1,2,3,4}, my code produces feasible optimal routes and the results are look like below: x[0,2]=1, x[2,4]=1, x[4,3]=1 (meaning go from node 0 to node 2 then from 2 to 4, then from 4 to 3) and remaining x[i,j]=0 ( x[0,1]=0 ,x[0,3]=0 , x[2,3]=0,...).
What I need is a single list like this: FinalRoute=[0,2,4,3] which shows the same concept in a single list.
I tried to append those X where x[i,j]=1 to FinalRoute but I can't figure out the order of visited nodes. Is there any way to create a single list (FinalRoute) by appending x[i,j]s in visited order?