dd icon indicating copy to clipboard operation
dd copied to clipboard

Support ADDs

Open danvk opened this issue 8 months ago • 3 comments

Some of the libraries that dd wraps, like CUDD, support Algebraic Decision Diagrams (ADDs) in addition to BDDs. I was just curious whether there was interest in supporting these in dd. I'd rather prototype my idea in Python than C!

danvk avatar Jun 25 '25 21:06 danvk

On branch algebraic_cudd there is a Cython interface to the algebraic decision diagram (ADD) implementation of CUDD. This interface is experimental. The relevant module is dd.cudd_add. #99 is relevant to this branch.

johnyf avatar Jun 26 '25 16:06 johnyf

Somewhat related, so I chose not to open a separate issue. It appears that both CUDD and Sylvan support MTBDDs/ADDs but restrict the output to {0, 1}.

Is there any way to support multi-valued output, i.e., BDDs with arbitrary leaves?

Edit: Never mind, I simply misread the documentation. It does look like ADDs may have any value on their leaves.

lou1306 avatar Dec 11 '25 14:12 lou1306

Yes, leaf nodes of algebraic decision diagrams in CUDD can be labeled with values of type double. For example, using the branch algebraic_cudd:

import dd.cudd_add as _agd


agd = _agd.ADD()
u = agd.constant(3.5)
v = agd.constant(3.5)
w = agd.apply('+', u, v)
print(w.value)
    # outputs 7.0

johnyf avatar Dec 11 '25 16:12 johnyf