Delete node and its relationships (if it has any) in Neo4j
In new Neo4j versions (since 2.3 I think) you can use such syntax:
MATCH (movie:Movie {title:"test"})
DETACH DELETE movie
There's OPTIONAL MATCH
:
MATCH (movie:Movie {title:"test"})
OPTIONAL MATCH (movie)-[r]-()
DELETE movie, r