cudd  3.0.0
The University of Colorado Decision Diagram Package
Functions
cuddZddUtil.c File Reference

Utility functions for ZDDs. More...

#include "util.h"
#include "cuddInt.h"
Include dependency graph for cuddZddUtil.c:

Functions

int Cudd_zddPrintMinterm (DdManager *zdd, DdNode *node)
 Prints a disjoint sum of product form for a ZDD. More...
 
int Cudd_zddPrintCover (DdManager *zdd, DdNode *node)
 Prints a sum of products from a ZDD representing a cover. More...
 
int Cudd_zddPrintDebug (DdManager *zdd, DdNode *f, int n, int pr)
 Prints to the standard output a ZDD and its statistics. More...
 
DdGenCudd_zddFirstPath (DdManager *zdd, DdNode *f, int **path)
 Finds the first path of a ZDD. More...
 
int Cudd_zddNextPath (DdGen *gen, int **path)
 Generates the next path of a ZDD. More...
 
char * Cudd_zddCoverPathToString (DdManager *zdd, int *path, char *str)
 Converts a path of a ZDD representing a cover to a string. More...
 
DdNodeCudd_zddSupport (DdManager *dd, DdNode *f)
 Finds the variables on which a ZDD depends. More...
 
int Cudd_zddDumpDot (DdManager *dd, int n, DdNode **f, char const *const *inames, char const *const *onames, FILE *fp)
 Writes a dot file representing the argument ZDDs. More...
 
int cuddZddP (DdManager *zdd, DdNode *f)
 Prints a ZDD to the standard output. One line per node is printed. More...
 
static int zp2 (DdManager *zdd, DdNode *f, st_table *t)
 Performs the recursive step of cuddZddP. More...
 
static void zdd_print_minterm_aux (DdManager *zdd, DdNode *node, int level, int *list)
 Performs the recursive step of Cudd_zddPrintMinterm. More...
 
static void zddPrintCoverAux (DdManager *zdd, DdNode *node, int level, int *list)
 Performs the recursive step of Cudd_zddPrintCover. More...
 
static void zddSupportStep (DdNode *f, int *support)
 Performs the recursive step of Cudd_zddSupport. More...
 
static void zddClearFlag (DdNode *f)
 Performs a DFS from f, clearing the LSB of the next pointers. More...
 

Detailed Description

Utility functions for ZDDs.

Author
Hyong-Kyoon Shin, In-Ho Moon, Fabio Somenzi

Function Documentation

◆ Cudd_zddCoverPathToString()

char* Cudd_zddCoverPathToString ( DdManager zdd,
int *  path,
char *  str 
)

Converts a path of a ZDD representing a cover to a string.

The string represents an implicant of the cover. The path is typically produced by Cudd_zddForeachPath. If the str input is NULL, it allocates a new string. The string passed to this function must have enough room for all variables and for the terminator.

Returns
a pointer to the string if successful; NULL otherwise.
Side effects None
See also
Cudd_zddForeachPath
Parameters
zddDD manager
pathpath of ZDD representing a cover
strpointer to string to use if != NULL

◆ Cudd_zddDumpDot()

int Cudd_zddDumpDot ( DdManager dd,
int  n,
DdNode **  f,
char const *const *  inames,
char const *const *  onames,
FILE *  fp 
)

Writes a dot file representing the argument ZDDs.

Writes a file representing the argument ZDDs in a format suitable for the graph drawing program dot. Cudd_zddDumpDot does not close the file: This is the caller responsibility. Cudd_zddDumpDot uses a minimal unique subset of the hexadecimal address of a node as name for it. If the argument inames is non-null, it is assumed to hold the pointers to the names of the inputs. Similarly for onames. Cudd_zddDumpDot uses the following convention to draw arcs:

  • solid line: THEN arcs;
  • dashed line: ELSE arcs.

The dot options are chosen so that the drawing fits on a letter-size sheet.

Returns
1 in case of success; 0 otherwise (e.g., out-of-memory, file system full).
Side effects None
See also
Cudd_DumpDot Cudd_zddPrintDebug
Parameters
ddmanager
nnumber of output nodes to be dumped
farray of output nodes to be dumped
inamesarray of input names (or NULL)
onamesarray of output names (or NULL)
fppointer to the dump file

◆ Cudd_zddFirstPath()

DdGen* Cudd_zddFirstPath ( DdManager zdd,
DdNode f,
int **  path 
)

Finds the first path of a ZDD.

Defines an iterator on the paths of a ZDD and finds its first path.

A path is represented as an array of literals, which are integers in {0, 1, 2}; 0 represents an else arc out of a node, 1 represents a then arc out of a node, and 2 stands for the absence of a node. The size of the array equals the number of variables in the manager at the time Cudd_zddFirstCube is called.

The paths that end in the empty terminal are not enumerated.

Returns
a generator that contains the information necessary to continue the enumeration if successful; NULL otherwise.
Side effects The first path is returned as a side effect.
See also
Cudd_zddForeachPath Cudd_zddNextPath Cudd_GenFree Cudd_IsGenEmpty

◆ Cudd_zddNextPath()

int Cudd_zddNextPath ( DdGen gen,
int **  path 
)

Generates the next path of a ZDD.

Generates the next path of a ZDD onset, using generator gen.

Returns
0 if the enumeration is completed; 1 otherwise.
Side effects The path is returned as a side effect. The generator is
modified.
See also
Cudd_zddForeachPath Cudd_zddFirstPath Cudd_GenFree Cudd_IsGenEmpty

◆ Cudd_zddPrintCover()

int Cudd_zddPrintCover ( DdManager zdd,
DdNode node 
)

Prints a sum of products from a ZDD representing a cover.

Returns
1 if successful; 0 otherwise.
Side effects None
See also
Cudd_zddPrintMinterm

◆ Cudd_zddPrintDebug()

int Cudd_zddPrintDebug ( DdManager zdd,
DdNode f,
int  n,
int  pr 
)

Prints to the standard output a ZDD and its statistics.

The statistics include the number of nodes and the number of minterms. (The number of minterms is also the number of combinations in the set.) The statistics are printed if pr > 0. Specifically:

  • pr = 0 : prints nothing
  • pr = 1 : prints counts of nodes and minterms
  • pr = 2 : prints counts + disjoint sum of products
  • pr = 3 : prints counts + list of nodes
  • pr > 3 : prints counts + disjoint sum of products + list of nodes
Returns
1 if successful; 0 otherwise.
Side effects None

◆ Cudd_zddPrintMinterm()

int Cudd_zddPrintMinterm ( DdManager zdd,
DdNode node 
)

Prints a disjoint sum of product form for a ZDD.

Returns
1 if successful; 0 otherwise.
Side effects None
See also
Cudd_zddPrintDebug Cudd_zddPrintCover

◆ Cudd_zddSupport()

DdNode* Cudd_zddSupport ( DdManager dd,
DdNode f 
)

Finds the variables on which a ZDD depends.

Returns
a BDD consisting of the product of the variables if successful; NULL otherwise.
Side effects None
See also
Cudd_Support
Parameters
ddmanager
fZDD whose support is sought

◆ cuddZddP()

int cuddZddP ( DdManager zdd,
DdNode f 
)

Prints a ZDD to the standard output. One line per node is printed.

Returns
1 if successful; 0 otherwise.
Side effects None
See also
Cudd_zddPrintDebug

◆ zdd_print_minterm_aux()

static void zdd_print_minterm_aux ( DdManager zdd,
DdNode node,
int  level,
int *  list 
)
static

Performs the recursive step of Cudd_zddPrintMinterm.

Side effects None

◆ zddClearFlag()

static void zddClearFlag ( DdNode f)
static

Performs a DFS from f, clearing the LSB of the next pointers.

Side effects None
See also
zddSupportStep

◆ zddPrintCoverAux()

static void zddPrintCoverAux ( DdManager zdd,
DdNode node,
int  level,
int *  list 
)
static

Performs the recursive step of Cudd_zddPrintCover.

Side effects None

◆ zddSupportStep()

static void zddSupportStep ( DdNode f,
int *  support 
)
static

Performs the recursive step of Cudd_zddSupport.

Performs a DFS from f. The support is accumulated in supp as a side effect. Uses the LSB of the then pointer as visited flag.

Side effects None
See also
zddClearFlag

◆ zp2()

static int zp2 ( DdManager zdd,
DdNode f,
st_table t 
)
static

Performs the recursive step of cuddZddP.

Returns
1 in case of success; 0 otherwise.
Side effects None