cudd/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.
int Cudd_zddPrintCover (DdManager *zdd, DdNode *node)
 Prints a sum of products from a ZDD representing a cover.
int Cudd_zddPrintDebug (DdManager *zdd, DdNode *f, int n, int pr)
 Prints to the standard output a ZDD and its statistics.
DdGenCudd_zddFirstPath (DdManager *zdd, DdNode *f, int **path)
 Finds the first path of a ZDD.
int Cudd_zddNextPath (DdGen *gen, int **path)
 Generates the next path of a ZDD.
char * Cudd_zddCoverPathToString (DdManager *zdd, int *path, char *str)
 Converts a path of a ZDD representing a cover to a string.
DdNodeCudd_zddSupport (DdManager *dd, DdNode *f)
 Finds the variables on which a ZDD depends.
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.
int cuddZddP (DdManager *zdd, DdNode *f)
 Prints a ZDD to the standard output. One line per node is printed.
static int zp2 (DdManager *zdd, DdNode *f, st_table *t)
 Performs the recursive step of cuddZddP.
static void zdd_print_minterm_aux (DdManager *zdd, DdNode *node, int level, int *list)
 Performs the recursive step of Cudd_zddPrintMinterm.
static void zddPrintCoverAux (DdManager *zdd, DdNode *node, int level, int *list)
 Performs the recursive step of Cudd_zddPrintCover.
static void zddSupportStep (DdNode *f, int *support)
 Performs the recursive step of Cudd_zddSupport.
static void zddClearFlag (DdNode *f)
 Performs a DFS from f, clearing the LSB of the next pointers.

Detailed Description

Utility functions for ZDDs.

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

Copyright (c) 1995-2015, Regents of the University of Colorado

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Function Documentation

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:
zdd DD manager
path path of ZDD representing a cover
str pointer to string to use if != NULL
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:
dd manager
n number of output nodes to be dumped
f array of output nodes to be dumped
inames array of input names (or NULL)
onames array of output names (or NULL)
fp pointer to the dump file
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
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
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
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
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
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:
dd manager
f ZDD whose support is sought
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
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
static void zddClearFlag ( DdNode f  )  [static]

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

Side effects
None
See also:
zddSupportStep
static void zddPrintCoverAux ( DdManager zdd,
DdNode node,
int  level,
int *  list 
) [static]

Performs the recursive step of Cudd_zddPrintCover.

Side effects
None
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
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
 All Data Structures Files Functions Variables Typedefs Enumerations Defines

Generated on 31 Dec 2015 for cudd by  doxygen 1.6.1