I have a graph with nodes, and I need to follow from leaf to root, and to know the single path - even when there are two parents for some of the nodes. Example - Child
is the same concept, that can belong to Parent 1
or Parent 2
. Leaf 1
and Leaf 2
are also concepts that belong to Child
either through Parent 1
or Parent 2
. So it can happen that some nodes under Leaf 1
have parent structure of Parent 1 -> Child -> Leaf 1 -> *
or Parent 2 -> Child -> Leaf 1 -> *
. If modeled using the following approach, that information is lost:
So far, I have a few approaches to disambiguate this:
First one is duplicating all the nodes - everything is separated (at a cost of duplication).
Second one is using labels on the edges - but still duplicating some of the nodes:
And the third one is also using labels - without duplicating nodes, but labels are further away from parents:
Is there any other solution for this? Are there any best practices in modelling this kind of graph?
Aucun commentaire:
Enregistrer un commentaire