Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-13-2022 01:22 AM
For instance there are like 500 nodes connected to a node "X", the node "X" is connected to node "Y", between node "X" and "Y" there are 500 strings/relationship lines. I know the reason it occurs, but can I have one string/relationship line instead of 500 strings between 2 nodes?
Thanks in advance.
Solved! Go to Solution.
01-13-2022 02:01 AM
You could try something like this:
match (p:X)-[rel]->(q:Y) // match rels
with p, q, tail(collect(rel)) as rels // with tail we pick all rels except the first one
foreach(x in rels | delete x) // remove all rels except the 1st
01-13-2022 02:01 AM
You could try something like this:
match (p:X)-[rel]->(q:Y) // match rels
with p, q, tail(collect(rel)) as rels // with tail we pick all rels except the first one
foreach(x in rels | delete x) // remove all rels except the 1st
01-13-2022 08:10 AM
Maybe it is also possible to prevent the creations of these relation with use of MERGE.
Yours kindly,
Omer
02-01-2022 05:42 AM
I am actually creating nodes with merge, how do you suggest it to do?
02-02-2022 06:46 PM
Sorry, I am confused. Do you want help avoiding the creation of the 500 relationships? If so, can you provide the code that creates the relationships?
All the sessions of the conference are now available online