BooleanGraph[bfunc,g1,…,gn]
给出图 g1、…、gn 中的布尔函数 bfunc 所定义的布尔图.
BooleanGraph
BooleanGraph[bfunc,g1,…,gn]
给出图 g1、…、gn 中的布尔函数 bfunc 所定义的布尔图.
更多信息和选项
- 布尔图具有由顶点列表的并集提供的顶点列表.
- 如果 bfunc[EdgeQ[g1,uv],…,EdgeQ[gn,uv]] 是 True,边 uv 位于所得的图中.
- 如果 bfunc[EdgeQ[gi,uv],…,EdgeQ[gn,uv]] 是 True,边 uv 位于所得的图中.
- GraphUnion[g1,g2] 等价于 BooleanGraph[Or,g1,g2].
- GraphIntersection[g1,g2] 等价于 BooleanGraph[And,g1,g2].
- GraphDifference[g1,g2] 等价于 BooleanGraph[#1∧¬#2&,g1,g2].
- BooleanGraph 适用于无向图、有向图、多重图和混合图.
范例
打开所有单元 关闭所有单元基本范例 (1)
范围 (5)
BooleanGraph 可用于无向图:
BooleanGraph[And, [image], [image]]BooleanGraph[Or, [image], [image]]正如布尔函数一样,BooleanGraph 可用于任意数量的图:
BooleanGraph[Or, [image], [image], [image]]BooleanGraph[And, [image], [image]]BooleanGraph[Or, [image], [image]]应用 (4)
定义对称图的差图 Xor:
{g1 = RandomGraph[{20, 30}], g2 = RandomGraph[{20, 30}]}把布尔表达式 Xor 转化为析取范式:
BooleanConvert[Xor[x, y]]GraphUnion[GraphIntersection[g1, GraphComplement[g2]], GraphIntersection[g2, GraphComplement[g1]]]通过直接使用 Xor,与结果进行比较:
IsomorphicGraphQ[%, SimpleGraph[BooleanGraph[Xor, g1, g2]]]定义图 Nand:
{g1 = RandomGraph[{20, 30}], g2 = RandomGraph[{20, 30}]}把布尔表达式 Nand 转化为析取范式:
BooleanConvert[Nand[x, y]]GraphUnion[GraphComplement[g2], GraphComplement[g1]]通过直接使用 Nand,与结果进行比较:
IsomorphicGraphQ[%, SimpleGraph[BooleanGraph[Nand, g1, g2]]]定义图 Nor:
{g1 = RandomGraph[{20, 30}], g2 = RandomGraph[{20, 30}]}把布尔表达式 Nor 转化为析取范式:
BooleanConvert[Nor[x, y]]GraphIntersection[GraphComplement[g1], GraphComplement[g2]]通过直接使用 Nor,与结果进行比较:
IsomorphicGraphQ[%, SimpleGraph[BooleanGraph[Nor, g1, g2]]]g1 = [image];g2 = [image];vc = AbsoluteOptions[g1, VertexCoordinates];使用 BooleanFunction 列举出所有二元布尔函数:
Table[TraditionalForm@BooleanFunction[i, {x, y}], {i, 0, 2 ^ 2 ^ 2 - 1}]Table[Tooltip[BooleanGraph[BooleanFunction[i, 2], g1, g2, vc, PlotLabel -> i], TraditionalForm@BooleanFunction[i, {x, y}]], {i, 0, 15}]属性和关系 (3)
GraphUnion 对应于 Or:
{g1, g2} = {[image], [image]};IsomorphicGraphQ[BooleanGraph[Or, g1, g2], GraphUnion[g1, g2]]GraphIntersection 对应于 And:
{g1, g2} = {[image], [image]};IsomorphicGraphQ[BooleanGraph[And, g1, g2], GraphIntersection[g1, g2]]BooleanGraph 不一定产生简单图:
BooleanGraph[Not, [image]]如果只需要一个简单图,则使用 SimpleGraph:
SimpleGraph[%]相关指南
-
▪
- 图的操作与修改
文本
Wolfram Research (2010),BooleanGraph,Wolfram 语言函数,https://reference.wolfram.com/language/ref/BooleanGraph.html (更新于 2014 年).
CMS
Wolfram 语言. 2010. "BooleanGraph." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2014. https://reference.wolfram.com/language/ref/BooleanGraph.html.
APA
Wolfram 语言. (2010). BooleanGraph. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/BooleanGraph.html 年
BibTeX
@misc{reference.wolfram_2026_booleangraph, author="Wolfram Research", title="{BooleanGraph}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/BooleanGraph.html}", note=[Accessed: 16-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_booleangraph, organization={Wolfram Research}, title={BooleanGraph}, year={2014}, url={https://reference.wolfram.com/language/ref/BooleanGraph.html}, note=[Accessed: 16-August-2026]}