construct graph with canonical labeling
CanonicalGraph( G, opts )
(optional) equation of the form output = val
output=list or one of graph, labeling, or permutation
the name graph, labeling, or permutation or a list of one or more of the names graph, labeling, and permutation. This option determines what is returned by CanonicalGraph. In all cases,
The option output=labeling returns a list L which is a rearrangement of the vertex list of G corresponding to a canonical labeling.
The option output=graph returns a graph whose edge set is identical to G, but whose vertex list is the rearrangement L.
The option output=permutation returns a list representing the permutation which, if applied to Vertices(G), produces L.
If output is a list of one or more of the symbols graph, labeling, or permutation, CanonicalGraph returns an expression sequence in which each element corresponds to what would be returned by invoking CanonicalGraph with the specified option in the order provided.
storage=rectangular, sparse, or auto
This option controls whether the dense or sparse algorithm from the Nauty library is used. The values rectangular and sparse correspond to the dense and sparse algorithms, respectively, while the value auto automatically chooses which algorithm to employ based on a heuristic depending on the number of vertices and edges in G. The default is auto.
This command makes use of the Nauty library for computing automorphism groups and canonical labelings.
The CanonicalGraph( G ) command constructs a representation of the graph G with a canonical labeling.
If the option output=labeling is provided, CanonicalGraph command instead returns a permutation of the vertices of G corresponding to a canonical labeling of G.
Owing to graph symmetries, it is possible that CanonicalGraph may return distinct vertex orderings when invoked on two graphs G and H with identical vertex sets and edge sets. The representation is nevertheless canonical in the sense that if G and H are isomorphic, AdjacencyMatrix(CanonicalGraph(G))=AdjacencyMatrix(CanonicalGraph(H)).
No general polynomial-time algorithm for computing a canonical labeling is presently known.
Find a canonical representation of a particular graph.
G1≔Graph 1: an undirected unweighted graph with 12 vertices and 24 edge(s)
CG1≔Graph 2: an undirected unweighted graph with 12 vertices and 24 edge(s)
Display the computed canonical labeling for the specified graph.
Observe that by permuting the vertices of the original graph, it is possible to generate a version of the graph for which CanonicalGraph returns a labeling distinct from the previous one.
G2≔Graph 3: an undirected unweighted graph with 12 vertices and 24 edge(s)
CG2,L≔Graph 4: an undirected unweighted graph with 12 vertices and 24 edge(s),3:4,3:3,3:1,2:4,1:4,2:2,1:2,3:2,2:3,1:3,1:1,2:1
Both labelings are canonical, as evidenced by the fact that the adjacency matrices of the resulting graphs are identical.
The GraphTheory[CanonicalGraph] command was introduced in Maple 2017.
For more information on Maple 2017 changes, see Updates in Maple 2017.
Download Help Document
What kind of issue would you like to report? (Optional)