Graph Catalog

Graph algorithms run on a graph data model which is a projection of the Neo4j property graph data model. A graph projection can be seen as a materialized view of the graph stored in a Neo4j database, containing only analytically relevant, potentially aggregated, topological and property information. Graph projections are stored entirely in-memory using compressed data structures optimized for topology and property lookup operations.

The graph catalog is a concept within the GDS library that allows managing multiple graph projections by name. Using its name, a graph projection can be used many times in the analytical workflow.

After usage, named graphs can be removed from the catalog to free up main memory. This chapter details all available graph catalog operations.

1. Considerations

1.1. Lifecycle

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.

1.2. Security

Projecting, using, listing, and dropping named graphs are management operations bound to a specific database user. Graphs projected by a different database user are not accessible at any time, except for administrator users. Read more about that in Administration.

2. Graph projections

Named graphs can be projected from a Neo4j database by using either of

But graphs can also be projected into the graph catalog from other sources. Subgraph and Graph Sampling projections allow projecting a new graph based off of an existing graph projection. Randomised graphs can be generated, and graphs can be constructed from external data via an Apache Arrow connection.

Table 1. Graph projections, adding additional graphs to the catalog:
Name Description

gds.graph.project

Adds a graph to the catalog using Native projection.

gds.graph.project

Adds a graph to the catalog using Cypher projection.

gds.beta.graph.project.subgraph

Adds a graph to the catalog by filtering an existing graph using node and relationship predicates.

gds.graph.sample.rwr

Adds a graph to the catalog by sampling an existing graph using random walk with restarts.

gds.graph.sample.cnarw

Adds a graph to the catalog by sampling an existing graph using Common Neighbour Aware Random Walk algorithm.

gds.beta.graph.generate

Creates a new random graph projection of the user-defined properties and dimensions.

gds.graph.project.cypher

Adds a graph to the catalog using Legacy Cypher projection.

3. Inspecting the graph catalog

Table 2. Graph catalog inspection operations:
Name Description

gds.graph.list

Prints information about graphs that are currently stored in the catalog.

gds.graph.exists

Checks if a named graph is stored in the catalog.

4. Modifying the graph catalog

Table 3. Graph catalog update operations:
Name Description

gds.alpha.graph.nodeLabel.mutate

Computes and adds a new node label to the graph.

gds.beta.graph.relationships.toUndirected

Converts relationship of a given type in a graph from directed to undirected.

5. Exporting from the graph catalog

Table 4. Graph catalog export operations:
Name Description

gds.graph.nodeProperty.stream

Streams a single node property stored in a named graph.

gds.graph.nodeProperties.stream

Streams node properties stored in a named graph.

gds.beta.graph.relationships.stream

Streams relationship topologies stored in a named graph.

gds.graph.relationshipProperty.stream

Streams a single relationship property stored in a named graph.

gds.graph.relationshipProperties.stream

Streams relationship properties stored in a named graph.

gds.graph.nodeProperties.write

Writes node properties stored in a named graph to Neo4j.

gds.graph.relationship.write

Writes relationships stored in a named graph to Neo4j.

gds.graph.export

Exports a named graph into a new offline Neo4j database.

gds.beta.graph.export.csv

Exports a named graph into CSV files.

6. Removing from the graph catalog

Table 5. Graph catalog removal operations:
Name Description

gds.graph.drop

Drops a named graph from the catalog.

gds.graph.nodeProperties.drop

Removes node properties from a named graph.

gds.graph.relationships.drop

Deletes relationships of a given relationship type from a named graph.