Hi,
I have two nodes as shown below:
I want to merge the two relations and keep the properties as separate ones. How can I do that?
I am trying to use apoc.refactor.MergeRelationship, but it's showing me an error that the relationships need to be of same direction. Some of the relationships of such type in my graph does not have the same direction.
Thanks a lot!
Are there any values that the two relations you want to merge share? From the diagram above, it doesn't look like they share the same relationship type....so you might need to refactor manually.
Something like this?
MATCH (n:8)-[r:REL_TYPE]->(m:4)
WHERE (n)<-[r2:OTHER_TYPE]-(m)
MERGE (n)-[r3:NEW_TYPE]->(m)
SET r3 += r
WITH n, m, r, r2, r3
SET r3 += r2
DELETE r, r2
RETURN *