GraphTheory
RelationGraph
construct graph from relation
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
RelationGraph( V, f )
RelationGraph( [V1, V2], f )
V
-
list of integers, strings or symbols (vertex labels), or two-element
f
procedure of two arguments representing a relation
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.
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.
In this undirected graph, there is an edge between a and b if they are relatively prime.
In this directed graph there is an arc from a to b if a is divisible by b.
We can build a bipartite graph example using two vertex lists.
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