Apply Graph ML algorithms on neo4j database

Hi every one,
I am working on a knowledge graph. I generated this KG using neo4j. I plan to apply a graph ML algorithm such as GNN on this graph database. I searched similar projects. As far as I understand, in python code, i should fetch nodes and edges from neo4j and after that combine them to build the graph and apply GML algorithms on it. Is there any other approaches for this? for example to read the KG at one step (loading nodes and edges together)?
Best,
Amin

Hi @aminkeshavarzi,

There are multiple ways to go about this. Using the Neo4j Graph Data Science library (GDS) you could for example:

  • Project your Neo4j database into memory, and then run the GNN GraphSAGE on it with GDS. There are also several other node embedding and machine learning algorithms you could use in that library
  • You could also export your projection from Neo4j/GDS and then run a GNN on it with something like PyTorch Geometric. We have an example for that here where we use a GCN on the Cora dataset. At this point you have to make separate calls for exporting the nodes and the relationships
  • We also have a more KG specific example here. It uses more traditional KG embedding machine learning methods

Hope this is helpful,
Adam