py2neo relationship issue

20 views
Skip to first unread message

Frederic

unread,
Mar 30, 2017, 11:28:36 AM3/30/17
to Neo4j
Hi,

I have the following issue, i want to graph routes with relationships from devices to devices depending on the destination.
So i've got a loop looking like this :

for i in range(len(Super)):
    
    A=Node(tt, name=Super[i][1])
    graph.merge(A)
    B=Node(uu, name=dd)
    graph.merge(B)
    
    graph.create(Relationship(A, "Route", B,dst=Super[i][0]))

But when i do this there is only one route between A and B (file : notalltheroutes)


- if i do a create for node B like this :

for i in range(len(Super)):
    
    A=Node(tt, name=Super[i][1])
    graph.merge(A)
    B=Node(uu, name=dd)
    graph.create(B)
    
    graph.create(Relationship(A, "Route", B,dst=Super[i][0])

I've got all the routes but destination nodes are duplicated (file : alltheroutes)

How to do to have all the routes without duplicate nodes ?

Thanks.



notalltheroutes.jpg
alltheroutes.jpg
Reply all
Reply to author
Forward
0 new messages