Showing results for 
Search instead for 
Did you mean: 

Versioning: How to prioritize path finding/hierarchy queries based on a relation property

Node Link

I'm searching for way of keeping different versions (modifications) in a Graph based on inheritance - Without the need of duplicating the graph

Example: Consider a sample graph (v1), now we apply some modifications (let's assume only on relations - for now), now we are in the second version/state of the graph (v2 - based on v1), but the goal is to have the both versions in the same graph & still be able to fetch data based on each version.

Suppose, we have this base graph @version-1:

then, we add some modifications in v2 of graph by adding a new node(Category4) & also updating some properties for the relation between category1,category3 (in v2). Here's the updated version (v2):

For sure, we could achieve this by cloning the graph & having different versions of graph at the same time in the database (without the need for version concept), like this:

but I was wondering if it's a proper way of preventing this duplication & somehow manage this within one graph. I know we can simply add conditions on relations' properties to check the desired version when writing any path/hierarhcy query, but I'm not sure how to prioritize a path over another in cases when we have multiple paths in different versions. Say, in the example above, when searching for path/hierarchy in v2, we should somehow ignore the v1 relation between category1 & category3 & only pickup with v2 relation between these two nodes.