Chain Reduction for Binary and Zero-Suppressed Decision Diagrams
Abstract
Chain reduction enables reduced ordered binary decision diagrams (BDDs) and zero-suppressed binary decision diagrams (ZDDs) to each take advantage of the others’ ability to symbolically represent Boolean functions in compact form. For any Boolean function, its chain-reduced ZDD (CZDD) representation will be no larger than its ZDD representation, and at most twice the size of its BDD representation. The chain-reduced BDD (CBDD) of a function will be no larger than its BDD representation, and at most three times the size of its CZDD representation. Extensions to the standard algorithms for operating on BDDs and ZDDs enable them to operate on the chain-reduced versions. Experimental evaluations on representative benchmarks for encoding word lists, solving combinatorial problems, and operating on digital circuits indicate that chain reduction can provide significant benefits in terms of both memory and execution time.
1 Introduction
Decision diagrams (DDs) encode sets of values in compact forms, such that operations on the sets can be performed on the encoded representation, without expanding the sets into their individual elements. In this paper, we consider two classes of decision diagrams: reduced ordered binary decision diagrams (BDDs) [4] and zero-suppressed binary decision diagrams (ZDDs) [11, 12]. These two representations are closely related to each other, with each achieving more compact representations for different classes of applications. We present extensions to both representations, such that BDDs can take advantage of the source of compaction provided by ZDDs, and vice-versa.
Size bound relations between different representations
These results indicate that the two compressed representations will always be within a small constant factor (2 for CZDDs and 3 for CBDDs) of either a BDD or a ZDD representation. While one representation may be more slightly compact than the other, the relative advantage is bounded by a constant factor, and hence choosing between them is less critical.
Reductions in BDDs and ZDDs. Each reduces the representation size with edges between nonconsecutive levels.
2 Related Work
In independent work, van Dijk and his colleages devised a hybrid of BDDs and ZDDs they call tagged BDDs [6]. Their representation augments BDDs by associating a variable with each edge, in addition to the variable associated with each node, enabling them to represent both BDD and ZDD reductions along each edge. For any function, a tagged BDD is guaranteed to have no more nodes than either its BDD or its ZDD representation. They avoid the constant factor in node growth that CBDDs or CZDDs may require, at the cost of requiring storage for three variables per node (one for the node, and one for each of the outgoing edges) versus two. Choosing between their representation or ours depends on a number of implementation factors. Both achieve the larger goal of exploiting the reductions enabled by both BDDs and ZDDs.
3 BDDs and ZDDs
Both BDDs and ZDDs encode sets of binary sequences of length n as directed acyclic graphs with two leaf nodes, labeled with values \(\mathbf{0}\) and \(\mathbf{1}\), which we refer to as “leaf \(\mathbf{0}\)” and “leaf \(\mathbf{1}\),” respectively. Each nonleaf node v has an associated level l, such that \(1 \le l \le n\), and two outgoing edges, labeled \({ lo}\) and \({ hi}\) to either a leaf node or a nonleaf node. By convention, leaf nodes have level \(n+1\). An edge from v to node u having level \(l'\) must have \(l < l'\).
Graph A represents S as a levelized binary decision diagram, where an edge from a node with level l must connect to either leaf \(\mathbf{0}\) or to a node with level \(l+1\). Each path from the root to leaf \(\mathbf{1}\) encodes an element of set S. For a given path, the represented sequence has value 0 at position l when the path follows the \({ lo}\) edge from the node with level l and value 1 when the path follows the \({ hi}\) edge.
Graph A has nodes forming two linear chains: a don’t-care chain, consisting of nodes a and b, and an or chain, consisting of nodes d, e, and f. A don’t-care chain is a series of don’t-care nodes, each having its two outgoing edges directed to the same next node. In terms of the set of represented binary sequences, a don’t-care node with level l allows both values 0 and 1 at sequence position l. An or chain consists of a sequence where the outgoing \({ hi}\) edges for the nodes all go the same node—in this case, leaf \(\mathbf{0}\). An or chain where all \({ hi}\) edges lead to leaf \(\mathbf{0}\) has only a single path, assigning value 0 to the corresponding positions in the represented sequence. We will refer to this special class of or chain as a zero chain.
BDDs and ZDDs differ from each other in the interpretations they assign to a level-skipping edge, when a node with level l has an edge to a node with level \(l'\) such that \(l + 1 < l'\). For BDDs, such an edge is considered to encode a don’t-care chain. Thus, graph B in Fig. 2 shows an BDD encoding set S. The edge on the left from level 1 to level 4 is equivalent to the don’t-care chain formed by nodes a and b of graph A. For ZDDs, a level skipping edge encodes a zero chain. Thus, graph C shows a ZDD encoding set S. The edge on the right from level 1 to the leaf encodes the zero chain formed by nodes d, e, and f of graph A. Whether the set is encoded as a BDD or a ZDD, one type of linear chains remains. Introducing chain reduction enables BDDs and ZDDs to exploit both don’t-care and or (and therefore zero) chains to compress their representations.
4 Chain Patterns and Reductions
Figure 3 shows the general form of or and don’t-care chains, as were illustrated in the examples of Fig. 2. These chains have levels ranging from t to b, such that \(1 \le t < b \le n\). Each form consists of a linear chain of nodes followed by two nodes f and g with levels greater than b. Nodes f and g are drawn as triangles to indicate that they are the roots of two subgraphs in the representation. In an or chain, the \({ lo}\) edge from each node is directed to the next node in the chain, and the \({ hi}\) edge is directed to node g. The chains eliminated by ZDDs are a special case where \(g = \mathbf{0}\). In a don’t-care chain, both the \({ lo}\) and the \({ hi}\) edges are directed toward the next node in the chain.

Chain patterns. These patterns remain after BDD reduction (A), and ZDD reduction (B), but can be represented in compressed form (C).
Chain Reduction Examples. Each now reduces both chain types.
Figure 4 shows the effect of chain reduction, starting with the levelized graph A. In the CBDD (B), a single node \(f'\) replaces the or chain consisting of nodes d, e, and f. In the CZDD (C), the don’t-care chain consisting of nodes a and b is incorporated into node c to form node \(c'\). These new nodes are drawn in elongated form to emphasize that they span a range of levels, but it should be emphasized that all nodes in a chained representation have an associated pair of levels.
To generalize from these examples, let us denote a node of the form illustrated in Fig. 3(C) with the modified if-then-else notation Open image in new window . That is, the node has a range of levels from t to b, an outgoing \({ hi}\) edge to node g, and an outgoing \({ lo}\) edge to node f.
A BDD representation of a function can be transformed into a CBDD as follows. The process starts by labeling each node having level l in the BDD with the pair Open image in new window , such that \(t = b = l\). Then, we repeatedly apply a reduction rule, replacing any pair of nodes u and v of the form Open image in new window
and Open image in new window
by the single node Open image in new window
. A similar process can transform any ZDD representation of a function into a CZDD, using the reduction rule that a pair of nodes u and v of the form Open image in new window
and Open image in new window
is replaced by the single node Open image in new window
. In practice, most algorithms for constructing decision diagrams operate from the bottom up. The reduction rules are applied as nodes are created, and so unreduced nodes are never actually generated.
5 Size Ratio Bounds
These reduction rules allows us to bound the relative sizes of the different representations, as given by (5) and (6).
First, let us consider (5), bounding the relative sizes of the CBDD and CZDD representations of a function. Consider a graph G representing function f as a CZDD. We can generate a CBDD representation \(G'\) as follows. \(G'\) contains a node \(v'\) for each node v in G. However, if v has levels Open image in new window , then \(v'\) has levels Open image in new window
, because any don’t-care chain encoded explicitly in the CZDD is encoded implicitly in a CBDD.
Consider an edge from node u to node v in G, where the nodes have levels Open image in new window and Open image in new window
, respectively. If \(t_v = b_u+1\), then there can be an edge directly from \(u'\) to \(v'\). If \(t_v < b_u+1\), then we introduce a new node to encode the implicit zero chain in G from u to v. This node has the form Open image in new window
and has an edge from \(u'\) to it.
Worst case example for effectiveness of CBDD compression. The implicit zero chains in the ZDD (A) must be explicitly encoded in the CBDD (B), increasing its size by a factor of 3.
This bound is tight—Fig. 5 illustrates the reduced representations for a family of functions, parameterized by a value k (\(k=3\) in the example), such that the function is defined over \(3k+2\) variables. The ZDD and CZDD representations are identical (A), having \(2k+3\) nodes (including both leaf nodes.) The CBDD representation has \(6k+2\) nodes (B). We can see in this example that the CBDD requires nodes (shown in gray) to encode the zero chains that are implicit in the ZDD.

Worst case example for effectiveness of CZDD compression. The nodes in the BDD (A) must be duplicated to encode the incoming don’t-care chains (B), increasing the size by a factor of 2.
This bound is also tight—Fig. 6 illustrates the reduced representations for a family of functions, parameterized by a value k (\(k=3\) in the example), such that the function is defined over \(2k+1\) variables. The BDD representations (A) has \(2k+3\) nodes (including both leaf nodes). The CZDD representation has \(4k+3\) nodes (B). We can see that most of the nodes in the BDD must be duplicated: once with no incoming don’t-care chain, and once with a chain of length one.
As can be seen in Fig. 1, these bounds contain an asymmetry between BDDs and ZDDs and their compressed forms. The bound of 3 holds between CBDDs and CZDDs, and hence by transitivity between CBDDs and ZDDs, while the bound of 2 holds only between CZDDs and BDDs. The general form of the or chain (Fig. 3(A)), where g is something other than \(\mathbf{0}\), cannot be directly encoded with CZDD nodes.
6 Operating on CBDDs and CZDDs
The apply algorithms for decision diagrams operate by recursively expanding a set of argument decision diagrams according to a Shannon expansion of the represented functions [4, 5]. These algorithms allow functions to be combined according to standard binary Boolean operations, as well as by the if-then-else operation \(\text{ ITE }\).

- 1.
If one of the terminal cases apply, then return the result.
- 2.
If the computed cache contains an entry for this combination of operation and arguments, then return the previously computed result.
- 3.Recursively compute the result:
- (a)
Choose splitting level(s) based on the levels of the arguments.
- (b)
Generate \({ hi}\) and \({ lo}\) cofactors for each argument.
- (c)
Recursively compute the \({ hi}\) and \({ lo}\) values of the result using the apply algorithm with the \({ hi}\) cofactors and the \({ lo}\) cofactors, respectively.
- (d)
Determine the result node parameters based on the computed \({ hi}\) and \({ lo}\) cofactors, the splitting level(s), and the reduction rules.
- (e)
Either reuse an existing node or create a new one with the desired level(s) and \({ hi}\) and \({ lo}\) children.
- (a)
- 4.
Store an entry in the computed cache.
- 5.
Return the computed value.
In generalizing from conventional BDDs and ZDDs to their chained versions, we need only modify 3(a) (splitting), 3(b) (cofactoring), and 3(d) (combining) in this sequence. In the following presentation, we first give formal definitions and then provide brief explanations.


Case | Condition | ||
---|---|---|---|
1 | \(b < t_i\) | \(v_i\) | \(v_i\) |
2 | \(b = b_i\) | \(f_i\) | \(g_i\) |
3 | \(t_i \le b < b_i\) | \(g_i\) |
- Case 1:
-
Splitting spans levels less than the top level of \(v_i\). Since level-skipping edges encode don’t-care chains, both cofactors equal the original node.
- Case 2:
-
Splitting spans the same levels as node \(v_i\). The cofactors are therefore the nodes given by the outgoing edges.
- Case 3:
-
Splitting spans a subset of the levels covered by node \(v_i\). We construct a new node spanning the remaining part of the encoded or chain for the \({ lo}\) cofactor and have \(g_i\) as the \({ hi}\) cofactor.
- Case 1:
-
The \({ hi}\) and \({ lo}\) cofactors are identical, and so the don’t-care reduction rule can be applied.
- Case 2:
-
Chain compression can be applied to create a node that absorbs the \({ lo}\) cofactor.
- Case 3:
-
No special rules apply.
Similar rules hold for applying operations to CZDDs, although there are important differences, due to the different interpretations of level-skipping edges.
Case | Condition | ||
---|---|---|---|
1 | \(b < t_i\) | \(v_i\) | \(\mathbf{0}\) |
2 | \(b = b_i\) | \(f_i\) | \(g_i\) |
3 | \(t_i \le b < b_i\) |
- Case 1:
-
The splitting spans levels less than the top level of \(v_i\). Since level-skipping edges encode zero chains, the \({ lo}\) cofactor equals the original node and the \({ hi}\) cofactor equals leaf \(\mathbf{0}\).
- Case 2:
-
The splitting spans the same levels as node \(v_i\). The cofactors are therefore the nodes given by the outgoing edges.
- Case 3:
-
The splitting spans a subset of the levels covered by node \(v_i\). We construct a new node spanning the remaining part of the encoded don’t-care chain for both cofactors.
- Case 1:
-
The zero-suppression rule can be applied to return a direct pointer to \(u_0\)
- Case 2:
-
The zero-suppression rule can be applied, but we must construct a node encoding the don’t-care chain between levels t and \(b-1\).
- Case 3:
-
Chain compression can be applied to create a node that absorbs the \({ lo}\) cofactor.
- Case 4:
-
No special rule applies.
7 Experimental Results
We implemented both CBDDs and CZDDs by modifying version 3.0.0 of the CUDD BDD package [14]. When compiled for 64-bit execution, CUDD stores a 32-bit field index in each node, where this index is translated into a level according to the variable ordering. For our implementation, we split this field into two 16-bit fields index and bindex to (indirectly) encode the top and bottom levels of the node. Thus, there was no storage penalty for the generalization to a chained form.
CUDD uses complement edges when representing BDDs [2, 13]. Complement edges can potentially reduce the size of a BDD by a factor of two, invalidating the size ratio bounds derived in (5) and (6). For our experimental results, we therefore use a representation based on CUDD’s support for Algebraic Decision Diagrams (ADDs) [1]. ADDs generalize BDDs by allowing arbitrary leaf values. Restricting the leaf values to 0 and 1 yields conventional BDDs without complement edges.
To evaluate the effectiveness of chain reduction, we chose three different categories of benchmarks to compare the performance of BDDs, ZDDs, and their chained versions. One set of benchmarks evaluated the ability of DDs to represent information in compact form, a second to evaluate their ability to solve combinatorial problems, and a third to represent typical digital logic functions. All experiments were performed on a 4.2 GHz Intel Core i7 processor with 32 GB of memory running the OS X operating system.
7.1 Encoding a Dictionary
As has been observed [9], a list of words can be encoded as a function mapping strings in some alphabet to either 1 (included in list) or 0 (not included in list). Strings can further be encoded as binary sequences by encoding each symbol as a sequence of bits, allowing the list to be represented as a Boolean function. We consider two possible encodings of the symbols, defining the radix r to be the number of possible symbols. A one-hot encoding (also referred to as a “1-of-N” encoding) requires r bits per symbol. Each symbol is assigned a unique position, and the symbol is represented with a one in this position and zeros in the rest. A binary encoding requires \(\lceil \log _2 r \rceil \) bits per symbol. Each symbol is assigned a unique binary pattern, and the symbol is represented by this pattern. Lists consisting of words with multiple lengths can be encoded by introducing a special “null” symbol to terminate each word.
Node counts and ratios of node counts for dictionary benchmarks
Figure 7 shows the number of nodes required to represent word lists as Boolean functions, according to the different lists, encodings, and DD types. The entry labeled “(C)ZDD” gives the node counts for both ZDDs and CZDDs. These are identical, because there were no don’t-care chains for these functions. The two columns on the right show the ratios between the different DD types. Concentrating first on one-hot encodings, we see that the chain compression of CBDDs reduces the size compared to BDDs by large factors (15.50–34.03). Compared to ZDDs, representing the lists by CBDDs incurs some penalty (2.05–2.10), but less than the worst-case penalty of 3. Increasing the radix from a compact form to the full ASCII character set causes a significant increase in BDD size, but this effect is eliminated by using the zero suppression capabilities of CBDDs, ZDDs, and CZDDs.
Using a binary encoding of the symbols reduces the variances between the different encodings and DD types. CBDDs provide only a small benefit (1.11–1.23) over BDDs, and CBDDs are within a factor of 1.50 of ZDDs. Again, chaining of ZDDs provides no benefit. Observe that for both lists, the most efficient representation is to use either ZDDs or CZDDs with a one-hot encoding. The next best is to use CBDDs with a one-hot encoding, and all three of these are insensitive to changes in radix. These cases demonstrate the ability of ZDDs (and CZDDs) to use very large, sparse encodings of values. By using chaining, CBDDs can also take advantage of this property.
Impact of chaining on effort required to generate DD representations of word lists.
With unchained ZDDs, many of the intermediate functions have large don’t-care chains. For example, the ZDD representation of the function x, for variable x, requires \(n+2\) nodes—one for the variable, \(n-1\) for the don’t-care chains before and after the variable, and two leaf nodes. With chaining, this function reduces to just four nodes: the upper don’t-care chain is incorporated into the node for the variable, and a second node encodes the lower chain. Our dictionary benchmarks have over 4,000 variables, and so some of the intermediate DDs can be more than 1,000 times more compact due to chaining.
7.2 The 15-Queens Problem
A second set of benchmarks involved representing all possible solutions to the n-queens problem [12] as a Boolean function. This problem attempts to place n queens on a \(n\times n\) chessboard in such a way that no two queens can attack each other. For our benchmark we chose \(n = 15\) to stay within the memory limit of the processor being used.
Once again, there are two choices for encoding the positions of queens on the board. A one-hot encoding uses a Boolean variable for each square. A binary encoding uses \(\lceil \log _2 n \rceil = 4\) variables for each row, encoding the position of the queen within the row.
Node counts and ratios of node counts for 15-queens benchmarks
Figure 9 shows the node counts for the different benchmarks. It shows both the size of the final function representing all solutions to the 15-queens problem, as well as the peak size, computed as the maximum across all rows of the combined size of the functions that are maintained to express the constraints imposed by the row and those below it. For both the top-down and the center-first benchmarks, this maximum was reached after completing row 3. Typically the peak size was around three times larger than the final size.
Effect of chaining for ZDD representations of 15-queens benchmarks
Figure 10 compares the sizes of the ZDD and CZDD representations of the 15-queens functions. We can see that the final sizes are identical—there are no don’t-care chains in the functions encoding problem solutions. For the top-down ordering, CZDDs also offer only a small advantage for the peak requirement. For the center-first ordering, especially with a one-hot encoding, however, we can see that CZDDs are significantly (3.81\(\times \)) more compact. As the construction for row 3 completes, the variables that will encode the constraints for rows 2 and 5 remain unconstrained, yielding many don’t-care chains. Once again, this phenomenon is much smaller with a binary encoding.
7.3 Digital Circuits
Node counts and ratios of node counts for digital circuit benchmarks
Figure 11 presents data on the sizes of the DDs to represent all of the circuit outputs. We do not present any data for CBDDs, since these were all close in size to BDDs. We can see that the ZDD representations for these circuits are always larger than the BDD representations, by factors ranging up to 8.31. Using CZDDs mitigates that effect, yielding a maximum size ratio of 1.38.
8 Observations
Our experiments, while not comprehensive, demonstrate that chaining can allow BDDs to make use of large, sparse encodings, one of the main strengths of ZDDs. They also indicate that CZDDs may be the best choice overall. CZDDs have all of the advantages of ZDDs, while avoiding the risk of intermediate functions growing excessively large due to don’t-care chains. They are guaranteed to stay within a factor of 2\(\times \) of BDDs. Even for digital circuit functions, we found this bound to be conservative—all of the benchmarks stayed within a factor of 1.4\(\times \).
Notes
Acknowledgements
This work was supported, in part, by NSF STARSS grant 1525527.
References
- 1.Bahar, R.I., Frohm, E.A., Gaona, C.M., Hachtel, G.D., Macii, E., Pardo, A., Somenzi, F.: Algebraic decision diagrams and their applications. In: Proceedings of the International Conference on Computer-Aided Design, pp. 188–191, November 1993Google Scholar
- 2.Brace, K.S., Rudell, R.L., Bryant, R.E.: Efficient implementation of a BDD package. In: Proceedings of the 27th ACM/IEEE Design Automation Conference, pp. 40–45, June 1990Google Scholar
- 3.Brglez, F., Fujiwara, H.: A neutral netlist of 10 combinational benchmark circuits and a target translator in Fortran. In: 1985 International Symposium on Circuits And Systems (1985)Google Scholar
- 4.Bryant, R.E.: Graph-based algorithms for Boolean function manipulation. IEEE Trans. Comput. C-35(8), 677–691 (1986)CrossRefGoogle Scholar
- 5.Bryant, R.E.: Binary decision diagrams. In: Clarke, E.M., Henzinger, T.A., Veith, H., Bloem, R. (eds.) Handbook of Model Checking. Springer, Heidelberg (2017). https://doi.org/10.1007/978-3-319-10575-8CrossRefGoogle Scholar
- 6.van Dijk, T., Wille, R., Meolic, R.: Tagged BDDs: combining reduction rules from different decision diagram types. In: Formal Methods in Computer-Aided Design, pp. 108–115 (2017)Google Scholar
- 7.Fujita, M., Fujisawa, H., Kawato, N.: Evaluation and improvements of Boolean comparison method based on binary decision diagrams. In: Proceedings of the International Conference on Computer-Aided Design, pp. 2–5, November 1988Google Scholar
- 8.Hansen, M., Yalcin, H., Hayes, J.P.: Unveiling the ISCAS-85 benchmarks: a case study in reverse engineering. IEEE Des. Test 16(3), 72–80 (1999)CrossRefGoogle Scholar
- 9.Knuth, D.E.: The Art of Computer Programming: Combinatorial Algorithms, Part I, vol. 4A. Addison Wesley, Reading (2011)MATHGoogle Scholar
- 10.Malik, S., Wang, A., Brayton, R.K., Sangiovanni-Vincentelli, A.L.: Logic verification using binary decision diagrams in a logic synthesis environment. In: Proceedings of the International Conference on Computer-Aided Design, pp. 6–9, November 1988Google Scholar
- 11.Minato, S.: Zero-suppressed BDDs for set manipulation in combinatorial problems. In: Proceedings of the 30th ACM/IEEE Design Automation Conference, pp. 272–277, June 1993Google Scholar
- 12.Minato, S.: Binary Decision Diagrams and Applications for VLSI CAD. Kluwer Academic Publishers, Norwell (1995)MATHGoogle Scholar
- 13.Minato, S., Ishiura, N., Yajima, S.: Shared binary decision diagrams with attributed edges for efficient Boolean function manipulation. In: Proceedings of the 27th ACM/IEEE Design Automation Conference, pp. 52–57, June 1990Google Scholar
- 14.Somenzi, F.: Efficient manipulation of decision diagrams. Int. J. Softw. Tools Technol. Transf. 3(2), 171–181 (2001)MATHGoogle Scholar
Copyright information
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made. The images or other third party material in this book are included in the book's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the book's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.