susiriss
susiriss

Reputation: 83

CUDD: determine if a variable is present in BDD expression

I'm using CUDD library to analyze boolean expressions. After the expression is created, I have to determine if a given variable is present in the given expression. If the expression f = AB + CD where A, B, C, D are boolean variables, I need to find if variable A is present in f's expression.

The CUDD API I have been using, which seemed to work fine for most cases is Cudd_bddVarIsDependent, where it should return 1 if the variable is dependent on the expression, but I now find a case that even if the variable is actually present in the expression, Cudd_bddVarIsDependent returns 0. So apprently, Cudd_bddVarIsDependent is not the way to do this and "dependency" doesn't mean "contains".

Consider the BDD diagram of the expression shown below.

BDD expression

And the BDD of the variable I need to check if it is contained in the above expression is below (variable index 5).variable to search for

int ret = Cudd_bddVarIsDependent(ddMgr, expr, Cudd_Regular(var))

ret is 0, even though the expression contains variable index 5.

Can anyone please let me know if there's already an API to do this, or should I traverse the expression find this out ?

Thanks

Upvotes: 0

Views: 108

Answers (0)

Related Questions