diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2017-02-16 11:38:06 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2017-02-16 11:38:06 -0800 |
commit | 61b665ac8d3f107eb8ddf01f4cb816ddc3df21b0 (patch) | |
tree | 49c11dc34e1a3872974bd896140748df81d0edcc /src/bdd | |
parent | 408ce468152257ddbcbce697f26e5246618fd38b (diff) | |
download | abc-61b665ac8d3f107eb8ddf01f4cb816ddc3df21b0.tar.gz abc-61b665ac8d3f107eb8ddf01f4cb816ddc3df21b0.tar.bz2 abc-61b665ac8d3f107eb8ddf01f4cb816ddc3df21b0.zip |
Experiment with graph constuction using ZDDs.
Diffstat (limited to 'src/bdd')
-rw-r--r-- | src/bdd/extrab/extraBddMisc.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/bdd/extrab/extraBddMisc.c b/src/bdd/extrab/extraBddMisc.c index a2ba4036..44170102 100644 --- a/src/bdd/extrab/extraBddMisc.c +++ b/src/bdd/extrab/extraBddMisc.c @@ -2333,6 +2333,52 @@ void Extra_zddDumpPla( DdManager * dd, DdNode * F, int nVars, char * pFileName ) ABC_FREE( pCube ); } +/**Function************************************************************* + + Synopsis [Constructing ZDD of a graph.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Extra_GraphExperiment() +{ + int Edges[5][5] = { + {1, 3, 4}, + {1, 5}, + {2, 3, 5}, + {2, 4} + }; + int e, n; + + DdManager * dd = Cudd_Init( 0, 6, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); + + // create the edges + DdNode * zGraph, * zEdge, * zVar, * zTemp; + zGraph = DD_ZERO(dd); Cudd_Ref( zGraph ); + for ( e = 0; Edges[e][0]; e++ ) + { + zEdge = DD_ONE(dd); Cudd_Ref( zEdge ); + for ( n = 0; Edges[e][n]; n++ ) + { + zVar = cuddZddGetNode( dd, Edges[e][n], DD_ONE(dd), DD_ZERO(dd) ); Cudd_Ref( zVar ); + zEdge = Cudd_zddUnateProduct( dd, zTemp = zEdge, zVar ); Cudd_Ref( zEdge ); + Cudd_RecursiveDerefZdd( dd, zTemp ); + Cudd_RecursiveDerefZdd( dd, zVar ); + } + zGraph = Cudd_zddUnion( dd, zTemp = zGraph, zEdge ); Cudd_Ref( zGraph ); + Cudd_RecursiveDerefZdd( dd, zTemp ); + Cudd_RecursiveDerefZdd( dd, zEdge ); + } + + Cudd_zddPrintMinterm( dd, zGraph ); + + Cudd_RecursiveDerefZdd( dd, zGraph ); + Cudd_Quit(dd); +} //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |