tulip-control/dd

Question: Conversion function returning empty DiGraph

AfiaAly opened this issue · 0 comments

Hi,
I'm having trouble converting my bdd to a networkx.MultiDiGraph. After calling _bdd.to_nx(mybdd, mybdd.roots), I am returned a MultiDiGraph with 0 nodes and 0 edges. I'm not sure what I'm doing wrong. My suspicion is that I'm messing something up with the roots parameter, but I don't exactly understand what it is or where/how to get it. Here's a snippet of my code.

from dd import autoref as autoref_bdd
from dd import bdd as _bdd

bdd = autoref_bdd.BDD()
expr = r'{}'.format(booleanFormula)
u = bdd.add_expr(expr)

bdd.collect_garbage()

filename = 'dump.p'
bdd.dump(filename)
other_bdd = _bdd.BDD()
roots = other_bdd.load(filename)

G = _bdd.to_nx(other_bdd, other_bdd.roots)
print(G)

I'm not sure what the difference between the dd.autoref and dd.bdd packages is, other than the fact that autoref is a wrapper of bdd as mentioned in the README. For some reason, the to_nx() function is only implemented in dd.bdd, and is not defined in dd.autoref. The reason I'm using two seperate BDDs and dumping/loading them is because mybdd.roots is not an attribute in dd.bdd, but it is in dd.autoref. I am almost sure I am doing something wrong, but I couldn't find any examples, so I just found some random workarounds. Could someone tell me what I'm doing wrong, and maybe explain what roots is and how I'm supposed to use to_nx()?

Thanks in advance!
Aly