Open xcoulon opened 7 years ago
An earlier idea of mine was to have an ltree
column in the ´links` table and use that for querying for complex graphs: https://github.com/almighty/almighty-core/issues/769
Also, postgres common table expressions might help us to traverse a graph and find cycles.
For now, the work item link repository verifies that in a given tree topology (ie, a given link type), an item has a single parent. But it does not verify that the user is about to create a cycle. There are 2 cases of cycles to support:
A->B->C-D->A
: in this case, the cycle involves the root itemA->B->C-D->B
: in this case, the cycle does not involve the root item. In that case, the current validation will find that itemB
already had a parent item,A
and will not allow the newD->B
link.Further reading: https://en.wikipedia.org/wiki/Cycle_(graph_theory)#Cycle_detection