I have the following data, which represents the distances between two objects.
data = [[('123','234'), 10],
[('134','432'), 12],
]
I would like to insert this into neo4j via py2neo v3:
for e, p in enumerate(data):
#
id_left = p[0][0]
id_right = p[0][1]
distance = p[1]
#
left = Node("_id", id_left)
right = Node("_id", id_right)
G.merge(left)
G.merge(right)
r = Relationship(left,'TO', right, distance=distance)
G.create(r)
#
But I find this to be very, very slow. What's the best of speeding this up? I've looked around but haven't found any code example that illustrates clearly how to go about it
答案 0 :(得分:11)