Non-Tree DAGs
I know that there has been some discussion of representing and traversing hierarchies with SQL on this board, but I was hoping to get some advice on a somewhat different problem.
I am building a database to represent dependencies among test cases. A given test case can have 0..n dependencies and any test case can be a dependency of 0..n other cases. As of now I've got a simple relationship table that stores a dependentID and a dependencyID. The problem is that I need to create a constraint to prevent any cycles in this directed graph. I've read a few things on representing trees as adjacency lists, but this doesn't really apply since a child can have multiple parents.
If any of you SQL gurus have any insight I would love to hear it.
Thanks,
Mike
|