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

Online Help

GraphTheory

  

RelationGraph

  

construct graph from relation

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

RelationGraph( V, f )

RelationGraph( [V1, V2], f )

Parameters

V

-

list of integers, strings or symbols (vertex labels), or two-element

f

-

procedure of two arguments representing a relation

Options

• 

directed = true or false

  

Specifies whether the returned graph should be directed or undirected. By default, the resulting graph is undirected when the relation f is symmetric, and directed otherwise.

• 

selfloops = true or false

  

Specifies whether the returned graph should contain a self-loop on vertex u when f(u,u) is true. The default is false.

Description

• 

RelationGraph(V,f) constructs a graph on the given vertex list in which edges exist in the graph when a Boolean predicate f is true.

• 

If V is a list of integers, strings or symbols, then a graph is built with vertex set V in which there is an edge from a to b whenever f(a,b) returns true.

• 

If V is a list consisting of two lists V1 and V2 of integers, strings or symbols, then a graph is built whose vertex set is the the union of V1 and V2 in which there is an edge from a in V1 to b in V2 whenever f(a,b) returns true. If V1 and V2 are disjoint, this graph is bipartite.

Examples

In this undirected graph, there is an edge between a and b if they are relatively prime.

(1)

(2)

In this directed graph there is an arc from a to b if a is divisible by b.

(3)

(4)

(5)

(6)

We can build a bipartite graph example using two vertex lists.

(7)

Compatibility

• 

The GraphTheory[RelationGraph] command was introduced in Maple 2024.

• 

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

See Also

TransitiveClosure

TransitiveReduction

 


Download Help Document