Overview Introduction Graph Algorithms Library Centralities Community detection Path finding Installation Resources Introduction Graph algorithms are used to compute metrics for graphs, nodes, or relationships. They can provide insights on relevant entities (centralities, ranking) in the graph or inherent structures… Read more →

Introduction

Graph algorithms are used to compute metrics for graphs, nodes, or relationships.

They can provide insights on relevant entities (centralities, ranking) in the graph or inherent structures such as communities (community-detection, graph-partitioning, clustering).

Graph Algorithms Library

Neo4j Graph Algorithms is a library that provides efficiently implemented, parallel versions of common graph algorithms for Neo4j 3.x exposed as Cypher procedures.

It currently contains implementations for the following algorithms:

Graph algorithms are used to compute metrics for graphs, nodes, or relationships.

They can provide insights on relevant entities in the graph (centralities, ranking), or inherent structures like communities (community-detection, graph-partitioning, clustering).

Many graph algorithms are iterative approaches that frequently traverse the graph for the computation using random walks, breadth-first or depth-first searches, or pattern matching.

Due to the exponential growth of possible paths with increasing distance, many of the approaches also have high algorithmic complexity.

Fortunately, optimized algorithms exist that utilize certain structures of the graph, memoize already explored parts, and parallelize operations. Whenever possible, we’ve applied these optimizations.

Centralities

These algorithms determine the importance of distinct nodes in a network:

Community detection

These algorithms evaluate how a group is clustered or partitioned, as well as its tendency to strengthen or break apart:

Path finding

These algorithms help find the shortest path or evaluate the availability and quality of routes:

Installation

The easiest way to install the Graph Algorithms library is from the Neo4j Desktop, which you can download from neo4j.com/download.

Once you have downloaded that and created a project, you can scroll down to the Plugins section, and click Install for the Graph Algorithms, and then click Install again on the pop-up message.

Install at Project Level

algo install from proj algo install from proj2

Install at Database Level

algo install from db

For more detailed instructions you can read Jennifer Reif’s blog post about adding plugins to Neo4j.

If you want to deploy Graph Algorithms outside of the Neo4j Desktop you can follow the instructions below:

  • Download the library from the downloads page and put the jar into $NEO4J_HOME/plugins
  • Add dbms.security.procedures.unrestricted=algo.\* to $NEO4J_HOME/conf/neo4j.conf
  • Restart Neo4j

We are now ready to start using the graph algorithms. Run the following query to check that the algorithms library has been picked up by Neo4j:

CALL dbms.procedures() YIELD name, signature, description
WHERE name starts with "algo"
RETURN name, signature, description

If we don’t see any rows, we will need to revisit the installation instructions.