Graph management
A graph in GDS is an in-memory structure containing nodes connected by relationships. Both nodes and relationships can hold numerical attributes (properties). Graphs are stored using compressed data structures optimized for topology and property lookup operations.
Each graph has a name that can be used as a reference for management operations, or in analytical workflows that require the same graph to be processed several times. These references are stored in the graph catalog.
The graph catalog exists as long as the Neo4j instance is running. When Neo4j is restarted, graphs stored in the catalog are lost. See Backup and restore to learn how to persist your graph projections. |
Catalog operations
You can create a graph in multiple ways, depending on whether the source data is in a Neo4j database, an external source, an existing GDS graph, or random data.
Once it has been created, a reference to the graph is stored in the graph catalog. You can get information on graphs to verify that the graph has been successfully created, and to retrieve a list of all the graphs in memory.
You can also drop a graph from the catalog when it is not longer useful.
Graph operations
Read
The properties stored in the nodes and relationships of a graph can be retrieved using the stream
methods on nodes and relationships respectively.
In the Enterprise Edition, similar operations can be performed more efficiently using Apache Arrow.
Update
In-memory graphs are usually updated by algorithms running in mutate
mode, which add new properties to nodes or relationships.
Besides, you can update node labels, convert relationships from directed to undirected, and collapse path. You can also drop node properties and relationships of a given type.
Write to Neo4j
To persist the computations, you can write node properties, node labels, and relationships back to Neo4j.
Export
A whole graph can be exported by creating a new Neo4j database. To save or use the graph outside of Neo4j, you can export the graph using Apache Arrow or to disk as Csv.
Administration
Backup and restore
You can backup a graph so that it can be restored after dropping it by mistake, or after a database restart. See the Backup and restore section for examples.
Access control
Catalog operations on named graphs are bound to a specific database user. Graphs projected by a different database user are not accessible at any time, except for administrator users.