Dropping graphs
To free up memory, we can drop unused graphs.
In order to do so, the gds.graph.drop
procedure comes in handy.
Syntax
CALL gds.graph.drop(
graphName: String,
failIfMissing: Boolean,
dbName: String,
username: String
) YIELD
graphName: String,
database: String,
databaseLocation: String,
configuration: Map,
nodeCount: Integer,
relationshipCount: Integer,
schema: Map,
schemaWithOrientation: Map,
density: Float,
creationTime: Datetime,
modificationTime: Datetime,
sizeInBytes: Integer,
memoryUsage: String
Name | Type | Optional | Description |
---|---|---|---|
graphName |
String |
no |
The name under which the graph is stored in the catalog. |
failIfMissing |
Boolean |
true |
By default, the library will raise an error when trying to remove a non-existing graph. When set to |
dbName |
String |
active database name |
Then name of the database that was used to project the graph. When empty, the current database is used. |
username |
String |
active user |
The name of the user who projected the graph. Can only be used by GDS administrator. |
Name | Type | Description |
---|---|---|
|
String |
Name of the removed graph. |
|
String |
Name of the database in which the graph has been projected. |
|
String |
Location of the database from which the graph has been projected. Can be one of |
|
Map |
The configuration used to project the graph in memory. |
|
Integer |
Number of nodes in the graph. |
|
Integer |
Number of relationships in the graph. |
|
Map |
Node labels, Relationship types and properties contained in the in-memory graph. |
|
Map |
Node labels, relationship types, relationship orientation and properties contained in the projected graph. |
|
Float |
Density of the graph. |
|
Datetime |
Time when the graph was projected. |
|
Datetime |
Time when the graph was last modified. |
|
Integer |
Number of bytes used in the Java heap to store the graph. |
|
String |
Human readable description of |
Examples
All the examples below should be run in an empty database. |
In this section we are going to demonstrate the usage of gds.graph.drop
.
All the graph names used in these examples are fictive and should be replaced with real values.
Basic usage
CALL gds.graph.drop('my-store-graph') YIELD graphName;
If we run the example above twice, the second time it will raise an error. If we want the procedure to fail silently on non-existing graphs, we can set a boolean flag as the second parameter to false. This will yield an empty result for non-existing graphs.
CALL gds.graph.drop('my-fictive-graph', false) YIELD graphName;
Multi-database support
If we want to drop a graph projected on another database, we can set the database name as the third parameter.
CALL gds.graph.drop('my-fictive-graph', true, 'my-other-db') YIELD graphName;
Multi-user support
If we are a GDS administrator and want to drop a graph that belongs to another user we can set the username as the fourth parameter to the procedure. This is useful if there are multiple users with graphs of the same name.
CALL gds.graph.drop('my-fictive-graph', true, '', 'another-user') YIELD graphName;
See Administration for more details on this.