Here's a simple graph:
(:a)-[:r]->(:b)
If want to to delete (:b)
, I can do this with:
MATCH (a)-[r]->(b :b)
DELETE a, r, b
However, (b)
can have multiple relationships and nodes coming off of it (and those nodes can recursively have more relationships and nodes too). Something like this:
(:a)-[:r]->(:b)-[:s]->(x)-[:r]->(y)- ... ->(z)
How can I recursively delete every node and relationship beyond (b)
?