algorithmbinary-decision-diagram

Find unique tuples in a relation represented by a BDD


Let's suppose I use a BDD to represent the set of tuples in a relation. For simplicity consider tuples with 0 or 1 values. For instance: R = {<0,0,1>, <1,0,1>, <0,0,0>} represent a ternary relation in a BDD with three variables, say x, y and z (one for each tuple's element). What I want is to implement an operation that given a bdd like for R and a cube C returns the subset of R that contains unique tuples when the variables in C are abstracted.

For instance, if C contains the variable x (which represents the first element in each tuple) the result of the function must be {<0,0,0>}. Notice that when x is abstracted away tuples <0,0,1> and <1,0,1> become "the same".

Now suppose R = {<0,0,1>, <1,0,1>, <0,0,0>, <1,0,0>} and we want to abstract x again. In this case I would expect the constant false as result because there is no unique tuple in R after abstracting x.

Any help is highly appreciated.


Solution

  • This could be done in three simple steps:

    Applying this to your examples:

    Intuition here is that XOR will cancel entries that occur in both BDDs.
    This is easily (but with exponential complexity) generalized to the case with several abstracted variables.