In [9]:
In [10]:
#format: id, (x, y), nextId, nextId, nextId, nextId
data = '''0x1b59010, (1.0, 2.0), 0x1b59450, 0x1b594b0, 0x1b59510, 0x1b594e0
0x1b59450, (1.0, 1.0), (nil), (nil), 0x1b59480, (nil)
0x1b59480, (0.0, 2.0), (nil), (nil), (nil), (nil)
0x1b594b0, (2.0, 2.0), 0x1b595a0, (nil), (nil), (nil)
0x1b595a0, (2.0, 0.0), (nil), (nil), 0x1b595d0, (nil)
0x1b595d0, (2.0, 1.0), (nil), (nil), (nil), (nil)
0x1b59510, (1.0, 3.0), (nil), (nil), 0x1b59540, (nil)
0x1b59540, (1.0, 4.0), (nil), (nil), (nil), (nil)
0x1b594e0, (3.0, 3.0), 0x1b59570, (nil), (nil), (nil)
0x1b59570, (2.0, 3.0), (nil), (nil), (nil), (nil)'''.split('\n')
In [11]:
data = [i.replace(' ', '').split(',') for i in data]
In [12]:
nodes = {i[0]:[','.join(i[1:3])]+i[3:] for i in data}
nodes
Out[12]:
In [13]:
xx, yy = [], []
for i in nodes:
c = nodes[i][0]
x, y = c.split(',')
x = float(x[1:])
y = float(y[:-1])
xx.append(x)
yy.append(y)
#print(x,y)
In [19]:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
plt.grid(1)
plt.plot(xx, yy, 'ro')
plt.plot(xx,yy,'-b')
plt.show()
In [ ]: