A graph projection creates a separate, optimized in-memory graph from stored graph data so Graph Data Science algorithms can run scalably and in parallel. Algorithms operate on this projected graph rather than directly on the database graph. A projection can be named and reused for several algorithm runs. section 5.2 section 5.6
Choose a projection approach based on the analysis need:
- Use native projection when labels and relationship types are enough to select the graph. It reads directly from Neo4j storage and is the higher-performing option. section 5.2
- Use Cypher projection when a query must filter or transform the selected nodes and relationships, including virtual connections not stored in the database. Its flexibility comes with slower performance, so it suits exploration rather than large production graphs. section 6.1.1
- Use subgraph projection to create a new named graph from an existing in-memory graph by filtering nodes and relationships with predicates. section 7.5
Project a weighted retweet network
Match source and target users through retweet activity, count each connection as a weight, then pass the nodes and relationship property to gds.graph.project. The resulting named graph, amplify, reports its node and relationship counts and is ready for algorithms. section 6.1.1
Include the labels, relationship types, and properties that later algorithms need. For example, a follower-network projection includes precalculated node features before betweenness centrality mutates a score back into the in-memory graph; a shared-audience network includes relationship weight and can be configured as undirected for node2vec. section 8.1.2 section 9.3.3
Listing 6.3 Loading the amplify retweet network as an in-memory graph using Cypher projection
MATCH (source:User)-[:PUBLISH]->()-[:RETWEETS]->()<-[:PUBLISH]-(target:User)
WITH source, target, count(*) AS weight #1
WITH gds.graph.project(
'amplify',
source,
target, #2
{relationshipProperties:{weight:weight}}
) AS g
RETURN g.graphName AS graph,
g.nodeCount AS nodes,
g.relationshipCount AS rels
This query shows a Cypher projection that derives weighted user-to-user retweet connections and returns the name and size of the in-memory graph. section 6.1.1
Projected graphs consume memory. After the planned algorithm sequence finishes, release a named graph with gds.graph.drop(), or list projected graphs and drop each one to free memory for later analyses. section 5.4.3 section 6.3.3

