GRAPH.DELETE

Completely removes a graph and all of its entities (nodes and relationships).

Syntax

GRAPH.DELETE graph_name

Arguments:

  • graph_name - Name of the graph to delete

Returns: String indicating if the operation succeeded or failed.

Examples


graph.delete()

await graph.delete();

graph.delete()?;

graph.delete();

GRAPH.DELETE us_government

Deleting Individual Nodes

Note: To delete specific nodes or relationships (not the entire graph), use the Cypher DELETE clause with a MATCH query:


graph.query("MATCH (x:Y {propname: propvalue}) DELETE x")

await graph.query("MATCH (x:Y {propname: propvalue}) DELETE x");

graph.query("MATCH (x:Y {propname: propvalue}) DELETE x")?;

graph.query("MATCH (x:Y {propname: propvalue}) DELETE x");

GRAPH.QUERY DEMO_GRAPH "MATCH (x:Y {propname: propvalue}) DELETE x"

⚠️ Warning: When you delete a node using the Cypher DELETE clause, all of the node’s incoming and outgoing relationships are also automatically removed.

Frequently Asked Questions 4
Can I undo a GRAPH.DELETE operation?

No. GRAPH.DELETE permanently removes the entire graph and all its data. There is no undo. Make sure to back up your data before deleting a graph.

What is the difference between GRAPH.DELETE and the Cypher DELETE clause?

GRAPH.DELETE removes the entire graph key and all its entities. The Cypher DELETE clause within a GRAPH.QUERY removes specific nodes or relationships matched by a pattern.

Does GRAPH.DELETE block other operations?

The delete operation acquires a write lock on the graph. Any queries running against the graph will complete before the deletion proceeds, but new queries will be blocked until the deletion finishes.

What happens to relationships when I delete a node with Cypher DELETE?

All incoming and outgoing relationships connected to the deleted node are automatically removed. You do not need to delete them separately.