Algorithms

Graph Algorithms

20 built-in graph algorithms across 5 categories, with 19 callable via CALL algo.* and 36 tests. All algorithms execute natively on the storage engine with optional label and relationship type filtering.
4
Centrality
5
Community Detection
6
Pathfinding
2
Traversal
3
Similarity

Centrality

Measure the importance or influence of nodes within the graph.

AlgorithmProcedureTests
PageRankalgo.pageRank2
Betweenness Centralityalgo.betweennessCentrality2
Closeness Centralityalgo.closenessCentrality1
Degree Centralityalgo.degreeCentrality1

Community Detection

Identify clusters or groups of densely connected nodes.

AlgorithmProcedureTests
Louvainalgo.louvain3
Label Propagationalgo.labelPropagation1
Weakly Connected Componentsalgo.weaklyConnectedComponents2
Strongly Connected Componentsalgo.stronglyConnectedComponents3
Triangle Countalgo.triangleCount1

Pathfinding

Find shortest paths, spanning trees, and topological orderings.

AlgorithmProcedureTests
Dijkstra's Shortest Pathalgo.shortestPath2
A* Search(library only)1
All Shortest Paths (BFS)algo.allShortestPaths1
K-Hop Neighborhoodalgo.kHopNeighborhood1
Minimum Spanning Treealgo.minimumSpanningTree1
Topological Sortalgo.topologicalSort2

Traversal

Systematic graph traversal algorithms.

AlgorithmProcedureTests
Breadth-First Searchalgo.bfs3
Depth-First Searchalgo.dfs2

Similarity

Compute similarity scores between pairs of nodes based on shared neighbors.

AlgorithmProcedureTests
Jaccard Similarityalgo.jaccardSimilarity3
Cosine Similarityalgo.cosineSimilarity2
Overlap Similarityalgo.overlapSimilarity2

Usage

CALL algo.pageRank('Person', 'KNOWS', {dampingFactor: 0.85, iterations: 20})
YIELD nodeId, score
RETURN algo.asNode(nodeId).name, score
ORDER BY score DESC
LIMIT 10