Algorithms
What the Algorithms domain tests
The Algorithms domain checks whether you can match a graph question to the right GDS algorithm family and configure it correctly. Expect centrality, community detection, similarity, pathfinding, node embedding, and link prediction. The exam favors configuration details and output semantics over formula memorization.
Core rules
- Algorithms execute on an in-memory projected graph, not directly on the Neo4j store. The projection determines which labels, relationship types, and properties are visible.
- Execution modes differ:
streamreturns rows;statsreturns a summary only;mutatewrites a node property into the projected graph;writepersists results back to Neo4j. - Shared configuration includes
nodeLabels,relationshipTypes,relationshipWeightProperty, andconcurrency. Algorithm-specific settings, such as PageRank'sdampingFactor, change results materially. - Choose by question: PageRank for influence, Louvain or Leiden for communities, Dijkstra for weighted shortest paths, node similarity or KNN for similarity, FastRP or Node2Vec for embeddings.
Worked example
Project a weighted social graph, then stream PageRank scores:
CALL gds.graph.project('people', 'Person', {KNOWS: {properties: 'weight'}});
CALL gds.pageRank.stream('people', {relationshipWeightProperty: 'weight', dampingFactor: 0.85})
YIELD nodeId, score
RETURN gds.util.asNode(nodeId).name AS name, score
ORDER BY score DESC;
The projection must carry weight; otherwise the algorithm silently runs unweighted. PageRank propagates influence along incoming relationships, so direction and weight both affect ranking. stream is correct when the result is consumed immediately; use write only when the score must persist as a Neo4j property.
Traps
- Calling
writeand expecting a result table; it returns a summary. - Projecting a relationship property but forgetting to pass
relationshipWeightPropertyto the algorithm. - Treating a
mutateproperty as a Neo4j property; it exists only in the projected graph. - Leaving projected graphs in the catalog and consuming heap.
- Assuming every algorithm accepts the same orientation or direction options.