DELETE clause is used to remove nodes and relationships from the graph.
Important Behavior
⚠️ Note: Deleting a node automatically deletes all of its incoming and outgoing relationships. You cannot have orphaned relationships in the graph.Deleting Nodes
To delete a node and all of its relationships:Deleting Relationships
To delete specific relationships:FRIENDS relationships from the node with name ‘Jim’, while keeping the nodes intact.
Common Patterns
Delete all nodes and relationships in a graph
DETACH DELETE automatically removes all relationships before deleting the node.
Conditional deletion
Frequently Asked Questions
What happens to relationships when I delete a node?
What happens to relationships when I delete a node?
Deleting a node automatically deletes all of its incoming and outgoing relationships. FalkorDB does not allow orphaned relationships in the graph.
What is the difference between DELETE and DETACH DELETE?
What is the difference between DELETE and DETACH DELETE?
In FalkorDB, DELETE actually implements DETACH DELETE behavior — relationships are automatically removed when their endpoint nodes are deleted. Both keywords work the same way.
How do I delete all data in a graph?
How do I delete all data in a graph?
Use
MATCH (n) DETACH DELETE n to remove all nodes and their relationships. Alternatively, use the GRAPH.DELETE command to remove the entire graph key.Can I delete specific relationships without deleting nodes?
Can I delete specific relationships without deleting nodes?
Yes. Match the relationship with an alias and delete only it:
MATCH (a)-[r:KNOWS]->(b) DELETE r. The nodes remain intact.