How to implement propagation algorithms

I need to implement a custom propagation algorithm that starts from a given node and visits its neighbors and update their properties accordingly based on the previous node properties.
Example use case is, a quality flag that changed in a given node from good to bad and I need to make all the subsequent nodes become bad.

What is the recommend way of implement this efficiently in python? (I'm trying to avoid to have client code to have this graph traversal one hop at a time)

This would be fairly simple in a custom procedure. You would then use the python driver to match the root node and call the procedure to update the graph starting at the root node.

1 Like

Have you looked at our Pregel API? It's purpose built to allow folks to implement their own algorithm, using all the infrastructure of GDS: Pregel API - Neo4j Graph Data Science

1 Like

@alicia_frame1 yeah I saw Pregel and it seemed more appropriate, can you point to examples using this API? Also it has no python API, or maybe I could just use it in cypher?

there are examples of algorithms implemented in Pregel here: graph-data-science/examples/pregel-example at master · neo4j/graph-data-science · GitHub

Pregel is Java based; there's no python API.

For your use case I think you could just use LPA, right out of the box: Label Propagation - Neo4j Graph Data Science

1 Like

@alicia_frame1 LP was the first thing I looked into, I think it is same idea but I don't think I can use it as is, will try though, thanks.