I'm trying to sort simple list in domino style. Looping is guarranteed, but no libraries can make it. Tried to draw polygons from this using like edges, but although solution is not ambigous the plots intersects each other.
pls
Out[1293]:
[[10464, 27071],
[22358, 15839],
[10464, 24781],
[24781, 22358],
[19888, 27071],
[30361, 19784],
[19784, 19888],
[30361, 15839]]
Proper ordering is: [30361,19784,19888,27071,10464,24781,22358,15839]
Tried this:
import networkx as nx
G = nx.DiGraph()
G.add_edges_from(pls)
nx.draw(G.edges)
pol = list(nx.topological_sort(G))
but this sort returned: [30361, 19784, 19888, 10464, 24781, 22358, 15839, 27071]
which is wrong. Some web algorithm not work [Sorting tuples in Python like dominoes/ finding vertex connectivity]
I tried some lists and doing this now... maybe someone could help me, because am so tired...