Similar to how in a relational database you could have multiple databases on the same DB server, is it possible to save multiple graphs in the same Memgraph instance?
If not, what would be the best way to logically separate such graphs?
Similar to how in a relational database you could have multiple databases on the same DB server, is it possible to save multiple graphs in the same Memgraph instance?
If not, what would be the best way to logically separate such graphs?
You can achieve this behavior using labels. For example, you can add the label GraphOne
to each node of the first graph, the label GraphTwo
to each node of the second graph, and so on. Nodes can have multiple labels, so you can still keep the original labels and the new ones that tell you which graph a specific node belongs to. You can use the same technique to save multilayer networks.
Aside from this method, the only other option is to fire up a new instance.
If you are worried about lots of metadata, the label will not use up a lot of memory, so not much overhead is added. Additional security can be implemented by requiring the use of these labels in each query. For example, if you are connecting with GQLAlchemy, you check each query to see if it contains an appropriate label (GraphOne, GraphTwo, etc.) and throw an error if it's not included.