Neo4j Graph Algorithms - Release 3.1.5.1
Introduction
This is the first public release of the Neo4j-Graph-Algorithms library. Our thanks go to Martin Knobloch, Paul Horn and Tomaz Bratanic for all the development and documentation work on this project.
Many users expressed interest in running graph algorithms directly on Neo4j without having to employ a secondary system. We also tuned these algorithms to be as efficient as possible.
These algorithms represent user defined procedures which you can call as part of Cypher statements running on top of Neo4j.
You can find more detail in the Documentation
Algorithms
The algorithms covered by the library are:
Centrality:
- Page Rank
- Betweenness Centrality
- Closeness Centrality
Partitioning:
- Label Propagation
- (Weakly) Connected Components
- Strongly Connected Components
- Union-Find
Path Finding:
- Minimum Weight Spanning Tree
- All Pairs- and Single Source - Shortest Path
- Multi-Source Breadth-First-Search
Example
Here we run page-rank on dbpedia (11M Page-nodes, 125M Link-relationships):
CALL algo.pageRank('Page', 'Link', {write:true,iterations:20});
+--------------------------------------------------------------------------------------+
| nodes | iter | loadMillis | computeMillis | writeMillis | damping | writeProperty |
+--------------------------------------------------------------------------------------+
| 11474730 | 20 | 34106 | 9712 | 1810 | 0.85 | "pagerank" |
+--------------------------------------------------------------------------------------+
1 row
47888 ms
CALL algo.pageRank.stream('Page', 'Link', {iterations:5}) YIELD node, score
WITH * ORDER BY score DESC LIMIT 5
RETURN node.title, score;
+--------------------------------------+
| node.title | score |
+--------------------------------------+
| "United States" | 13349.2 |
| "Animal" | 6077.77 |
| "France" | 5025.61 |
| "List of sovereign states" | 4913.92 |
| "Germany" | 4662.32 |
+--------------------------------------+
5 rows
46247 ms
Installation
We provide two releases, one for Neo4j 3.1.x and one for Neo4j 3.2.x
Installation is easy; just download the jar-file from the link below, copy it into your $NEO4J_HOME/plugins
directory and restart Neo4j.
For Neo4j 3.2.x you will also have to add this line to your $NEO4J_HOME/conf/neo4j.conf
config file:
dbms.security.procedures.unrestricted=algo.*
Feedback
We would love to hear from you!
Please try out this library on your data and let us know how it worked.
Raise GitHub issues if you run into any problems and don't forget our #neo4j-graph-algorithm
channel in the neo4j-users Slack if you have questions.
Feel free to have a look at the code, give us feedback or even add your own algorithm implementation based on the existing infrastructure.
We welcome any pull request with new algorithms, bug-fixes or other improvements.