({{, (RefLink[BooleanGraph, paclet:ref/BooleanGraph])[bfunc,(Subscript[g, 1]),…,(Subscript[g, n])] 
gives the Boolean graph defined by the Boolean function bfunc on the graphs (Subscript[g, 1]), …, (Subscript[g, n]).}})

OpenersNotesSection(Spacer1)Details and Options

The Boolean graph has a vertex list given by the union of vertex lists.

An edge u->v is in the resulting graph if bfunc[(RefLink[EdgeQ, paclet:ref/EdgeQ])[(Subscript[g, 1]),u->v],…,(RefLink[EdgeQ, paclet:ref/EdgeQ])[(Subscript[g, n]),u->v]] is (RefLink[True, paclet:ref/True]).

An edge u<->v is in the resulting graph if bfunc[(RefLink[EdgeQ, paclet:ref/EdgeQ])[(Subscript[g, i]),u<->v],…,(RefLink[EdgeQ, paclet:ref/EdgeQ])[(Subscript[g, n]),u<->v]] is (RefLink[True, paclet:ref/True]).

(RefLink[GraphUnion, paclet:ref/GraphUnion])[(Subscript[g, 1]),(Subscript[g, 2])] is equivalent to (RefLink[BooleanGraph, paclet:ref/BooleanGraph])[(RefLink[Or, paclet:ref/Or]),(Subscript[g, 1]),(Subscript[g, 2])].

(RefLink[GraphIntersection, paclet:ref/GraphIntersection])[(Subscript[g, 1]),(Subscript[g, 2])] is equivalent to (RefLink[BooleanGraph, paclet:ref/BooleanGraph])[(RefLink[And, paclet:ref/And]),(Subscript[g, 1]),(Subscript[g, 2])].

(RefLink[GraphDifference, paclet:ref/GraphDifference])[(Subscript[g, 1]),(Subscript[g, 2])] is equivalent to (RefLink[BooleanGraph, paclet:ref/BooleanGraph])[#1∧¬#2&,(Subscript[g, 1]),(Subscript[g, 2])].

(RefLink[BooleanGraph, paclet:ref/BooleanGraph]) works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

OpenersPrimaryExamplesSection(Spacer1)Examples  (13)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

The Boolean combination of two graphs:

BooleanGraph[Or,,,VertexShapeFunction->"Name"]

BooleanGraph[And,,,VertexShapeFunction->"Name"]

OpenersExampleSection1(Spacer1)Scope  (5)

(RefLink[BooleanGraph, paclet:ref/BooleanGraph]) works with undirected graphs:

BooleanGraph[And,,]

Directed graphs:

BooleanGraph[Or,,]

(RefLink[BooleanGraph, paclet:ref/BooleanGraph]) works with as many graphs as the Boolean function:

BooleanGraph[Or,,,]

Multigraphs:

BooleanGraph[And,,]

Mixed graphs:

BooleanGraph[Or,,]

OpenersExampleSection3(Spacer1)Applications  (4)

Define the symmetric graph difference (RefLink[Xor, paclet:ref/Xor]):

{g1=RandomGraph[{20,30}],g2=RandomGraph[{20,30}]}

Convert the Boolean expression (RefLink[Xor, paclet:ref/Xor]) to disjunctive normal form:

BooleanConvert[Xor[x,y]]

Implement it by related functions:

GraphUnion[GraphIntersection[g1,GraphComplement[g2]],GraphIntersection[g2,GraphComplement[g1]]]

Compare to the result by using (RefLink[Xor, paclet:ref/Xor]) directly:

IsomorphicGraphQ[%,SimpleGraph[BooleanGraph[Xor,g1,g2]]]

Define the graph (RefLink[Nand, paclet:ref/Nand]):

{g1=RandomGraph[{20,30}],g2=RandomGraph[{20,30}]}

Convert the Boolean expression (RefLink[Nand, paclet:ref/Nand]) to disjunctive normal form:

BooleanConvert[Nand[x,y]]

Implement it by related functions:

GraphUnion[GraphComplement[g2],GraphComplement[g1]]

Compare to the result by using (RefLink[Nand, paclet:ref/Nand]) directly:

IsomorphicGraphQ[%,SimpleGraph[BooleanGraph[Nand,g1,g2]]]

Define the graph (RefLink[Nor, paclet:ref/Nor]):

{g1=RandomGraph[{20,30}],g2=RandomGraph[{20,30}]}

Convert the Boolean expression (RefLink[Nor, paclet:ref/Nor]) to disjunctive normal form:

BooleanConvert[Nor[x,y]]

Implement it by related functions:

GraphIntersection[GraphComplement[g1],GraphComplement[g2]]

Compare to the result by using (RefLink[Nor, paclet:ref/Nor]) directly:

IsomorphicGraphQ[%,SimpleGraph[BooleanGraph[Nor,g1,g2]]]

Compute the Boolean graph for all Boolean functions of two variables:

g1=;g2=;

vc=AbsoluteOptions[g1,VertexCoordinates];

Use (RefLink[BooleanFunction, paclet:ref/BooleanFunction]) to enumerate all Boolean functions of two variables:

Table[TraditionalForm@BooleanFunction[i,{x,y}],{i,0,2^2^2-1}]

Compute the Boolean graph using these functions:

Table[Tooltip[BooleanGraph[BooleanFunction[i,2],g1,g2,vc,PlotLabel->i],TraditionalForm@BooleanFunction[i,{x,y}]],{i,0,15}]

OpenersExampleSection4(Spacer1)Properties & Relations  (3)

(RefLink[GraphUnion, paclet:ref/GraphUnion]) corresponds to (RefLink[Or, paclet:ref/Or]):

{g1,g2}={,};

IsomorphicGraphQ[BooleanGraph[Or,g1,g2],GraphUnion[g1,g2]]

(RefLink[GraphIntersection, paclet:ref/GraphIntersection]) corresponds to (RefLink[And, paclet:ref/And]):

{g1,g2}={,};

IsomorphicGraphQ[BooleanGraph[And,g1,g2],GraphIntersection[g1,g2]]

(RefLink[BooleanGraph, paclet:ref/BooleanGraph]) does not necessarily produce simple graphs:

BooleanGraph[Not,]

Use (RefLink[SimpleGraph, paclet:ref/SimpleGraph]) if only a simple graph is needed:

SimpleGraph[%]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BooleanFunction, paclet:ref/BooleanFunction])  ▪  (RefLink[GraphUnion, paclet:ref/GraphUnion])  ▪  (RefLink[GraphIntersection, paclet:ref/GraphIntersection])  ▪  (RefLink[GraphDifference, paclet:ref/GraphDifference])  ▪  (RefLink[GraphDisjointUnion, paclet:ref/GraphDisjointUnion])  ▪  (RefLink[GraphComplement, paclet:ref/GraphComplement])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graph Operations and Modifications, paclet:guide/GraphModifications])}})}})