Binary decision diagram
In computer science, a binary decision diagram or branching program is a data structure that is used to represent a Boolean function. On a more abstract level, BDDs can be considered as a compressed representation of sets or relations. Unlike other compressed representations, operations are performed directly on the compressed representation, i.e. without decompression. Other data structures used to represent Boolean functions include negation normal form, Zhegalkin polynomials, and propositional directed acyclic graphs.
Definition
A Boolean function can be represented as a rooted, directed, acyclic graph, which consists of several decision nodes and terminal nodes. There are two types of terminal nodes called 0-terminal and 1-terminal. Each decision node is labeled by Boolean variable and has two child nodes called low child and high child. The edge from node to a low child represents an assignment of to 0.Such a BDD is called 'ordered' if different variables appear in the same order on all paths from the root. A BDD is said to be 'reduced' if the following two rules have been applied to its graph:
- Merge any isomorphic subgraphs.
- Eliminate any node whose two children are isomorphic.
A path from the root node to the 1-terminal represents a variable assignment for which the represented Boolean function is true. As the path descends to a low child from a node, then that node's variable is assigned to 0.
Example
The left figure below shows a binary decision tree, and a truth table, each representing the function f. In the tree on the left, the value of the function can be determined for a given variable assignment by following a path down the graph to a terminal. In the figures below, dotted lines represent edges to a low child, while solid lines represent edges to a high child. Therefore, to find, begin at x1, traverse down the dotted line to x2, then down two solid lines. This leads to the terminal 1, which is the value of f.The binary decision tree of the left figure can be transformed into a binary decision diagram by maximally reducing it according to the two reduction rules. The resulting BDD is shown in the right figure.
History
The basic idea from which the data structure was created is the Shannon expansion. A switching function is split into two sub-functions by assigning one variable. If such a sub-function is considered as a sub-tree, it can be represented by a binary decision tree. Binary decision diagrams were introduced by Lee, and further studied and made known by Akers and Boute.The full potential for efficient algorithms based on the data structure was investigated by Randal Bryant at Carnegie Mellon University: his key extensions were to use a fixed variable ordering and shared sub-graphs. Applying these two concepts results in an efficient data structure and algorithms for the representation of sets and relations. By extending the sharing to several BDDs, i.e. one sub-graph is used by several BDDs, the data structure Shared Reduced Ordered Binary Decision Diagram is defined. The notion of a BDD is now generally used to refer to that particular data structure.
In his video lecture Fun With Binary Decision Diagrams , Donald Knuth calls BDDs "one of the only really fundamental data structures that came out in the last twenty-five years" and mentions that Bryant's 1986 paper was for some time one of the most-cited papers in computer science.
Adnan Darwiche and his collaborators have shown that BDDs are one of several normal forms for Boolean functions, each induced by a different combination of requirements. Another important normal form identified by Darwiche is Decomposable Negation Normal Form or DNNF.
Applications
BDDs are extensively used in CAD software to synthesize circuits and in formal verification. There are several lesser known applications of BDD, including fault tree analysis, Bayesian reasoning, product configuration, and private information retrieval.Every arbitrary BDD can be directly implemented in hardware by replacing each node with a 2 to 1 multiplexer; each multiplexer can be directly implemented by a 4-LUT in a FPGA. It is not so simple to convert from an arbitrary network of logic gates to a BDD.
Variable ordering
The size of the BDD is determined both by the function being represented and the chosen ordering of the variables. There exist Boolean functions for which depending upon the ordering of the variables we would end up getting a graph whose number of nodes would be linear at the best and exponential at the worst case. Consider the Boolean functionUsing the variable ordering, the BDD needs 2n+1 nodes to represent the function. Using the ordering, the BDD consists of 2n + 2 nodes.
It is of crucial importance to care about variable ordering when applying this data structure in practice.
The problem of finding the best variable ordering is NP-hard. For any constant c > 1 it is even NP-hard to compute a variable ordering resulting in an OBDD with a size that is at most c times larger than an optimal one. However, there exist efficient heuristics to tackle the problem.
There are functions for which the graph size is always exponential — independent of variable ordering. This holds e.g. for the multiplication function. In fact, the function computing the middle bit of the product of two -bit numbers does not have an OBDD smaller than vertices.
For cellular automata with simple behavior, the minimal BDD typically grows linearly on successive steps. For rule 254, for example, it is 8t+2, while for rule 90 it is 4t+2. For cellular automata with more complex behavior, it typically grows roughly exponentially. Thus for rule 30 it is and for rule 110. The size of the minimal BDD can depend on the order in which variables are specified; thus for example, just reflecting rule 30 to give rule 86 yields.
Researchers have suggested refinements on the BDD data structure giving way to a number of related graphs, such as BMD, ZDD, FDD, PDD, and MTBDDs.
Logical operations on BDDs
Many logical operations on BDDs can be implemented by polynomial-time graph manipulation algorithms:However, repeating these operations several times, for example forming the conjunction or disjunction of a set of BDDs, may in the worst case result in an exponentially big BDD. This is because any of the preceding operations for two BDDs may result in a BDD with a size proportional to the product of the BDDs' sizes, and consequently for several BDDs the size may be exponential. Also, since constructing the BDD of a Boolean function solves the NP-complete Boolean satisfiability problem and the co-NP-complete tautology problem, constructing the BDD can take exponential time in the size of the Boolean formula even when the resulting BDD is small.
Computing existential abstraction over multiple variables of reduced BDDs is NP-complete.
Model-counting, counting the number of satisfying assignments of a Boolean formula, can be done in polynomial time for BDDs. For general propositional formulas the problem is ♯P-complete and the known best algorithms require an exponential time in the worst case.