Writing Your Custom Graph Algorithms with the Pregel API in Java
In this final chapter related to creating data science projects on graphs using Neo4j and its plugins, we are going to use an advanced feature of GDS: the Pregel API. This API lets us use the optimized in-memory projected graph to run an algorithm written in Java. GDS takes care of everything else, including parallelism and how to return the result (stream or write back to Neo4j). We will use the PageRank algorithm as an example and learn about its principles before studying a small Python implementation. Then, we will implement it with the Pregel API and test our algorithm with the GDS tools. Finally, we will build the JAR file needed to run our algorithm from Cypher, like any other GDS algorithm.
In this chapter, we’re going to cover the following main topics:
- Introducing the Pregel API
- Implementing the PageRank algorithm
- Testing our code
- Using our algorithm from Cypher