cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site maintenance this Wednesday, February 1. Disruptions expected as we migrate the forums.

Best way to store multiple graphs for different users

Hi, It's my very first post, so please me gentle :).

I would like to store multiple graphs in one DB. Relationship 'has' between user and graph is of cardinality one to many.

I'm wondering what would be the best way to go about this graph-architecture-wise?

I thought about adding an root node for every instance of pair (user, user's graph) and connect it to the rest of the graph with auxiliary edge that would indicate that nodes belong to the same graph (it's not mandatory that graph isn't disjointed).

Other simpler ideas were adding some identifier to every node (I was told that it wasn't the best practice) or prefixing names labels with values that would help to identify nodes.

1 REPLY 1

glilienfield
Ninja
Ninja

I have been ponder this question myself, as I am developing a SaaS application that utilizes neo4j. I have come up with three approaches, but I have not yet worked on determine which I will chose. The solution can be a hybrid of more that one approach.

  1. Store each user’s graph in a separate database. You can have the database automatically selected for the user by using ‘home databases’ or maintain your own mapping and specify the database when you create the session.

  2. Use a customer property on each node searched on and include this in every where clause to match these nodes.

  3. Use read/write access roles/permissions by label and add a customer specific label to every node for this customer. The permissions will filter out all nodes that are not labeled with this customer’s unique label.

  4. Use a combination of 1 and 2 or 1 and 3.

There are pros and cons to each. Eventually I will prototype each and see which is best.

Does anyone have experience with this? Or additional ideas?