Adiar  2.1.0
An External Memory Decision Diagram Library
Manual Construction

In some cases, one may already know the shape of an adiar::bdd for a more complex function. In those cases, it is much cheaper to construct them by hand than to manipulate logic formulas. The adiar::bdd_builder class allows you to do exactly this by providing you with the “pointers” of prior constructed nodes such that they can be referenced by new ones.

For example, consider the following BDD consisting of 3 nodes that represents the formula \( (x_0 \land x_1) \lor x_2 \).

This can be created manually using an adiar::bdd_builder (see adiar::builder for all its member functions) as follows.

const adiar::bdd_ptr p2 = b.add_node(2, false, true);
const adiar::bdd_ptr p1 = b.add_node(1, p2, true);
const adiar::bdd_ptr p0 = b.add_node(0, p2, p1);
adiar::bdd example_a = b.build();
A reduced Binary Decision Diagram.
Definition: bdd.h:53
The pointer type that builders use to identify the nodes they have constructed in a decision diagram.
Definition: builder.h:54
A builder for decision diagrams.
Definition: builder.h:146
builder_ptr< Policy > add_node(typename Policy::label_type label, const builder_ptr< Policy > &low, const builder_ptr< Policy > &high)
Add an internal node with a given label and its two children.
Definition: builder.h:235
Policy::dd_type build()
Builds the decision diagram with the added nodes. This also clears the builder.
Definition: builder.h:414