Algorithm Search⌘K

Proofs: nauty

These are the human proofs of nauty, at full length.

The individualization-refinement search returns a canonical form and the automorphism group order full

This proof shows: correctness, termination.

Setting. GG is a simple undirected graph on V={0,…,n−1}V = \{0, \ldots, n-1\} with a vertex coloring cc. A permutation γ\gamma of VV acts on graphs, colorings and ordered partitions by renaming vertices; GγG^\gamma is the renamed graph. An automorphism is a γ\gamma with Gγ=GG^\gamma = G and cγ=cc^\gamma = c. For a discrete ordered partition π=({v0},…,{vn−1})\pi = (\{v_0\}, \ldots, \{v_{n-1}\}), the labeling λπ\lambda_\pi maps viv_i to ii, and the leaf value F(π)F(\pi) is the pair (colors of v0,…,vn−1v_0, \ldots, v_{n-1}, adjacency rows of GG relabeled by λπ\lambda_\pi). The full tree T(G)T(G) has the root R(π0)R(\pi_0), where RR is REFINE and π0\pi_0 the color partition, and a node π\pi that is not discrete has the children R(π↓w)R(\pi \downarrow w) for ww in the target cell, where π↓w\pi \downarrow w is individualization.

Lemma 1 (invariance). For every permutation γ\gamma: RGγ(πγ)=RG(π)γR_{G^\gamma}(\pi^\gamma) = R_G(\pi)^\gamma, (π↓w)γ=πγ↓γ(w)(\pi \downarrow w)^\gamma = \pi^\gamma \downarrow \gamma(w), the target cell index of πγ\pi^\gamma equals that of π\pi, and FGγ(πγ)=FG(π)F_{G^\gamma}(\pi^\gamma) = F_G(\pi) for discrete π\pi.

Proof. REFINE splits cells by the number ∣N(v)∩S∣|N(v) \cap S| of neighbors in a splitter cell and orders the pieces by that number; renaming changes neither the numbers nor the order of cells, so every step commutes with γ\gamma. Individualization places {w}\{w\} at the index of its cell, which is also invariant. TARGET-CELL uses only cell sizes and indices. For the leaf value, πγ\pi^\gamma lists γ(v0),…,γ(vn−1)\gamma(v_0), \ldots, \gamma(v_{n-1}), and γ(vi)∼γ(vj)\gamma(v_i) \sim \gamma(v_j) in GγG^\gamma exactly when vi∼vjv_i \sim v_j in GG, with the same colors. □\square

Hence γ\gamma maps T(G)T(G) onto T(Gγ)T(G^\gamma), node by node, and leaves with equal values.

Lemma 2 (equal leaf values give automorphisms). If leaves π,π′\pi, \pi' of T(G)T(G) have F(π)=F(π′)F(\pi) = F(\pi'), then γ=λπ′−1λπ\gamma = \lambda_{\pi'}^{-1} \lambda_\pi is an automorphism, and πγ=π′\pi^\gamma = \pi'.

Proof. γ\gamma maps the vertex at position ii of π\pi to the vertex at position ii of π′\pi'. Equal colors and equal relabeled rows mean that vi∼vjv_i \sim v_j iff γ(vi)∼γ(vj)\gamma(v_i) \sim \gamma(v_j) and c(vi)=c(γ(vi))c(v_i) = c(\gamma(v_i)). This is the map recorded in L6. □\square

Lemma 3 (pruning is safe). Let ν\nu be a node with prefix PP and children w,w′w, w', and let γ\gamma be an automorphism fixing every vertex of PP with γ(w)=w′\gamma(w) = w'. Then the subtrees under ww and w′w' have the same sets of leaf values. The same holds when γ\gamma is a product of such automorphisms.

Proof. The node ν\nu is obtained from the root by refining and individualizing the vertices of PP in order; since γ\gamma fixes PP and Gγ=GG^\gamma = G, Lemma 1 gives νγ=ν\nu^\gamma = \nu. Then γ\gamma maps the child R(ν↓w)R(\nu \downarrow w) to R(ν↓w′)R(\nu \downarrow w'), and by Lemma 1 it maps the subtree of the first onto the subtree of the second with equal leaf values. Products of automorphisms fixing PP fix PP. □\square

Theorem. The search terminates. It returns F∗(G)=max⁡{F(π):π a leaf of T(G)}F^\ast(G) = \max \{F(\pi) : \pi \text{ a leaf of } T(G)\}, so F∗(G)=F∗(H)F^\ast(G) = F^\ast(H) exactly when G≅HG \cong H as colored graphs; and the returned order equals ∣Aut(G)∣|\mathrm{Aut}(G)|.

Proof. Termination. Each child has strictly more cells than its parent, since π↓w\pi \downarrow w splits a cell of size at least 2 and REFINE never merges cells, so the depth is at most nn; each node has at most nn children and each frame scans its target cell once. REFINE stops because each repetition increases the number of cells.

Maximum. L9 skips a child only if it lies in the orbit of an explored sibling under automorphisms that fix the prefix, so by Lemma 3 the skipped subtree has the same leaf values as an explored one. By induction on the height, the explored leaves have the same set of values as all leaves of T(G)T(G), and L5 to L7 keep the maximum.

Canonical form. If H=GγH = G^\gamma, Lemma 1 maps T(G)T(G) onto T(H)T(H) with the same leaf values, so F∗(G)=F∗(H)F^\ast(G) = F^\ast(H). Conversely, F∗(G)F^\ast(G) is the value of a leaf of T(G)T(G), which is the colored graph GG relabeled by a bijection; if F∗(G)=F∗(H)F^\ast(G) = F^\ast(H), both graphs are isomorphic to the same relabeled graph.

Group order. Let ν0,ν1,…,νk\nu_0, \nu_1, \ldots, \nu_k be the first path, where νk\nu_k is the first leaf, PdP_d the prefix of νd\nu_d, CdC_d its target cell, and wd∈Cdw_d \in C_d its first child. Let AdA_d be the automorphisms fixing PdP_d pointwise, so A0=Aut(G)A_0 = \mathrm{Aut}(G). By Lemma 1, AdA_d fixes νd\nu_d, so it maps CdC_d to itself; Ad+1A_{d+1} is the stabilizer of wdw_d in AdA_d; and AkA_k is trivial because it fixes the discrete partition νk\nu_k. By the orbit-stabilizer theorem, ∣Aut(G)∣=∏d<k∣wdAd∣|\mathrm{Aut}(G)| = \prod_{d < k} |w_d^{A_d}|. It remains to show that the generators SdS_d found that fix PdP_d have the orbit wd⟨Sd⟩=wdAdw_d^{\langle S_d \rangle} = w_d^{A_d}. One inclusion is clear. For the other, let w=α(wd)w = \alpha(w_d) with α∈Ad\alpha \in A_d. The child ww of νd\nu_d is either explored or skipped. If it is skipped, it is in the orbit of an explored child uu under found automorphisms fixing PdP_d, so it suffices to show that each explored child uu in the AdA_d-orbit of wdw_d is joined to wdw_d. The subtree of uu is the image under some β∈Ad\beta \in A_d with β(wd)=u\beta(w_d) = u of the subtree of wdw_d, so it contains leaves with value F(νk)F(\nu_k); by the argument of the maximum part applied inside that subtree, the search reaches at least one leaf π\pi with F(π)=F(νk)F(\pi) = F(\nu_k). At that leaf L6 records γ\gamma with νkγ=π\nu_k^\gamma = \pi (Lemma 2); REFINE and individualization replace a cell by its pieces in place, so in every leaf below νd\nu_d a vertex that is a singleton of νd\nu_d sits at position equal to the number of vertices in the earlier cells of νd\nu_d, and the vertex individualized from CdC_d sits at the first position of CdC_d. So γ\gamma, which maps the vertex at each position of νk\nu_k to the vertex at the same position of π\pi, fixes every vertex of PdP_d and maps wdw_d to uu. So γ∈Ad\gamma \in A_d, γ∈Sd\gamma \in S_d, and γ(wd)=u\gamma(w_d) = u. (If the value at π\pi equals both stored values, L6 compares with the first leaf first, which is the case used here.) Hence the orbits agree, and L11 computes ∣Aut(G)∣|\mathrm{Aut}(G)|. ■\blacksquare

Back to nauty