cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

(Storing Multiple Graphs in Neo4J) Using GNNs for Graph Classification

Arka161
Node Link

I have developed a Graph Classification engine - I predict if a heterograph has labels 0 or 1 (binary classification). The base model is a GNN, and I trained my model with 1000+ graphs to get desired results. 

My question is, can I store multiple graphs that I used for training in 1 Neo4J instance (eg: One Sandbox)? I am new to Neo4J and I played around with the Neo4J sandbox, but I could not find such options in the console or Cypher. 

 

For example, let us say I have 1000 graphs. Can I assign graph ID 1 to one large graph, 2 to another, etc, and store + visualize them on the Neo4J end? 

 

A better example would be: Think of 1000 "Movie" (default example) graphs in one Neo4J database. 

I was curious if this is doable in Neo4J, please let me know if there is any documentation or reference for the same, I thank you for your time and effort.  

1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja

I think I understand.  Yes, you can store these all in one database. Just label each node of an isolated graph or the root node of the graph (if that exists) so that you can query for any one or more of your graphs at any one time. 

you can achieve this by using a property (such as ‘graph_id’) or with unique labels (such as Graph12). If feel the property approach is more flexible and easier. 

did this answer your question?  If not, can you explain your requirements further?  Also, how is your data currently store to access each graph for training purposes?  

View solution in original post

4 REPLIES 4

glilienfield
Ninja
Ninja

I think I understand.  Yes, you can store these all in one database. Just label each node of an isolated graph or the root node of the graph (if that exists) so that you can query for any one or more of your graphs at any one time. 

you can achieve this by using a property (such as ‘graph_id’) or with unique labels (such as Graph12). If feel the property approach is more flexible and easier. 

did this answer your question?  If not, can you explain your requirements further?  Also, how is your data currently store to access each graph for training purposes?  

Arka161
Node Link

Thank you so much for your reply. I think it helps me a lot, and I am sorry for my delayed response to your timely and very appreciated help 🙂

 

My problem is something as follows: 

 

Objective: Classifying the "full graph". 

Data: A bunch of graphs, where the whole graphs have "one" label. 

Based on your reply, I designed the following: 

I store several graphs, and each graphs are distinguished in Cypher by an "ID" attribute for each node. And the graph ID ("gid") is specific to the graph. So when I MATCH, I can add a WHERE based on the Graph ID, and I am able to combine this with the Edge Type as well. 

My prototype for this design works well, I will accept your answer and thank you a ton 🙂 

 

 

It is much more performant to use node labels for this purpose (to create distinct graphs in the database) due to the underlying implementation of Neo4j.


So when I MATCH, I can add a WHERE based on the Graph ID, and I am able to combine this with the Edge Type as well. 

As long as the graphs are truly DISTINCT (i.e. no connecting edges), then you don't need to worry about edge / relationship types and it will just be an unnecessary complexity.

Thank you for your response. I have made the design implementation based on Node IDs for my prototype code 🙂