fabric8-services / fabric8-wit

wit stands for Work Item Tracker
http://devdoc.almighty.io/
Apache License 2.0
45 stars 86 forks source link

Detect cycles when creating/updating a work item link #1421

Open xcoulon opened 7 years ago

xcoulon commented 7 years ago

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:

Further reading: https://en.wikipedia.org/wiki/Cycle_(graph_theory)#Cycle_detection

kwk commented 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.