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.
| Algorithm | Procedure | Tests |
|---|---|---|
| PageRank | algo.pageRank | 2 |
| Betweenness Centrality | algo.betweennessCentrality | 2 |
| Closeness Centrality | algo.closenessCentrality | 1 |
| Degree Centrality | algo.degreeCentrality | 1 |
Community Detection
Identify clusters or groups of densely connected nodes.
| Algorithm | Procedure | Tests |
|---|---|---|
| Louvain | algo.louvain | 3 |
| Label Propagation | algo.labelPropagation | 1 |
| Weakly Connected Components | algo.weaklyConnectedComponents | 2 |
| Strongly Connected Components | algo.stronglyConnectedComponents | 3 |
| Triangle Count | algo.triangleCount | 1 |
Pathfinding
Find shortest paths, spanning trees, and topological orderings.
| Algorithm | Procedure | Tests |
|---|---|---|
| Dijkstra's Shortest Path | algo.shortestPath | 2 |
| A* Search | (library only) | 1 |
| All Shortest Paths (BFS) | algo.allShortestPaths | 1 |
| K-Hop Neighborhood | algo.kHopNeighborhood | 1 |
| Minimum Spanning Tree | algo.minimumSpanningTree | 1 |
| Topological Sort | algo.topologicalSort | 2 |
Traversal
Systematic graph traversal algorithms.
| Algorithm | Procedure | Tests |
|---|---|---|
| Breadth-First Search | algo.bfs | 3 |
| Depth-First Search | algo.dfs | 2 |
Similarity
Compute similarity scores between pairs of nodes based on shared neighbors.
| Algorithm | Procedure | Tests |
|---|---|---|
| Jaccard Similarity | algo.jaccardSimilarity | 3 |
| Cosine Similarity | algo.cosineSimilarity | 2 |
| Overlap Similarity | algo.overlapSimilarity | 2 |
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