You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2020. It is now read-only.
This project aims to develop efficient, well tested graph algorithm implementations for Neo4j 3.1 and 3.2.
7
+
The goal of this library is to provide efficiently implemented, parallel versions of common graph algorithms for Neo4j 3.x exposed as Cypher procedures.
8
8
9
9
ifndef::env-docs[]
10
-
You can find the documentation (WIP) here http://neo4j-contrib.github.io/neo4j-graph-algorithms
10
+
You can find the documentation here http://neo4j-contrib.github.io/neo4j-graph-algorithms
11
11
endif::env-docs[]
12
12
13
13
Releases are available here: https://github.com/neo4j-contrib/neo4j-graph-algorithms/releases
14
14
15
-
The goal is to provide parallel versions of common graph algorithms for Neo4j exposed as Cypher user defined procedures:
* All Pairs- and Single Source - Shortest Path (`algo.shortestPath`, `algo.allShortestPaths`)
35
36
36
-
These procedures work on a subgraphm optionally filtered by label and relationship-type.
37
-
Future versions will also provide filtering and projection using Cypher queries.
37
+
These procedures work either on the whole graph or on a subgraph optionally filtered by label and relationship-type.
38
+
You can also use filtering and projection using Cypher queries, see below.
38
39
39
-
*We'd love your feedback*, so please try out these algorithms and let us know how well they work for your use-case.
40
-
Also please note things that you miss from installation instructions, readme, etc.
40
+
*We'd love your feedback*, so please try out these algorithms and let us know how well they work for your use-case.
41
+
Also please note things that you miss from installation instructions, documentation, etc.
41
42
42
43
Please raise https://github.com/neo4j-contrib/neo4j-graph-algorithms/issues[GitHub issues] for anything you encounter or join the http://neo4j.com/developer/slack[neo4j-users Slack group] and ask in the `#neo4j-graph-algorithm` channel.
43
44
44
45
== Installation
45
46
46
-
Just copy the `graph-algorithms-algo-*.jar` from https://github.com/neo4j-contrib/neo4j-graph-algorithms/releases[the matching release] into your `$NEO4J_HOME/plugins` directory and restart Neo4j.
47
-
48
-
Then running `call dbms.procedures();` should also list the algorithm procedures.
Just copy the `graph-algorithms-algo-*.jar` from https://github.com/neo4j-contrib/neo4j-graph-algorithms/releases[the matching release] into your `$NEO4J_HOME/plugins` directory.
57
48
58
-
[WARNING]
59
-
====
60
-
For safety reasons, in *Neo4j 3.2.x* you will need to add/enable this line in your `$NEO4J_HOME/conf/neo4j.conf`:
49
+
Because the algorithms use the lower level Kernel API to read from and write to Neo4j you also have to enable them in the configuration (for security reasons):
61
50
51
+
.Add to $NEO4J_HOME/conf/neo4j.conf
62
52
----
63
53
dbms.security.procedures.unrestricted=algo.*
64
54
----
65
-
====
66
55
56
+
Then running `call algo.list();` should list the algorithm procedures.
57
+
You can also see the full list in the documentation.
67
58
59
+
////
68
60
== Introduction
69
61
70
-
Graph theory is the study of graphs, which are mathematical structures used to model pairwise relations between nodes.
71
-
A graph is made up of nodes (vertices) which are connected by relationships (edges).
62
+
Graph theory is the study of graphs, which are mathematical structures used to model pairwise relations between nodes.
63
+
A graph is made up of nodes (vertices) which are connected by relationships (edges).
72
64
A graph may be _undirected_, meaning that there is no distinction between the two nodes associated with each relationship, or its relationships may be _directed_ from one node to another.
73
65
Relationships are what graph is all about: two nodes are joined by a relationship when they are related in a specified way.
74
-
75
-
We are tied to our friends.
76
-
Cities are connected by roads and airline routes.
77
-
Flora and fauna are bound together in a food web.
78
-
Countries are involved in trading relationships.
79
-
The World Wide Web is a virtual network of information.
80
-
81
66
82
-
* _Note that Neo4j can only save directed relationships, but we can treat them as though they are undirected when we are doing the analysis_
67
+
We are tied to our friends.
68
+
Cities are connected by roads and airline routes.
69
+
Flora and fauna are bound together in a food web.
70
+
Countries are involved in trading relationships.
71
+
The World Wide Web is a virtual network of information.
83
72
73
+
* _Note that Neo4j stores directed relationships, we can treat them as though they are undirected when we are doing the analysis_
74
+
////
84
75
85
76
== Usage
86
77
87
78
These algorithms are exposed as Neo4j procedures.
88
79
You can call them directly from Cypher in your Neo4j Browser, from cypher-shell or your client code.
89
80
90
-
For most algorithms there are two procedures, one that writes results back to the graph as node-properties and another (named `algo.<name>.stream`) that returns a stream of data, e.g. node-ids and computed values.
81
+
For most algorithms we provide two procedures, one that writes results back to the graph as node-properties and reports statistics.
82
+
And another (named `algo.<name>.stream`) that returns a stream of data, e.g. node-ids and computed values.
83
+
84
+
For large graphs the streaming procedure might return millions or billions of results, that's why it is often more convenient to store the results of the algorithm and then use them with later queries.
If label and relationship-type are not selective enough to describe your subgraph to run the algorithm on, you can use Cypher statements to load or project subsets of your graph.
115
110
Then use a node-statement instead of the label parameter and a relationship-statement instead of the relationship-type and use `graph:'cypher'` in the config.
@@ -120,22 +115,23 @@ You can also return a property value or weight (according to your config) in add
120
115
----
121
116
CALL algo.pageRank(
122
117
'MATCH (p:Page) RETURN id(p) as id',
123
-
'MATCH (p1:Page)-[:Link]->(p2:Page) RETURN id(p1) as source, id(p2) as target',
118
+
'MATCH (p1:Page)-[:Link]->(p2:Page) RETURN id(p1) as source, id(p2) as target, count(*) as weight',
124
119
{graph:'cypher', iterations:5, write: true});
125
120
----
126
121
127
122
ifndef::env-docs[]
128
-
Details on how to call the individual algorithms can be found in the http://neo4j-contrib.github.io/neo4j-graph-algorithms[project's documentation]
123
+
The detailed call syntax and all parameters and possible return values for each algorithm are listed in the http://neo4j-contrib.github.io/neo4j-graph-algorithms[project's documentation]
129
124
endif::env-docs[]
130
125
131
126
132
-
== Building
127
+
== Building Locally
133
128
134
-
Currently aiming at Neo4j 3.1 and 3.2 (in the 3.2 branch)
129
+
Currently aiming at Neo4j 3.x (with a branch per version)
0 commit comments