Overview Introduction Graph Algorithms Library Centralities Community Detection Path Finding Installation Further reading 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… Learn 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:

Centralities

  • Page Rank (algo.pageRank)
  • Betweenness Centrality (algo.betweenness)
  • Closeness Centrality (algo.closeness)

Community Detection

  • Louvain (algo.louvain)
  • Label Propagation (algo.labelPropagation)
  • (Weakly) Connected Components (algo.unionFind)
  • Strongly Connected Components (algo.scc)
  • Triangle Count / Clustering Coefficient (algo.triangleCount)

Path Finding

  • Minimum Weight Spanning Tree (algo.mst)
  • All Pairs- and Single Source – Shortest Path (algo.shortestPath, algo.allShortestPaths)

Installation

  • 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’re 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’ll need to revisit the installation instructions.

Further reading

We have an Algorithms section in the user guide which goes into the history of each algorithm and the use cases for which they’re applicable.

Our colleague Amy Holder has also written an excellent blog post – The Top 13 Resources for Understanding Graph Theory & Algorithms – in which she lists some of her favorite books and online courses.