Christian
Christian

Reputation: 22343

Neo4J. Remove intermediate nodes keep relationship

I've got the following node-relationship:

a-->b-->c-->d

Now I'd like to remove the nodes b and c and reconnect the both nodes a and d like that:

a-->d

Is this possible with cypher?

Upvotes: 0

Views: 263

Answers (1)

MicTech
MicTech

Reputation: 45123

It depends how your model looks like and what results you are expecting.

MATCH (a:LABEL1)-[r1]->(b:LABEL2)-[r2]->(c:LABEL3)-[r3]->(d:LABEL4) 
CREATE (a)-[:REL]->(d) 
DELETE r1, r2, r3, b, c

Upvotes: 1

Related Questions