IncidenceGraph - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Logic : IncidenceGraph

Logic

  

IncidenceGraph

  

construct incidence graph for Boolean expression

  

PrimalGraph

  

construct primal graph for Boolean expression

 

Calling Sequence

Parameters

Options

Description

Definitions

Examples

References

Compatibility

Calling Sequence

IncidenceGraph(expr, opts)

PrimalGraph(expr, opts)

Parameters

expr

-

Boolean expression in conjunctive normal form

opts

-

(optional) zero or more options as specified below

Options

• 

output=list or one of expressions or graph

  

a list of one or more of the symbols expressions or group, or one of the symbols expressions or graph.

  

The symbol graph corresponds to the graph of the requested type constructed from expr. (lead=indent) The symbol expressions is the list of variables and clauses of expr in the order specified in the output graph.

• 

weighted=true or false

  

If weighted=true, PrimalGraph returns a weighted graph where the weight of each edge between variables u and v is the number of clauses in which both u and v appear, divided by n*(n-1)/2 where n is the number of variables in expr. The default is false.

  

Note this option is only supported for PrimalGraph.

• 

datatype= one of float[4], float[8], or anything

  

Specifies the data type of the weight matrix when weighted=true. When datatype=anything, the weight matrix contains exact rational numbers corresponding to the computed weighted. Otherwise, the entries will be floating-point numbers of the specified precision. The default is anything.

  

Note this option is only supported for PrimalGraph and only has an effect if weighted'=true.

Description

• 

The IncidenceGraph command computes the incidence graph of a given Boolean expression expr.

• 

The PrimalGraph command computes the primal graph of a given Boolean expression expr.

• 

The result of both commands is a Graph object and can be examined and visualized using the tools in the GraphTheory package.

• 

The expression expr must be in conjunctive normal form (CNF). If not already in CNF, expr can be converted to CNF using Normalize; alternatively, Tseitin may be used to find an equisatifiable expression in CNF.

Definitions

• 

A primal graph of a Boolean expression expr, also called the variable incidence graph is a graph whose vertices are the variables of expr. An edge exists between two variables if they occur together in a clause of expr, in either negated or non-negated form.

• 

An incidence graph of a Boolean expression expr, also called the variable-clause incidence graph, is a bipartite graph whose vertex set is the union of the set of variables and the set of clauses of expr. An edge exists between a variable v and a clause c when c contains v or the negation of v as a literal.

Examples

Find the primal graph and incidence graph for a simple Boolean expression.

withLogic:

expraorbornotcandcordornote

expraorbornotcandcordornote

(1)

PGPrimalGraphexpr

PGGraph 1: an undirected graph with 5 vertices and 6 edge(s)

(2)

GraphTheory:-DrawGraphPG

IGIncidenceGraphexpr

IGGraph 2: an undirected graph with 7 vertices and 6 edge(s)

(3)

GraphTheory:-DrawGraphIG,style=bipartite

By invoking IncidenceGraph with the output option we can obtain the list L of subexpressions.

exprxoryorzandnotxornotyornotzandnotxornotyornotz

exprxoryorzandnotxandyandzandnotxandyandz

(4)

G,LIncidenceGraphexpr,output=graph,expressions

G,LGraph 3: an undirected graph with 6 vertices and 9 edge(s),x,y,z,xyz,¬x¬y¬z,¬x¬y¬z

(5)

L

x,y,z,xyz,¬x¬y¬z,¬x¬y¬z

(6)

GraphTheory:-DrawGraphG,style=bipartite

References

  

Szeider S. (2008) "Parameterized SAT." In: Kao MY. (eds) Encyclopedia of Algorithms. Springer, Boston, MA. doi:10.1007/978-1-4939-2864-4_283

Compatibility

• 

The Logic[IncidenceGraph] and Logic[PrimalGraph] commands were introduced in Maple 2020.

• 

For more information on Maple 2020 changes, see Updates in Maple 2020.

See Also

GraphTheory:-DrawGraph

Logic

Logic/SymmetryGroup