Why doesn't neo4j support multiple graphs being run simultaneously?

I have a scenario like this:

  • I can have many projects. Let's say "Project A", "Project B", "Project C", etc.
  • Project A graph depends on Project B's Graph
  • Project C graph depends on Project B's Graph
  • Etc.

So, as discussed in multiple graph sessions, I think will not be a solution. Because when one graph is being run another will stop. Though the sessions run is very fast the Graph will be stopped for another project. So, I need to have all graphs running simultaneously but not by stopping other graphs.

So, I would like know if in near future, could we be able to run multiple graphs simultaneously?

Please note that I don't need to use multiple databases. It's because all projects depends on each other. So, all graphs to be inside the same database.

If the graphs are related to one another you can just keep them in the same DB, if they have overlapping namespaces, i.e. the same labels in both project A and B then prefix the labels. You can have completely disconnected graphs or connected graphs in the same DB.

What is your use case for wanting them in completely seperate DB's? You can have all graphs inside the same DB based on your graph model.

Yes, obviously. I don't want them in separate DB. I just want them in single DB with different Graphs. But neo4j doesn't allow us to run multiple Graphs simultaneously.

A single DB can have multiple graphs in it, you are unclear about your question. If you make a graph db, you can make nodes with project A and nodes for Project B and nodes for Project C such that they can interact with each other as requested in a single graph db. The fact that you don't want to shut them down because they need to interact means you should put them into a single graph db as stated.

Again what is your use-case for having them in "seperate graphs"? The definitions here are muddled, a graph db is a database which can contain multiple nodes and labels, when you say, you "don't want them in separate DB" what exactly do you mean, are you saying you don't want them on another machine? You can have multiple "graphs" - i.e. disconnected nodes and relationships in a single graph db such that they have depedencies on each other but represent Project A, B, C etc. as desired.

Not yet. Multigraph features are coming. You'll want to stay tuned for announcements regarding our 4.0 major release at the end of the year.

In the meantime, as Benjamin suggests, you'll want to use separate labels on your nodes to define and differentiate your "graphs", and add whatever filtering you need in your queries to ensure you're only working with the relevant graph nodes in a query.

1 Like

WOW, that's what I was expecting. Thanks.

In my understanding, Multigraph that @andrew_bowman suggested is different from what the original post was about. (Let me know if the Multigraph feature Andrew mentioned is different from the link I attached.)

One of my use cases for having multiple graphs inside a single database is to allow easier separation of information for different users (i.e., access control) For the example above, I want to allow User1 to query over Graph A + Graph B whereas User2 over Graph B + Graph C.

Probably a solution to this is to attach a property to all the edges and nodes representing the subgraph's label, and specify it everywhere in the queries and insertion. I think this is what @benjamin.squire suggested, but obviously it's quite a hassle.

SPARQL handles this problem with Named Graphs and can a query can be effective only for certain named graphs, which, I think, is a neat feature.

I hope I was wrong and there is a similar feature in Neo4j because I am a fan of Neo4j. Please let me know any solutions for this.

Thanks!

bk7749 has a point.

The multi-database features introduced in Neo4j 4.0 use separate distinct databases, and there is no sharing of graph elements (nodes or relationships) between them.

However, also included was enhanced role based access control, such that different roles could have different visibility over elements within the same graph, and different capabilities for matching, traversing, and writing within the same graph.

Provided that nodes are labeled appropriately, that may be one means of fulfilling the use case, and would not require explicitly including the labels in the subsequent queries themselves.

We do have attention on multi graph features for the future (multiple graphs within the same database), so that may be something to watch for in future releases.

Thanks for the quick response. I think a clever configuration of RBAC would work for me. Thanks for the pointer and I'll keep my eyes on Neo4j future releases too.

Thanks!