# 二叉决策图

二叉决策图（binary decision diagram，BDD）是一种有根有向无环图，它以计算机算法能够紧凑存储并高效操作的形式表示布尔函数。内部节点携带一个布尔变量的标签，并且始终恰有两条出边，一条对应该变量取值为0（假），另一条对应该变量取值为1（真）；标记为0或1的终端节点，为任何与从根开始追踪的路径相匹配的变量赋值给出函数值。<sup>[1](https://technav.ieee.org/topic/binary-decision-diagrams/)</sup> BDD及其变体是布尔函数最常用的数据结构之一，应用于形式验证、VLSI设计、组合优化和可靠性分析<sup>[2](https://www.sciencedirect.com/science/article/pii/S0166218X0300297X)</sup>。

| 关键事实 | 详情 |
|---|---|
| 结构 | 有根有向无环图；内部节点由变量标记，带两条出边（对应0和1），终端标记0或1<sup>[1](https://technav.ieee.org/topic/binary-decision-diagrams/)</sup> |
| 规范形式 | 归约有序BDD（ROBDD）由兰德尔·E·布莱恩特（Randal E. Bryant）于1986年提出，对固定变量顺序为每个布尔函数给出唯一图，因此等价性检查归结为比较图<sup>[1](https://technav.ieee.org/topic/binary-decision-diagrams/)</sup><sup> • </sup><sup>[3](https://dblp.org/rec/journals/tc/Bryant86.html)</sup> |
| 排序问题 | 计算最优变量排序是NP难的，某些函数（如整数乘法）在每种排序下都要求指数大小的OBDD<sup>[4](https://arxiv.org/abs/1909.12658)</sup><sup> • </sup><sup>[5](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)</sup> |
| 操作成本 | 对具有 \|G₁\| 和 \|G₂\| 个顶点的图进行二元apply操作，最坏情况成本与 \|G₁\|·\|G₂\| 成正比<sup>[6](https://watanabe.you/wiki/Binary%20Decision%20Diagram)</sup> |
| 里程碑应用 | 使用BDD的符号模型检验表示了10²⁰个状态及以上的状态空间（伯奇（Burch）、克拉克（Clarke）、麦克米伦（McMillan）、迪尔（Dill）和黄（Hwang），1992）<sup>[7](https://doi.org/10.1016%2F0890-5401%2892%2990017-A)</sup> |
| 可靠性用途 | BDD于1993年首次应用于故障树分析，此后扩展到可靠性工程<sup>[8](https://www.sciencedirect.com/science/article/abs/pii/S0307904X25001143)</sup> |
| 软件 | 广泛使用的软件包包括CUDD、BuDDy、Sylvan、多核HermesBDD以及外存软件包Adiar<sup>[9](https://github.com/ssoelvsten/adiar)</sup><sup> • </sup><sup>[10](https://arxiv.org/abs/2305.00039)</sup> |

## 结构与语义

BDD通过变量赋值所追踪的路径编码布尔函数。从根开始，求值过程在每个标记为变量xᵢ的节点处，若xᵢ = 0则沿低边前进，若xᵢ = 1则沿高边前进；路径末端到达的终端就是该赋值下函数的值<sup>[1](https://technav.ieee.org/topic/binary-decision-diagrams/)</sup>。这对应于函数围绕每个变量的香农展开（Shannon expansion），其中函数f用其限制（余因子）f\|xᵢ=0和f\|xᵢ=1表示<sup>[5](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)</sup>。

没有进一步限制时，同一函数可以画成许多不同的图。布莱恩特1986年的论文施加了两个约束，使表示成为规范的。第一，排序限制：有序BDD（OBDD）固定变量的一个排列，在从根到终端的每条路径上，变量必须按该排列一致出现<sup>[1](https://technav.ieee.org/topic/binary-decision-diagrams/)</sup><sup> • </sup><sup>[11](https://www.sciencedirect.com/topics/computer-science/binary-decision-diagram)</sup>。第二，归约规则合并等价子图，并删除两条出边指向同一子节点的节点。所得的归约有序BDD（ROBDD）在所选顺序下对每个函数唯一，因此两个函数等价当且仅当它们的图相同，可满足性测试归结为将图与常量0比较<sup>[1](https://technav.ieee.org/topic/binary-decision-diagrams/)</sup><sup> • </sup><sup>[5](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)</sup>。

## 操作

BDD软件包直接在图上支持标准布尔操作。核心原语是如果-那么-否则（If-Then-Else）过程，它为三个图计算f·g + f′·h，与、或和异或等操作由此构建<sup>[12](https://github.com/johnyf/cudd/blob/main/doc/cudd.tex.in)</sup>。对两个图的二元apply操作，最坏情况成本与它们大小的乘积成正比，尽管结果和所探索的乘积图通常更小<sup>[6](https://watanabe.you/wiki/Binary%20Decision%20Diagram)</sup>。在使用否定（补）边的实现中，求补需要常数时间，所有主要软件包都使用这一技术<sup>[13](https://github.com/tulip-control/dd/blob/main/doc.md)</sup>。

实现维护一张唯一表，将每个节点驻留，使结构相同的子图只存储一次，同时维护计算结果缓存、引用计数和垃圾回收<sup>[12](https://github.com/johnyf/cudd/blob/main/doc/cudd.tex.in)</sup>。由于许多函数的图共享子图，软件包在共享管理器上操作，其中公共子公式由内存中的公共节点表示<sup>[13](https://github.com/tulip-control/dd/blob/main/doc.md)</sup>。

## 变量排序问题

OBDD的大小强烈依赖于所选变量顺序，这是使用BDD的核心实际困难。同一函数在一种排序下可能具有多项式大小，在另一种排序下则具有指数大小<sup>[4](https://arxiv.org/abs/1909.12658)</sup>。计算最优排序是NP难的，布莱恩特证明描述整数乘法器输出的函数，其图无论输入顺序如何都随字长指数增长<sup>[4](https://arxiv.org/abs/1909.12658)</sup><sup> • </sup><sup>[5](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)</sup>。计数论证表明，某些函数在每种排序下都要求指数OBDD大小；具体例子包括乘法函数、阈值函数和除法函数<sup>[14](https://doi.org/10.1016/j.tcs.2025.115230)</sup>。

由于最优性一般难以处理，实践依赖启发式和动态重排序；动态重排序在保持所表示函数的同时改变顺序，通常通过交换相邻变量并重建图中受影响部分来实现<sup>[6](https://watanabe.you/wiki/Binary%20Decision%20Diagram)</sup>。例如，CUDD软件包提供一组动态重排序算法，包括筛选法（sifting method），它使每个变量在顺序中上下移动以找到最佳位置，并可在节点数超过阈值时自动触发重排序<sup>[12](https://github.com/johnyf/cudd/blob/main/doc/cudd.tex.in)</sup>。对于受限函数类，问题变得可处理：对于可由扇入为2的只读一次公式表示的布尔函数，最优排序具有可描述的结构，并可在线性时间内构造<sup>[15](https://www.sciencedirect.com/science/article/pii/S0166218X99002103)</sup>。

精确优化也已从算法上得到研究。弗里德曼（Friedman）和索波维特（Supowit）给出一个确定性算法，对n个变量具有O\*(3ⁿ)时间和空间复杂度，远优于平凡的暴力上界O\*(n!·2ⁿ)；量子计算研究者谷诚一郎（Seiichiro Tani）于2019年证明，量子算法可以在O\*(2.77286ⁿ)时间和空间内以指数小误差产生具有最优排序的最小OBDD<sup>[4](https://arxiv.org/abs/1909.12658)</sup>。

## 大小：可表示什么

排序限制在最坏情况下损失表达能力，但在实践中遇到的大多数函数上换来紧凑性。布莱恩特的分析表明，所有对称函数，包括偶校验和奇校验函数——它们是积之和等经典表示的最坏情况——都具有顶点数最多随参数个数平方增长的OBDD<sup>[5](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)</sup>。这一限制涉及表示大小而非逻辑表达能力，因为每个有限布尔函数都有某个BDD<sup>[6](https://watanabe.you/wiki/Binary%20Decision%20Diagram)</sup>。

变体以规范性质换取特定函数类的更小表示。零抑制BDD（ZDD）提供稀疏集的紧凑表示，用于离散优化和枚举<sup>[4](https://arxiv.org/abs/1909.12658)</sup>。代数决策图（ADD），也称为多终端BDD（MTBDD），将终端从0和1推广到任意值，允许紧凑表示具有数值输出的函数。

## 应用

**形式验证。** 最有影响力的应用是符号模型检验。伯奇、克拉克、麦克米伦、迪尔和黄于1992年发表在《信息与计算》上的论文用BDD符号地表示状态空间，而不是显式地表示为列表，并处理了10²⁰个状态及以上的系统<sup>[7](https://doi.org/10.1016%2F0890-5401%2892%2990017-A)</sup>。基于BDD的模型检验在接下来的十年中被成功用于验证有限状态系统，如时序电路和协议；后来，有界模型检验转而使用命题SAT求解器，部分原因是基于BDD的表示存在不可预测的内存需求<sup>[16](https://kilthub.cmu.edu/articles/journal_contribution/Bounded_Model_Checking/6603944)</sup>。现代硬件模型检验使用组合方法，结合基于SAT、SMT和BDD的引擎<sup>[17](https://www.mdpi.com/1999-4893/17/6/253)</sup>。

**可靠性与安全性分析。** BDD于1993年首次应用于故障树分析，此后为复杂系统的可靠性分析开发了多种形式的决策图，应用领域包括太空探索、核电、无线传感器网络和云计算<sup>[8](https://www.sciencedirect.com/science/article/abs/pii/S0307904X25001143)</sup>。由于为故障树的BDD找到好的事件排序在计算上难以处理，已为该领域开发了专门的启发式方法<sup>[18](https://journals.sagepub.com/doi/10.1177/1748006X19879305)</sup>。

**其他领域。** OBDD还用于机器学习、组合问题和知识表示，BDD编译应用于可配置软件中的特征模型，其中该表示支持可满足性求解、模型计数、采样和高效等价性检查<sup>[4](https://arxiv.org/abs/1909.12658)</sup><sup> • </sup><sup>[19](https://doi.org/10.1016/j.jss.2025.112566)</sup>。

## 历史

C. Y. 李（C. Y. Lee）于1959年引入用于表示开关电路的二叉决策程序，谢尔顿·阿克斯（Sheldon Akers）进一步研究了该表示，其工作推广了图表示法<sup>[8](https://www.sciencedirect.com/science/article/abs/pii/S0307904X25001143)</sup><sup> • </sup><sup>[5](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)</sup>。兰德尔·E·布莱恩特当时在加州理工学院，后来在卡内基梅隆大学，于1986年8月在《IEEE计算机汇刊》第C-35卷第8期第677至691页发表了《基于图的布尔函数操作算法》（Graph-Based Algorithms for Boolean Function Manipulation）；该论文中的排序限制和归约规则使图成为规范、可高效操作的数据结构<sup>[3](https://dblp.org/rec/journals/tc/Bryant86.html)</sup><sup> • </sup><sup>[5](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)</sup>。布莱恩特在1992年发表于《ACM计算综述》的综述《用有序二叉决策图进行符号布尔操作》（Symbolic Boolean Manipulation with Ordered Binary Decision Diagrams）中扩展了论述<sup>[20](https://www.cs.cmu.edu/~bryant/pubs.html)</sup>。

实现工作一直持续至今。由科罗拉多大学博尔德分校的法比奥·索门齐（Fabio Somenzi）开发的CUDD长期作为参考C软件包<sup>[12](https://github.com/johnyf/cudd/blob/main/doc/cudd.tex.in)</sup>。较新的系统解决不同的瓶颈：HermesBDD是一个多核C++软件包，其并行If-Then-Else实现在n皇后基准上比非并行基线显示出18.73倍加速<sup>[10](https://arxiv.org/abs/2305.00039)</sup>；Adiar应用外存算法，使BDD操作在图超出主内存时仍然高效<sup>[9](https://github.com/ssoelvsten/adiar)</sup>。

## References

1. [Binary decision diagrams, IEEE Technology Navigator](https://technav.ieee.org/topic/binary-decision-diagrams/)
2. [BDDs—design, analysis, complexity, and applications, Discrete Applied Mathematics 138(1-2):229-251 (2004)](https://www.sciencedirect.com/science/article/pii/S0166218X0300297X)
3. [Randal E. Bryant, Graph-Based Algorithms for Boolean Function Manipulation, IEEE Trans. Computers 35(8):677-691 (1986), dblp record](https://dblp.org/rec/journals/tc/Bryant86.html)
4. [Seiichiro Tani, Quantum Algorithm for Finding the Optimal Variable Ordering for Binary Decision Diagrams, arXiv:1909.12658](https://arxiv.org/abs/1909.12658)
5. [Randal E. Bryant, Graph-Based Algorithms for Boolean Function Manipulation (1986 paper PDF)](https://people.eecs.berkeley.edu/~russell/classes/cs289/f04/readings/Bryant%3A1986.pdf)
6. [Binary Decision Diagram (wiki overview of construction and operations)](https://watanabe.you/wiki/Binary%20Decision%20Diagram)
7. [Burch, Clarke, McMillan, Dill, Hwang, Symbolic Model Checking: 10²⁰ States and Beyond, Information and Computation 98(2):142-170 (1992)](https://doi.org/10.1016%2F0890-5401%2892%2990017-A)
8. [A review of decision diagrams in system reliability modeling and analysis, Applied Mathematical Modelling](https://www.sciencedirect.com/science/article/abs/pii/S0307904X25001143)
9. [Adiar: An I/O-efficient implementation of (Binary) Decision Diagrams, GitHub](https://github.com/ssoelvsten/adiar)
10. [Capogrosso et al., HermesBDD: A Multi-Core and Multi-Platform Binary Decision Diagram Package, arXiv:2305.00039](https://arxiv.org/abs/2305.00039)
11. [Binary decision diagram, ScienceDirect Topics overview](https://www.sciencedirect.com/topics/computer-science/binary-decision-diagram)
12. [CUDD documentation (cudd.tex.in), GitHub](https://github.com/johnyf/cudd/blob/main/doc/cudd.tex.in)
13. [dd documentation, tulip-control, GitHub](https://github.com/tulip-control/dd/blob/main/doc.md)
14. [Quantum algorithm for finding the optimal variable ordering for binary decision diagrams, Theoretical Computer Science (2025)](https://doi.org/10.1016/j.tcs.2025.115230)
15. [Optimal ordered binary decision diagrams for read-once formulas, Discrete Applied Mathematics 103:237-258 (2000)](https://www.sciencedirect.com/science/article/pii/S0166218X99002103)
16. [Biere, Cimatti, Clarke, Strichman, Zhu, Bounded Model Checking (2003)](https://kilthub.cmu.edu/articles/journal_contribution/Bounded_Model_Checking/6603944)
17. [Hardware Model Checking Algorithms and Techniques, Algorithms 17(6):253 (2024)](https://www.mdpi.com/1999-4893/17/6/253)
18. [Banov, Šimić, Grgić, A new heuristics for the event ordering in binary decision diagram applied in fault tree analysis (2020)](https://journals.sagepub.com/doi/10.1177/1748006X19879305)
19. [Tailoring binary decision diagram compilation for feature models, Journal of Systems and Software (2025)](https://doi.org/10.1016/j.jss.2025.112566)
20. [Randal E. Bryant publication list, Carnegie Mellon University](https://www.cs.cmu.edu/~bryant/pubs.html)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › Formal logic and foundations › Logical calculi and logical syntax › Propositional logic › Normal forms and PDAGs

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/binary-decision-diagram

English original: https://www.edgepedia.org/binary-decision-diagram
