src/sylvan_ldd.c
static size_t
lddmc_serialize_assign_rec(MDD mdd)
{
    if (mdd <= lddmc_true) return mdd;

    mddnode_t n = LDD_GETNODE(mdd);

    struct lddmc_ser s, *ss;
    s.mdd = mdd;
    ss = lddmc_ser_search(lddmc_ser_set, &s);
    if (ss == NULL) {
        // assign dummy value
        s.assigned = 0;
        ss = lddmc_ser_put(&lddmc_ser_set, &s, NULL);

        // first assign recursively
        lddmc_serialize_assign_rec(mddnode_getright(n));
        lddmc_serialize_assign_rec(mddnode_getdown(n));

        // assign real value
        ss->assigned = lddmc_ser_counter++;

        // put a copy in the reversed table
        lddmc_ser_reversed_insert(&lddmc_ser_reversed_set, ss);
    }

    return ss->assigned;
}
// Given a MDD, assign unique numbers to all nodes
Given a MDD, assign unique numbers to all nodes
Given a MDD assign unique numbers to all nodes
static size_t
lddmc_serialize_assign_rec(MDD mdd)
{
    if (mdd <= lddmc_true) return mdd;
    mddnode_t n = LDD_GETNODE(mdd);
    struct lddmc_ser s, *ss;
    s.mdd = mdd;
    ss = lddmc_ser_search(lddmc_ser_set, &s);
    if (ss == NULL) {
        s.assigned = 0;
        ss = lddmc_ser_put(&lddmc_ser_set, &s, NULL);
        lddmc_serialize_assign_rec(mddnode_getright(n));
        lddmc_serialize_assign_rec(mddnode_getdown(n));
        ss->assigned = lddmc_ser_counter++;
        lddmc_ser_reversed_insert(&lddmc_ser_reversed_set, ss);
    }
    return ss->assigned;
}
static size_t lddmc_serialize_assign_rec ( MDD mdd ) { if ( mdd <= lddmc_true ) return mdd ; mddnode_t n = LDD_GETNODE ( mdd ) ; struct lddmc_ser s , * ss ; s . mdd = mdd ; ss = lddmc_ser_search ( lddmc_ser_set , & s ) ; if ( ss == NULL ) { s . assigned = 0 ; ss = lddmc_ser_put ( & lddmc_ser_set , & s , NULL ) ; lddmc_serialize_assign_rec ( mddnode_getright ( n ) ) ; lddmc_serialize_assign_rec ( mddnode_getdown ( n ) ) ; ss -> assigned = lddmc_ser_counter ++ ; lddmc_ser_reversed_insert ( & lddmc_ser_reversed_set , ss ) ; } return ss -> assigned ; }
Given a MDD, assign unique numbers to all nodes
Given a MDD assign unique numbers to all nodes
// assign dummy value // first assign recursively // assign real value // put a copy in the reversed table