Complete graph invariant 2026-11-05
A complete graph invariant is a graph invariant whose value determines a graph up to graph isomorphism. For graphs in a specified class, completeness means
An ordinary invariant only requires the forward preservation statement . Completeness adds the converse: equal values must exclude graph non-isomorphism.
A direct construction proves that complete invariants exist for finite undirected simple graphs. For an -vertex graph, label its vertices and list the entries above the diagonal of its adjacency matrix in the fixed order . This gives a binary string. Repeat for every labeling and choose the least string in lexicographic order. Define to be the pair consisting of and this least string. Including distinguishes graphs whose edge string is empty but whose vertex counts differ.
Relabeling a graph permutes the same collection of candidate strings, so isomorphic graphs have the same minimum. Conversely, if two minima and vertex counts agree, some labeling of each graph gives exactly the same adjacency entries. Matching vertices with those labels is an isomorphism. This proves both directions, without assuming that the construction is computationally fast.
For an original three-vertex example, a path's possible strings are , and in the order . Its invariant is . A triangle instead gives . The difference certifies non-isomorphism. For larger graphs the naive construction may examine labelings, so mathematical completeness alone supplies no practical speed guarantee.
Canonical graph labeling produces a standardized labeled representative and is closely connected to this construction. The authors of nauty and Traces identify canonical-label production as one of their programs' tasks.[ref] A particular program's chosen representative need not be the lexicographically least string used in this illustrative definition; comparisons must use the same canonization convention.
Vertex count, edge count and degree sequence are useful inexpensive invariants but are not complete. The example in graph non-isomorphism gives equal values for all three while connectedness differs. Completeness concerns the information retained, separately from the effort required to compute it.
Individualization-refinement graph search explores possible vertex labelings while repeatedly distinguishing vertices by their adjacency structure. It combines inexpensive colour refinement with branching when refinement leaves indistinguishable vertices. This is a framework for canonical graph labeling and graph automorphism computation, rather than a claim that degree information alone decides graph isomorphism.[ref]
Start with an ordered partition of a set of the vertex set, representing any prescribed vertex colours. Within each cell, compare the number of neighbours each vertex has in every current cell. Split a cell whenever those count vectors differ, and repeat until no further split occurs. The result is an equitable partition. A discrete partition of a set, with one vertex per cell, gives a candidate vertex ordering.
If a cell still has several vertices, choose a target cell by a rule preserved under relabeling. For each possible chosen vertex in that cell, make that vertex a singleton, refine again and continue recursively. The leaves provide candidate encodings of the adjacency matrix. Choosing a fixed extremal encoding over the complete search gives a canonical representative. Implementations use valid node invariants and discovered graph automorphisms to prune branches without changing the result.[ref]
For an original example, label a six-vertex cycle graph temporarily as , with adjacency modulo6. Starting with one cell, every vertex has two neighbours, so colour refinement alone leaves one cell. Individualizing vertex0and refining gives
Vertices1and5remain indistinguishable because reflection fixing0exchanges them. Individualizing one of them resolves the remaining pairs. The temporary names explain the search; they cannot be used as invariant tie-breakers that silently discard the other possible labeling.
By contrast, two disjoint triangles also begin with six vertices of degree2, but after individualizing one vertex the refined cell sizes are1,2,3. The cycle's sizes are1,2,2,1. Thus this branch detects structure that initial degree refinement misses. Highly symmetric graphs can still require extensive search; refinement is a reduction of the search space, not a universal small bound on it.
nauty 2026-11-05
nauty is software for computing graph automorphisms and canonical graph labeling, originally developed by Brendan McKay. It is distributed with Traces graph isomorphism software and auxiliary graph-generation and manipulation tools.[ref]
An automorphism result describes relabelings that preserve adjacency. For an original example, the graph with6vertices and no edges permits every vertex permutation, so its automorphism group is the symmetric group of order
A compact generator description can use a transposition and a cycle . Conjugating the transposition by powers of the cycle produces adjacent transpositions, which generate the whole symmetric group. These are illustrative generators, not a claim about the exact generator list returned by a particular run.
A canonical result serves another purpose. If denotes the chosen canonical graph encoding, correctness requires
Renaming vertices changes the input representation but must not change that chosen result. This permits duplicate elimination when generating graphs and comparison of structures supplied with unrelated labels.
nauty combines structural refinement with a search over unresolved choices, exploiting discovered graph automorphisms to reduce equivalent work. Its theoretical framework and relationship to Traces are described in the authors' joint paper.[ref]
A generating set for symmetries and a canonical encoding are different outputs. The first describes equivalences within a graph; the second makes equivalence between independently labeled graphs directly testable.
Traces is software for computing graph automorphisms and canonical graph labeling, developed by Adolfo Piperno and distributed with nauty. A canonical result permits two graphs to be compared without depending on their input vertex names. Traces uses individualization-refinement graph search, with strategies designed to reduce the explored search space.[ref]
Refinement groups vertices according to structural information, including their numbers of neighbors in existing vertex classes. When this does not distinguish all vertices, individualization temporarily gives a selected vertex its own class and refinement continues. Discovering equivalent choices and distinguishing branches can avoid repeated work; the validity of the framework and implementation strategies are developed with Brendan McKay.[ref]
An original example shows why a coarse invariant is insufficient. A cycle on6vertices and two separate triangles both have6vertices and every vertex has2neighbors. Starting with one vertex class, neighbor-count refinement leaves one class in both cases. Yet the graphs are not isomorphic: one is connected and the other is not. Their correct canonical graph encodings must therefore differ.
Conversely, two differently numbered copies of the same6-cycle should give the same canonical result when processed with the same canonicalization convention. The example illustrates the required behavior, not a benchmark of a particular Traces version.
Performance depends on the graph family and search strategy. The practical success of the program does not by itself establish a polynomial worst-case bound for graph isomorphism. A reproducible comparison should keep the canonicalization settings consistent rather than assume all programs must choose an identical representative.