Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

SAT Modulo Symmetries for Graph Generation and Enumeration

Published: 31 July 2024 Publication History
  • Get Citation Alerts
  • Abstract

    We propose a novel SAT-based approach to graph generation. Our approach utilizes the interaction between a CDCL SAT solver and a special symmetry propagator where the SAT solver runs on an encoding of the desired graph property. The symmetry propagator checks partially generated graphs for minimality with respect to a lexicographic ordering during the solving process. This approach has several advantages over a static symmetry breaking: (i) symmetries are detected early in the generation process, (ii) symmetry breaking is seamlessly integrated into the CDCL procedure, and (iii) the propagator performs a complete symmetry breaking without causing a prohibitively large initial encoding. We instantiate our approach by generating extremal graphs with certain restrictions in terms of forbidden subgraphs and diameter. In particular, we could confirm the Murty–Simon Conjecture (1979) on diameter-2-critical graphs for graphs up to 19 vertices and prove the exact number of Ramsey graphs \(\mathcal{R}(3,5,n)\) and \(\mathcal{R}(4,4,n)\) .

    1 Introduction

    Many challenging problems in Combinatorics can be stated as the question of whether a graph with a particular property exists. Here, the property should be independent of the labeling of the vertices, i.e., an invariant of the graph. A common approach to such problems is to use a tool like Nauty [42] to generate all connected graphs up to isomorphism with a given number n of vertices, known as isomorph-free generation, and to check each of them for the desired property. However, up to isomorphism, already for \(n=11\) there are over a billion connected graphs, so this method quickly approaches its limit (see Table 1).
    Table 1.
    OrderNumber of connected graphsNumber of connected graphs up to isomorphism
    111
    211
    342
    4386
    572821
    626,704112
    71,866,256853
    8251,548,59211,117
    966,296,291,072261,080
    1034,496,488,594,81611,716,571
    1135,641,657,548,953,3441,006,700,565
    1273,354,596,206,766,622,208164,059,830,476
    Table 1. Number of Connected Graphs and Number of Connected Graphs Up to Isomorphism for a Given Order [1, 2]
    As demonstrated by Codish et al. [11], constraint-based graph generation offers a compelling alternative approach. The graph property is expressed in terms of constraints, and further constraints expressing a static symmetry break are added. The latter constraints are based on a lexicographic ordering of solution graphs and exclude some graphs that are not minimal for this ordering. This approach has the advantage that the graph property is taken into account already during the generation process. However, a polynomial-size, complete symmetry breaking is not known, i.e., breaking all symmetries statically with current methods would result in a prohibitively large encoding size. Therefore, for static symmetry breaking, one needs to confine to a partial check, e.g., that swapping two vertices doesn’t yield a lexicographically smaller graph.
    We propose the novel approach SAT Modulo Symmetries (SMS) to constraint-based graph generation and enumeration. SMS utilizes the interaction between a Conflict-Driven Clause Learning (CDCL)1 SAT solver and a special propagator excluding lexicographically non-minimal graphs during the search. Thus, in contrast to static symmetry breaking, the minimality check is not added to the encoding but is carried out dynamically by the symmetry propagator.
    The symmetry propagator is called from within a CDCL SAT solver already when only a few of the graph's edges are determined. For this purpose, we introduce partially defined graphs, the corresponding lexicographic ordering, and the algorithm MinCheck that checks their minimality. If the symmetry propagator detects that the current partially defined graph is not minimal, clauses are learned and added to the solver's collection of clauses. On partially defined graphs, the minimality check is not guaranteed to be complete, but eventually, when all edges are determined, it performs a complete minimality check. Consequently, we can guarantee that all generated graphs are minimal and unique up to isomorphism. MinCheck also detects, in some cases, whether the current partially defined graph implies under minimality the existence or non-existence of further edges. When the minimality check reveals that the current partially defined graph isn’t minimal, this conflict is analyzed, and a suitable clause is added to the solver; also when an implied edge is detected, a unit clause is added.
    We implemented a prototype version of SMS and tested it on three prominent problems from Extremal Graph Theory [6]. The first asks for graphs with a prescribed minimum girth (length of a shortest cycle) and the largest number of edges. The second asks for graphs whose diameter (largest distance between any two vertices) is 2 but increases when any edge is deleted. The third problem asks for the smallest number n of vertices, given \(x\) and \(y\) , such that each graph with n vertices contains either an independent set of size \(x\) or a clique of size \(y\) . These values for given \(x,y\) are called Ramsey numbers.
    All of them are fundamental problems that have been studied for many decades [6, 17, 40, 48]. We could verify some extremal numbers for the girth problem, confirm the Murty–Simon Conjecture[7] on diameter-2-critical graphs with up to 19 vertices, improving upon the known bound of \(11\) , and we were able to generate, up to isomorphism, all graphs without an independent set of size \(x\) and a clique of size \(y\) for \((x,y)\in\{(3,5),(4,4)\}\) .
    Moreover, we are able to generate proofs. The proof is split into two parts, one for verifying the reasoning of the CDCL solver, the second for verifying the correctness of the added symmetry breaking clauses.
    Our experimental results show that SMS exhibits an encouraging performance, particularly on unsatisfiable instances. We developed the testing algorithm MinCheck from scratch, since existing methods based on various other forms of graph canonization cannot handle partially defined graphs [42]. The check often takes a notable amount of the solving time; here, we see ample room for improvement. However, the time which SMS spends on the SAT solving itself is significantly reduced in comparison to a static symmetry breaking.
    This article is an extended version of an earlier conference paper [35]. Here, we give additional experiments, improve the presentation by including more examples, and restructure the theoretical part.

    2 Preliminaries

    2.1 Graphs

    All considered graphs are undirected and simple (i.e., without parallel edges or self-loops). A graph \(G\) consists of a set \(V(G)\) of vertices and a set \(E(G)\) of edges; we denote the edge between vertices \(u,v\in V(G)\) by \(uv\) or equivalently \(vu\) . The order of a graph \(G\) is the size of \(V(G)\) . We write \(G-e\) for the graph obtained from \(G\) by deleting the edge \(e\) and \(G-v\) for the graph obtained from \(G\) by deleting the vertex \(v\) . \(\mathcal{G}_{n}\) denotes the class of all graphs \(G\) with \(V(G)=\{1,\dots,n\}\) . \(A_{G}\) denotes the adjacency matrix of a graph \(G\in\mathcal{G}_{n}\) where the element at row \(v\) and column \(u\) , denoted \(A_{G}(v,u)\) , is \(1\) if \(vu\in E(G)\) and \(0\) otherwise. \(A_{G}[v]\) denotes the \(v\) th row of \(A_{G}\) . \(\mathcal{S}_{n}\) denotes the set of all permutations of \(\{1,\dots,n\}\) . We use the cyclic notation for permutations in \(\mathcal{S}_{n}\) .
    Graphs \(G_{1},G_{2}\in\mathcal{G}_{n}\) are isomorphic if there is a permutation \(\pi\in\mathcal{S}_{n}\) such that for all \(1\leq u \lt v\leq n\) , we have \(uv\in E(G_{1})\) if and only if \(\pi(u)\pi(v)\in E(G_{2})\) . \(\pi(G)\) denotes the graph obtained from \(G\in\mathcal{G}_{n}\) by the permutation \(\pi\in\mathcal{S}_{n}\) , where \(E(\pi(G))=\{\pi(u)\pi(v)\;{:}\;uv\in E(G)\}\) . A canonical form of a graph \(G\in\mathcal{G}_{n}\) is a graph \(\operatorname{Can}(G)\in\mathcal{G}_{n}\) isomorphic to \(G\) , such that every graph \(H\in\mathcal{G}_{n}\) isomorphic to \(G\) has the same canonical form, i.e., \(\operatorname{Can}(G)=\operatorname{Can}(H)\) . A graph is canonical if its canonical form is the graph itself. The total order \(\preceq\) of \(\mathcal{G}_{n}\) is defined by \(G\preceq H\) if and only if \(A_{G}[1]A_{G}[2]\ldots A_{G}[n]\) is lexicographically smaller or equal to \(A_{H}[1]A_{H}[2]\ldots A_{H}[n]\) for \(G,H\in\mathcal{G}_{n}\) . \(G\) is lexicographically smaller than \(H\) (in symbols \(G\prec H\) ) if \(G\preceq H\) and \(G\neq H\) . \(G\in\mathcal{G}_{n}\) is lexicographically minimal or \(\preceq\) -minimal if \(G\preceq\pi(G)\) for every \(\pi\in\mathcal{S}_{n}\) . Figure 1 shows two different isomorphic copies of a five cycle, where the labeling on the top leads to a lexicographically smaller graph than the graph on the bottom.
    Fig. 1.
    Fig. 1. Two ways to label \(C_{5}\) and their corresponding adjacency matrices.
    We will also consider the lexicographic ordering of vertex pairs from \(\{1,\dots,n\}\) , where \((v_{1},v_{2})\prec(u_{1},u_{2})\) if and only if either (i) \(v_{1} \lt u_{1}\) or (ii) \(v_{1}=u_{1}\) and \(v_{2} \lt u_{2}\) . We will say that a vertex pair is more important than another if the vertex pair is smaller by this order. Similarly, we will say that an entry \(A(v_{1},v_{2})\) of the adjacency matrix \(A\) is more important than \(A(u_{1},u_{2})\) if \((v_{1},v_{2})\prec(u_{1},u_{2})\) .
    Observation 1.
    Let \(G,H\in\mathcal{G}_{n}\) . Then \(G\prec H\) if and only if there are \(1\leq i,j\leq n\) such that \(A_{G}(i,j)=0\) , \(A_{H}(i,j)=1\) , and for all more important vertex pairs \((i^{\prime},j^{\prime})\) , the values of the adjacency matrices are equal, i.e., \(A_{G}(i^{\prime},j^{\prime})=A_{H}(i^{\prime},j^{\prime})\) .

    2.2 Formulas and Satisfiability

    A literal is a propositional variable or negated propositional variable. A clause is a disjunction of literals. A formula in Conjunctive Normal Form (CNF) is a conjunction of clauses. An assignment is a function \(f:X\rightarrow\{\) true, false \(\}\) defined on a set \(X\) of propositional variables. For a variable \(x\notin X\) , we say that \(x\) is undefined. A negated variable is undefined if the variable itself is undefined. Assignments extend to literals in an obvious way. A model of a CNF formula \(F\) is an assignment \(f\) defined on the variables of \(F\) such that each clause of \(F\) contains a literal that is set to true by \(f\) . Given an assignment \(f\) , a clause is a unit clause if exactly one literal in the clause is undefined and all others are assigned to false.

    2.3 Static Symmetry Breaking for Graph Generation

    We outline a static symmetry breaking approach, which is essentially the “improved lexicographic break” proposed by Codish et al. [11]. The SAT solver runs on a CNF formula \(F\wedge M\) , where \(F\) encodes the properties of the graph sought for and \(M\) encodes a minimality property. A complete symmetry breaking would most likely require a prohibitively large encoding size. Therefore, \(M\) just ensures that swapping any two vertices does not lead to a lexicographically smaller graph (if it would, the current graph is not lexicographically minimal).
    Permuting two vertices \(i,j\) results in swapping the entries \(A_{G}(i,k)\) with \(A_{G}(j,k)\) , and \(A_{G}(k,i)\) with \(A_{G}(k,j)\) , for \(k\in\{1,\dots,n\}\setminus{i,j}\) , in the adjacency matrix. The remaining entries in the matrix will remain unchanged as the diagonal elements are all zero and the graph is undirected, meaning that \(A_{G}(i,j)=A_{G}(j,i)\) . So we have to check whether swapping the entries does not lead to a \(\preceq\) -smaller graph. Following [11], we compare the rows \(A[i]\) and \(A[j]\) by setting \(A[i]\prec_{i,j}A[j]\) if and only if \(A[i]\) is lexicographically smaller than \(A[j]\) while ignoring the \(i\) th and \(j\) th elements in both rows.
    Proposition 1.
    ([11]). If \(G\in\mathcal{G}_{n}\) is canonical, then \(A_{G}[i]\preceq_{i,j}A_{G}[j]\) for all \(1\leq i \lt j\leq n\) .
    We use the compact encoding of lex-leader constraints given by Devriendt et al. [15, Theorem 1] to encode \(M\) based on Proposition 1. The encoding is given by the following clauses using variables \(y_{i,j,k}\) for \(i,j\in\{1,\ldots,n\},k\in\{0,\ldots,n\}\setminus\{i,j\}\) and a predecessor function \(p:\{1,\ldots,n\}\setminus\{i,j\}\to\{0,\ldots,n-1\}\setminus\{i,j\}\) with \(p(k)=\max(\{0,1,\ldots,k-1\}\setminus\{i,j\})\)
    \(y_{i,j,k}\) for all \(1\leq i \lt j\leq n\) , and \(k=0\) .
    \(\lnot y_{i,j,p(k)}\lor\lnot e_{i,k}\lor e_{j,k}\) for all \(1\leq i \lt j\leq n\) , and \(k\in\{1,\ldots,n\}\setminus\{i,j\}\) .
    \(\lnot y_{i,j,p(k)}\lor\lnot e_{i,k}\lor y_{i,j,k}\) for all \(1\leq i \lt j\leq n\) , and \(k\in\{1,\ldots,n-1\}\setminus\{i,j\}\) .
    \(\lnot y_{i,j,p(k)}\lor e_{j,k}\lor y_{i,j,k}\) for all \(1\leq i \lt j\leq n\) , and \(k\in\{1,\ldots,n-1\}\setminus\{i,j\}\) .
    Informally, if the truth values of \(e_{i,k^{\prime}}\) and \(e_{j,k^{\prime}}\) coincide for all \(k^{\prime}\in\{1,\ldots,k\}\setminus\{i,j\}\) , then the variable \(y_{i,j,k}\) is true. If \(y_{i,j,k}\) , then the second case ensures \(A_{G}(i,k)\preceq A_{G}(j,k)\) .
    Instead of this direct SAT encoding, Codish et al. [11] used the solver BEE to encode the property stated in Proposition 1. BEE [45] compiles finite domain constraints to SAT while additionally applying transformations to simplify the encoding and optimize it.
    Recently, another incomplete static symmetry breaking for graph generation was introduced using higher dimensional graph invariants and combining different invariants [30].

    3 Related Work

    The goal of symmetry breaking in the context of combinatorial search is to restrict the search space by avoiding isomorphic solutions. In a broader sense, the goal is pruning the search space by adding clauses, which are not necessarily implied by the formula but preserve satisfiability. Depending on whether symmetry breaking clauses are added before search or during search, we distinguish between static and dynamic symmetry breaking.
    Our method SMS falls into the category of dynamic symmetry breaking techniques. Dynamic symmetry breaking in the broader sense, has a long history, see, e.g., [5, 16, 18, 24, 46]. More recently, this has also been combined with nogood (or clause) learning [9, 14, 50], using the fact that if a new clause/nogood is learned, and the symmetries of the problem are known, then one can propagate and learn further clauses/nogoods. Metin et al. [44] explored another way of dynamically utilizing symmetries in the context of SAT by considering the lexicographic order on the assignments themselves; the symmetries are computed by external tools or provided by the user before the SAT solving and are then taken into account by the solver.
    All these dynamic symmetry breaking techniques are not well suited for graph generation, because the number of permutations for a given order n is quickly increasing, and one has to restrict the symmetry breaking to a restricted set of permutations,2 otherwise these techniques render themselves useless. This leads to an incomplete symmetry breaking, i.e., several isomorphic graphs are kept in the search space.
    For graph generation, there exist complete static symmetry breaking constraints [10, 2729]. These constraints are only practical for small objects, such as graphs with up to roughly 12 vertices.
    Another approach is incomplete static symmetry breaking [11, 30] as discussed in Section 2.3, which scales better but is not as effective at filtering out symmetric copies.

    4 Dynamic Symmetry Breaking in SMS

    In this section, we present our approach for dramatically reducing the search space for finding all graphs in \(\mathcal{G}_{n}\) modulo isomorphism that satisfy a given property. We will use CNF formulas that contain all the propositional variables \(e_{u,v}\) , for \(1\leq u \lt v\leq n\) , which are true if and only if the edge \(uv\) is present in the implicitly represented graph, plus some auxiliary variables needed for encoding the graph property. From a model of the formula, we can extract a graph satisfying the given property.
    Our aim is to decide during the CDCL SAT solver's run whether the current partial assignment can be extended to a model, such that the graph represented by the model is \(\preceq\) -minimal. Performing this test is computationally hard in the worst case. For example, computing the lexicographically smallest isomorphic graph is known to be NP hard [4].
    Since during solving, we don’t know the final graph yet, we introduce the concept of partially defined graphs. A partially defined graph is a graph \(G\) where \(E(G)\) is split into two disjoint sets \(D(G)\) and \(U(G)\) . \(D(G)\) contains the defined edges, \(U(G)\) contains the undefined edges. A (fully defined) graph is a partially defined graph \(G\) with \(U(G)=\emptyset\) . Similarly to \(\mathcal{G}_{n}\) , let \(\mathcal{P}_{n}\) denote the class of all partially defined graphs \(G\) with \(V(G)=\{1,\dots,n\}\) . For two partially defined graphs \(G_{1},G_{2}\in\mathcal{P}_{n}\) , we write \(G_{1}\sqsubseteq G_{2}\) if \(D(G_{1})\subseteq D(G_{2})\) and \(U(G_{2})\subseteq U(G_{1})\) . We write \(G_{1}\sqsubset G_{2}\) if \(G_{1}\sqsubseteq G_{2}\) and \(G_{1}\not=G_{2}\) . The relation \(\sqsubseteq\) is a partial order on \(P_{n}\) , having as its maximal elements the fully defined graphs in \(\mathcal{P}_{n}\) and having one minimal element \(G_{\star}\) , the partially defined graph with all vertex pairs being undefined edges.
    Analogously to the adjacency matrix of a fully defined graph, we define the adjacency matrix \(A_{G}\) of a partially defined graph \(G\in\mathcal{P}_{n}\) as follows:
    \begin{align*}A_{G}(i,j)=\begin{cases}1 & \text{ if }ij\in D(G),\\\star & \text{ if }ij\in U(G),\\0 & \text{ otherwise.}\end{cases}\end{align*}
    From an assignment \(f:X\rightarrow\{\) true, false \(\}\) , defined on some set \(X\) of variables that may contain some of the edge variables, we can extract the partially defined graph \(G\) with \(V(G)=\{1,\dots,n\}\) , \(D(G)=\{ ij\;{:}\;e_{i,j}\in X,f(e_{i,j})=\text{true} \}\) and \(U(G)=\{ ij\;{:}\;1\leq i \lt j\leq n,e_{i,j}\notin X \}\) .
    Example 1.
    Let the number of vertices be \(n=10\) and the assignment \(f:X\to\{\text{true},\text{false}\}\) with
    \begin{align*}X=\{e_{1,8},e_{1,9},e_{1,10},e_{2,4},e_{2,5},e_{2,6},e_{2,9},e_{2,10},e_{3,5}, e_{1,2},e_{1,3},e_{1,4},e_{1,5},e_{2,3},e_{2,7},e_{2,8},e_{4,5},e_{5,6}\}\end{align*}
    and
    \begin{align*}f(x)=\left\{ \begin{array}{ll}\text{true}&\text{ if } \ x\in\{e_{1,8},e_{1,9},e_{1,10},e_ {2,4},e_{2,5},e_{2,6},e_{2,9},e_{2,10},e_{3,5}\},\\\text{false}&\text{ if } \ x\in\{e_{1,2},e_{1,3},e_{1,4},e_{1,5},e_{2,3},e_{2,7},e_{2,8},e_{4,5},e_{5,6}\}.\end{array} \right.\end{align*}
    Then, the adjacency matrix of the corresponding partially defined graph \(G_{\mathit{ex}}\) is
    \begin{align*}A_{G_{\mathit{ex}}} = \begin{pmatrix} 0 & 0 & 0 & 0 & 0 & \star & \star & 1 & 1 & 1 \\0 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 1 \\0 & 0 & 0 & \star & 1 & \star & \star & \star & \star & \star \\0 & 1 & \star & 0 & 0 & \star & \star & \star & \star & \star \\0 & 1 & 1 & 0 & 0 & 0 & \star & \star & \star & \star \\\star & 1 & \star & \star & 0 & 0 & \star & \star & \star & \star \\\star & 0 & \star & \star & \star & \star & 0 & \star & \star & \star \\1 & 0 & \star & \star & \star & \star & \star & 0 & \star & \star \\1 & 1 & \star & \star & \star & \star & \star & \star & 0 & \star \\1 & 1 & \star & \star & \star & \star & \star & \star & \star & 0 \\\end{pmatrix}.\end{align*}
    We use the assignment \(f\) and the graph \(G_{\mathit{ex}}\) as running example throughout this section to illustrate various concepts and algorithms.
    A partially defined graph \(G\in\mathcal{P}_{n}\) can be extended to a graph \(H\in\mathcal{G}_{n}\) if \(D(G)\subseteq E(H)\subseteq D(G)\cup U(G)\) . We write \(\mathcal{X}(G)\) for the set of all graphs to which \(G\) can be extended. Note that \(G_{1}\sqsubseteq G_{2}\) implies \(\mathcal{X}(G_{2})\subseteq\mathcal{X}(G_{1})\) . In the context of this section, we consider lexicographically minimal graphs as canonical. Thus, a graph \(G\in\mathcal{G}_{n}\) is non-canonical if there exists a permutation \(\pi\in\mathcal{S}_{n}\) such that \(\pi(G)\prec G\) . A partially defined graph \(G\in\mathcal{P}_{n}\) is canonical if \(\mathcal{X}(G)\) contains a canonical graph.
    A permutation \(\pi\in\mathcal{S}_{n}\) is a Certificate for the Non-Canonicity (nc-certificate) of \(G\in\mathcal{P}_{n}\) if \(\pi(H)\prec H\) for all \(H\in\mathcal{X}(G)\) ; observe that in that case \(G\) cannot be canonical. We use nc-certificate if the graph is clear from the context.
    A partially defined graph \(G\in\mathcal{P}_{n}\) is certified non-canonical if there is an nc-certificate of \(G\) in \(\mathcal{S}_{n}\) .
    We want to highlight the difference between a partially defined graph \(G\) being non-canonical and being certified non-canonical. The former states that for every \(H\in\mathcal{X}(G)\) , there is a permutation \(\pi\in\mathcal{S}_{n}\) such that \(\pi(H)\prec H\) , while the later states that there is a permutation \(\pi\in\mathcal{S}_{n}\) such that \(\pi(H)\prec H\) for every \(H\in\mathcal{X}(G)\) . Informally, the quantifiers are swapped.
    Let \(G\in\mathcal{P}_{n}\) . A partially defined graph \(G^{\prime}\in\mathcal{P}_{n}\) is a \(G\) -obstruction if
    \(G^{\prime}\) is non-canonical,
    \(G^{\prime}\sqsubseteq G\) , and
    no \(G^{\prime\prime}\sqsubset G^{\prime}\) is certified non-canonical.
    Observe that excluding \(G^{\prime}\) can potentially prune the search more than excluding \(G\) .
    Below, we will present an algorithm MinCheck, which takes a partially defined graph \(G\) as input and eventually computes a \(G\) -obstruction. The algorithm MinCheck proceeds by iteratively refining ordered partitions to find relevant permutations. In the worst case, it still requires considering all the \(n!\) permutations of the vertices. However, we use a more sophisticated approach that exploits the partially defined graph's structure which often allows us to consider only a small fraction of the permutations.
    We will show in Theorem 1, given a partially defined graph \(G\in\mathcal{P}_{n}\) as input, MinCheck(G) returns a \(G\) -obstruction or nil; if \(G\) is certified non-canonical then MinCheck(G) returns a \(G\) -obstruction.
    Before we state the algorithm MinCheck and prove Theorem 1, we explain how MinCheck is integrated into the CDCL algorithm. Whenever the CDCL algorithm assigns an edge variable a truth value, we check whether the current partially defined graph \(G\) is non-canonical. If MinCheck detects that this is the case, we add a clause. The clause is constructed from the obstruction \(G^{\prime}\) blocking all partially defined graphs \(G^{\prime\prime}\in\mathcal{P}_{n}\) with \(G^{\prime}\sqsubseteq G^{\prime\prime}\)
    \begin{align*}\bigvee_{i \lt j,A_{G^{\prime}}(i,j)=1}\lnot e_{i,j}\lor\bigvee_{i \lt j,A_{G^{\prime} }(i,j)=0}e_{i,j}.\end{align*}
    To state the MinCheck algorithm and establish its properties, we need some additional concepts and terminology. Let \(G\in\mathcal{P}_{n}\) , and \(\pi\in\mathcal{S}_{n}\) .
    A vertex pair \((i,j)\) is \((G,\pi)\) -greater if \(A_{G}(i,j)=1\) and \(A_{\pi(G)}(i,j)=0\) .
    A vertex pair \((i,j)\) is \((G,\pi)\) -greater-equal if and only if \(A_{H}(i,j)\geq A_{\pi(H)}(i,j)\) for every \(H\in\mathcal{X}(G)\) .
    A vertex pair \((i,j)\) is \(\pi\) -stable if \((i,j)\in\{(\pi(i),\pi(j)),(\pi(j),\pi(i))\}\) .
    Observe that if \((i,j)\) is \(\pi\) -stable, then \(\{i,j\}=\{\pi(i),\pi(j)\}\) , so \(ij\in E(G)\) if and only if \(ij\in E(\pi(G))\) .
    Observation 2.
    Let \(G\in\mathcal{P}_{n}\) , and \(\pi\in\mathcal{S}_{n}\) . A vertex pair \((i,j)\) is \((G,\pi)\) -greater-equal if and only if \((i,j)\) is \(\pi\) -stable, \(A_{G}(i,j)=1\) , or \(A_{\pi(G)}(i,j)=0\) .
    Example 2.
    Let us again consider the partially defined graph \(G_{\mathit{ex}}\) and the permutation \(\pi=(1)(25)(34)(6)(7)(8)(9)(10)\) . Then, the adjacency matrices of \(G_{\mathit{ex}}\) and \(\pi(G_{\mathit{ex}})\) are as follows:
    We highlight \((G_{\mathit{ex}},\pi)\) -greater-equal and \((G_{\mathit{ex}},\pi)\) -greater vertex pairs as follows, omitting marking the lower triangular matrix for symmetric reasons:
    the vertex pairs marked with a gray square are \(\pi\) -stable,
    the vertex pair marked with a gray pentagon is \((G_{\mathit{ex}},\pi)\) -greater,
    a pair \((i,j)\) is marked with a white pentagon if \(A_{G_{\mathit{ex}}}(i,j)=1\) and it's neither \(\pi\) -stable nor \((G_{\mathit{ex}},\pi)\) -greater,
    a pair \((i,j)\) is marked with a white square if \(A_{\pi(G_{\mathit{ex}})}(i,j)=0\) and it's neither \(\pi\) -stable nor \((G_{\mathit{ex}},\pi)\) -greater.
    Next we will introduce indicator pairs, which is a key concept for checking whether a partially defined graph has an nc-certificate. For \(G\in\mathcal{P}_{n}\) and \(\pi\in\mathcal{S}_{n}\) , the vertex pair \((i,j)\) is a \((G,\pi)\) -indicator pair if \((A_{G}(i,j),A_{\pi(G)}(i,j))\in\{(1,0),(\star,0),(1,\star)\}\) and every more important vertex pair \((i^{\prime},j^{\prime})\) for \(i^{\prime} \lt j^{\prime}\) is \((G,\pi)\) -greater-equal. A \((G,\pi)\) -indicator pair is a strong \((G,\pi)\) -indicator pair if it is a \((G,\pi)\) -indicator pair and \((i,j)\) is \((G,\pi)\) -greater. An indicator pair which isn’t a strong \((G,\pi)\) -indicator pair is called a weak \((G,\pi)\) -indicator pair.
    Example 3.
    Let us again consider the graph \(G_{\mathit{ex}}\) and the permutation \(\pi\) from the previous example. The vertex pair \((2,6)\) , highlighted in red, is a \((G_{\mathit{ex}},\pi)\) -indicator pair, since all more important vertex pairs than \((i,j)\) are \((G_{\mathit{ex}},\pi)\) -greater-equal. More precisely, for all vertex pairs \((i^{\prime},j^{\prime})\in\{(1,2),(1,3),(1,4),(1,5),(2,3)\}\) , we have \(A_{\pi(G_{\mathit{ex}})}(i^{\prime},j^{\prime})=0\) , all vertex pairs in \(\{(1,6)\) , \((1,7)\) , \((1,8)\) , \((1,9)\) , \((1,10)\) , \((2,5)\}\) are \(\pi\) -stable, and for the vertex pair \((2,4)\) , we have \(A_{G_{\mathit{ex}}}(2,4)=1\) .
    Next, we state the relation between nc-certificates and indicator pairs, allowing us to focus on indicator pairs instead of nc-certificates.
    Proposition 2.
    Let \(G\in\mathcal{P}_{n}\) and \(\pi\in\mathcal{S}_{n}\) . If a strong \((G,\pi)\) -indicator pair exists, then the permutation \(\pi\) is an nc-certificate of \(G\) .
    Proof.
    Let \(G\in\mathcal{P}_{n}\) and \(\pi\in\mathcal{S}_{n}\) .
    Let \((i,j)\) be a strong \((G,\pi)\) -indicator pair. It follows that \((i,j)\) is \((G,\pi)\) -greater. For the sake of a contradiction, assume that \(\pi\) is not an nc-certificate of \(G\) . By definition of an nc-certificate, there is a fully defined graph \(H\in\mathcal{X}(G)\) such that \(\pi(H)\prec H\) does not hold, so \(H\preceq\pi(H)\) .
    First, we show for all more important vertex pairs \((i^{\prime},j^{\prime})\) than \((i,j)\) (including \(i^{\prime} \gt j^{\prime}\) ) that \(A_{H}(i^{\prime},j^{\prime})=A_{\pi(H)}(i^{\prime},j^{\prime})\) . Assume that there is a vertex pair \((i^{\prime},j^{\prime})\prec(i,j)\) such that \(A_{H}(i^{\prime},j^{\prime})\not=A_{\pi(H)}(i^{\prime},j^{\prime})\) . Let \((i^{\prime},j^{\prime})\) be the minimal vertex pair with this property. We distinguish five cases and show that \(A_{H}(i^{\prime},j^{\prime})=A_{\pi(H)}(i^{\prime},j^{\prime})\) must hold for each case assuming \(H\preceq\pi(H)\) .
    (1)
    If \(i^{\prime} \gt j^{\prime}\) then \((j^{\prime},i^{\prime})\prec(i^{\prime},j^{\prime})\) , hence \(A_{H}(i^{\prime},j^{\prime})=A_{H}(j^{\prime},i^{\prime})=A_{\pi(H)}(j^{\prime },i^{\prime})=A_{\pi(H)}(i^{\prime},j^{\prime})\) holds.
    (2)
    If the pair \((i^{\prime},j^{\prime})\) is \(\pi\) -stable and \((i^{\prime},j^{\prime})=(\pi(i^{\prime}),\pi(j^{\prime}))\) , then we have \(A_{\pi(H)}(i^{\prime},j^{\prime})=A_{H}(\pi^{-1}(i^{\prime}),\pi ^{-1}(j^{\prime}))=A_{H}(i^{\prime},j^{\prime})\) holds.
    (3)
    If the pair \((i^{\prime},j^{\prime})\) is \(\pi\) -stable and \((i^{\prime},j^{\prime})=(\pi(j^{\prime}),\pi(i^{\prime}))\) , then we have \(A_{\pi(H)}(i^{\prime},j^{\prime})=A_{H}(\pi^{-1}(i^{\prime}),\pi ^{-1}(j^{\prime}))=A_{H}(j^{\prime},i^{\prime})=A_{H}(i^{\prime},j^{\prime})\) holds.
    (4)
    If \(A_{G}(i^{\prime},j^{\prime})=1\) , then \(A_{H}(i^{\prime},j^{\prime})=1\) . By minimality of the vertex pair \((i^{\prime},j^{\prime})\) , \(A_{\pi(H)}(i^{\prime\prime},j^{\prime\prime})=A_{H}(i^{\prime \prime},j^{\prime\prime})\) holds for all more important vertex pairs \((i^{\prime\prime},j^{\prime\prime})\) than \((i^{\prime},j^{\prime})\) . Hence, \(A_{\pi(H)}(i^{\prime},j^{\prime})=1\) must hold, otherwise \(\pi(H)\prec H\) by Observation 1, so \(A_{H}(i^{\prime},j^{\prime})=A_{\pi(H)}(i^{\prime},j^{\prime})\) .
    (5)
    If \(A_{\pi(G)}(i^{\prime},j^{\prime})=0\) , then \(A_{\pi(H)}(i^{\prime},j^{\prime})=0\) . Again, by minimality of the vertex pair \((i^{\prime},j^{\prime})\) , \(A_{\pi(H)}(i^{\prime\prime},j^{\prime\prime})=A_{H}(i^{\prime\prime},j^{\prime \prime})\) holds for all vertex pairs \((i^{\prime\prime},j^{\prime\prime})\prec(i^{\prime},j^{\prime})\) . Hence, \(A_{H}(i^{\prime},j^{\prime})=0\) must hold by Observation 1, so \(A_{H}(i^{\prime},j^{\prime})=A_{\pi(H)}(i^{\prime},j^{\prime})\) .
    We have shown that \(A_{\pi(H)}(i^{\prime},j^{\prime})=A_{H}(i^{\prime},j^{\prime})\) for all vertex pairs \((i^{\prime},j^{\prime})\prec(i,j)\) . Additionally, we have \(A_{H}(i,j)=1\) , and \(A_{\pi(H)}(i,j)=0\) , because \((i,j)\) being a strong \((G,\pi)\) -indicator pair. Therefore, by Observation 1, we have \(\pi(H)\prec H\) in contradiction to our assumption \(H\preceq\pi(H)\) . □
    Lemma 1.
    Let \(G\in\mathcal{P}_{n},\pi\in\mathcal{S}_{n}\) and \((i,j)\) a weak \((G,\pi)\) -indicator pair. If \(H\in\mathcal{X}(G)\) is canonical, then \(A_{H}(i,j)=A_{\pi(H)}(i,j)\) .
    Proof.
    Let \(G\in\mathcal{P}_{n}\) and \(\pi\in\mathcal{S}_{n}\) . Let \(H\in\mathcal{X}(G)\) be a canonical graph and \((i,j)\) a weak \((G,\pi)\) -indicator pair. For the sake of contradiction, assume that \(A_{H}(i,j)\not=A_{\pi(H)}(i,j)\) . Then \(A_{H}(i,j) \gt A_{\pi(H)}(i,j)\) , so \((i,j)\) is a strong \((H,\pi)\) -indicator pair. This is a contradiction with \(H\) being canonical according to Proposition 2. □
    Proposition 3.
    Let \(G\in\mathcal{P}_{n}\) and \(\pi\in\mathcal{S}_{n}\) . If \(\pi\) is an nc-certificate of \(G\) , then there is a \((G,\pi)\) -indicator pair.
    Proof.
    Let \(G\in\mathcal{P}_{n},\pi\in\mathcal{S}_{n}\) , and \(G\) be without a \((G,\pi)\) -indicator pair. We construct a graph \(H\in\mathcal{X}(G)\) such that \(H\preceq\pi(H)\) , i.e., we show that \(\pi\) isn’t an nc-certificate of \(G\) .
    We distinguish between two cases:
    For all vertex pairs \((i,j)\) it holds that (i) \((i,j)\) is \((G,\pi)\) -equal or (ii) \(A_{G}(i,j)=A_{\pi(G)}(i,j)\) and \(A_{G}(i,j)\not=\star\) . In this case, we have \(H=\pi(H)\) for arbitrary \(H\in\mathcal{X}(G)\) , so \(H\preceq\pi(H)\) holds.
    Otherwise, there is a vertex pair \((i,j)\) which isn’t \((G,\pi)\) -equal nor \(A_{G}(i,j)=A_{\pi(G)}(i,j)\) and \(A_{G}(i,j)\not=\star\) . Let \((i,j)\) be the smallest one with respect to the order \(\preceq\) . Because \(G\) doesn’t have a \((G,\pi)\) -indicator pair, we have \(A_{G}(i,j)\not=1\) and \(A_{\pi(G)}(i,j)\not=0\) . We extend \(G\) to a fully defined graph \(H\in\mathcal{X}(G)\) as follows. We add the non-edge \(ij\) and the defined edge \(\pi^{-1}(i)\pi^{-1}(j)\) if not already present. All other undefined edges can be either added as defined edge or non-edge. By construction, we have \(H\preceq\pi(H)\) .
    In either case, we showed that \(\pi\) isn’t an nc-certificate. Since \(\pi\) was arbitrary, the proposition holds. □

    4.1 Minimality Check

    On a high level, the algorithm MinCheck proceeds as follows: First it searches for indicator pairs. If it is a strong indicator pair, then the current partially defined graph is non-canonical by Proposition 2. If we find a weak indicator pair, then we add a non-edge or defined edge based on Lemma 1 resulting in a new graph which is canonical if and only if the original one is canonical. We proceed with the new graph and start from the beginning. Since the number of undefined edges decreases in each iteration, the algorithm terminates. The most technical part is finding indicator pairs. Constructing the obstruction is relatively straightforward.

    Finding Indicator Pairs

    The procedure GetIndicatorPair is based on the concept of an ordered partition3 of \(V=\{1,\ldots,n\}\) , which is a list \(P=[V_{1},V_{2},\ldots,V_{k}]\) such that \(V_{1}\cup\cdots\cup V_{k}=V\) and \(V_{i},V_{j}\) are disjoint for \(1\leq i \lt j\leq n\) . The sets \(V_{1},\ldots,V_{n}\) are equivalence classes. We associate with the ordered partition \(P=[V_{1},V_{2},\ldots V_{n}]\) a set of permutations
    \begin{align*}\operatorname{Perm}(P)=\{\pi\in\mathcal{S}_{n}\;{:}\;\text{for all }u\in V_{ i}\text{ and }v\in V_{j},i \lt j\text{ implies }\pi(u) \lt \pi(v)\}.\end{align*}
    For example, \(\operatorname{Perm}([\{2,3\},\{1\}])=\{(213),(13)(2)\}\) .
    Let \(f\) be the mapping that indicates to which equivalence class a vertex belongs to, i.e., \(f(v)=i\) if and only if \(v\in V_{i}\) . For \(i\in\{1,\ldots,k\}\) , let \(l_{i}=\sum_{j \lt i}|V_{j}|+1\) and \(u_{i}=\sum_{j\leq i}|V_{j}|\) . Using \(f,l_{i},u_{i}\) , we get an equivalent definition of \(\operatorname{Perm}(P)\) which is better suited for describing upcoming procedures
    \begin{align*}\operatorname{Perm}(P)=\{\pi\in\mathcal{S}_{n}\;{:}\;l_{f(v)}\leq\pi(v)\leq u _{f(v)}\text{ for all }v\in V\},\end{align*}
    i.e., the ordered partition gives a range for each vertex to which it can potentially be mapped.
    Next, we describe the algorithm GetIndicatorPair. The input for the initial call of GetIndicatorPair is a partially defined graph \(G\in\mathcal{P}_{n}\) . The idea is to start with the ordered partition \(P=[V]\) and refine it until we have found a \((G,\pi)\) -indicator pair for some permutation \(\pi\) represented by the ordered partition or can conclude that no such indicator pair exists. Therefore, we recursively assign a vertex \(v\) to some \(r\in V\) , starting with \(r=1\) and adapting the ordered partition correspondingly by splitting a set \(V_{i}\) if necessary, i.e., replacing \(V_{i}\) by multiple equivalence classes.
    We define GetIndicatorPair in a recursive way, with the following input: a partially defined graph \(G\in\mathcal{P}_{n}\) , an ordered partition \(P=[V_{1},\ldots,V_{k}]\) , and a row \(r\in\{1,\ldots,n\}\) . At the initial call, the partition \(P\) is \([\{1,\ldots,n\}]\) and \(r=1\) . For all \(j \lt r\) we have \(|V_{j}|=1\) , in other words, all the vertices which are mapped to the first \(r-1\) vertices are already fixed. Furthermore, we will see that all pairs up to \((r-1,n)\) are \((G,\pi)\) -greater-equal for all \(\pi\in\operatorname{Perm}(P)\) .
    Now we choose a vertex \(v\in V_{r}\) : we refine the ordered partition \(P\) such that \(\pi(r)=v\) for all permutations represented by the refined ordered partition. Next we refine all sets \(V_{i}\) with \(i\geq r\) (in the order they occur in the list) such that also all pairs in the current row (i.e., all pairs \((r,j)\) with \(j \gt r\) ) are \((G,\pi)\) -greater-equal for all permutations \(\pi\) represented by the ordered partition. The resulting ordered partition is given by \(P_{v}\) . If we find an \((G,\pi)\) -indicator pair during this process, we return it immediately. If every vertex pair in the current row is \((G,\pi)\) -greater-equal for every permutation in \(\operatorname{Perm}(P_{v})\) , we call GetIndicatorPair \((G,P_{v},r+1)\) with the refined ordered partition \(P_{v}\) ; otherwise we backtrack. If every choice of \(v\in V_{r}\) returned no indicator pair, then we return nil.
    Procedure 1: GetIndicatorPair
    Input: A partially defined graph \(G\) , an ordered partition \(P=[V_{1},\ldots,V_{k}]\) , a row \(r\in V\) .
    Output: A \((G,\pi)\) -indicator pair if it exists, and nil otherwise.
    GetIndicatorPair( \(G,P,r\) ):
      We branch over all possible choices \(v\in V_{r}\) .
      First, we split \(V_{r}\) into \(\{v\}\) and \(V_{r}\setminus\{v\}\) , so \(\pi(v)=r\) for all \(\pi\in\operatorname{Perm}(P_{v})\) .
      For each \(V_{i}\) , \(i\in\{r,\ldots,k\}\) , we apply the following steps, where \(V_{i}^{0}:=\{ u\in V_{i}\;{:}\;A_{G}(v,u)=0 \}\) , \(V_i^\star := \{ u \in V_i {:} A_G(v,u) = \star \}\) , and \(V_i^1 := \{ u \in V_i {:} A_G(v,u) = 1 \}\) . (Some special care is needed for \(i=r\) since it was already split, so we use \(V_{r}\setminus\{v\}\) instead of \(V_{r}\) ):
    (1)
    We split \(V_{i}\) into the sets \(V_{i}^{0}\) and \(V_{i}^{\star}\cup V_{i}^{1}\) ; this ensures that the vertices not adjacent to \(v\) are mapped to the smallest vertices possible without violating the previous ordered partition.
    Again, let \(l_{i}=\sum_{j \lt i}|V_{j}|+1\) and \(u_{i}=\sum_{j\leq i}|V_{j}|\) .
    If the set \(J=\{ u\;{:}\;A_{G}(r,u)\not=0,l_{i}\leq u \lt l_{i}+|V_{i}^{0}| \}\not=\emptyset\) , then we put \(j=\min J\) . In that case \((r,j)\) is a \((G,\pi)\) -indicator pair for any permutation represent by the ordered partition and we return the indicator pair. If \(J\) is empty then all vertex pairs \((r,u)\) with \(l_{i}\leq u \lt l_{i}+|V_{i}^{0}|\) are \((G,\pi)\) -greater-equal, for all \(\pi\in\operatorname{Perm}(P_{v})\) .
    (2)
    Now we iterate over the remaining indexes \(p\in[l_{i}+|V_{i}^{0}|,\ldots,u_{i}]\) . We distinguish three cases:
    (a)
    \(A_{G}(r,p)=\star\) : All vertices from \(V_{i}^{0}\) are mapped to smaller vertices than \(p\) , so the only way to guarantee that the pair is \((G,\pi)\) -greater-equal for all \(\pi\in\operatorname{Perm}(P_{v})\) is to ensure that \((r,p)\) is \(\pi\) -stable:
    If \(v=r\) and \(p\in V_{i}^{\star}\) , we split \(V_{i}^{\star}\cup V_{i}^{1}\) into \(\{p\}\) and \((V_{i}^{\star}\cup V_{i}^{1})\setminus\{p\}\) and remove \(p\) from \(V_{i}^{\star}\) .
    If \(v=p\) and \(r\in V_{i}^{\star}\) , we split \(V_{i}^{\star}\cup V_{i}^{1}\) into \(\{r\}\) and \((V_{i}^{\star}\cup V_{i}^{1})\setminus\{r\}\) and remove \(r\) from \(V_{i}^{\star}\) .
    In all other cases, we backtrack.
    (b)
    If \(A_{G}(r,p)=0\) we backtrack, since \(A_{\pi(G)}(r,p)\not=0\) for every \(\pi\in\operatorname{Perm}(P_{v})\) .
    (c)
    If \(A_{G}(r,p)=1\) then we again distinguish two cases:
    \(V_{i}^{\star}\not=\emptyset\) then we split \(V_{i}^{\star}\cup V_{i}^{1}\) into \(V_{i}^{\star}\) and \(V_{i}^{1}\) resulting in \((r,p)\) being a weak \((G,\pi)\) -indicator pair for all \(\pi\in\operatorname{Perm}(P_{v})\) .
    Otherwise, \((r,p)\) is still \((G,\pi)\) -greater-equal for all \(\pi\in\operatorname{Perm}(P_{v})\) .
    If \(r=n\) we backtrack, otherwise we call GetIndicatorPair \((G,P_{v},r+1)\) .
      If all choices \(v\in V_{r}\) have been exhausted unsuccessfully, we return nil.
    GetIndicatorPair is given in detail by Procedure 1.
    Proposition 4.
    Given \(G\in\mathcal{P}_{n}\) as input, GetIndicatorPair \((G,\{1,\ldots,n\},1)\) returns a \((G,\pi)\) -indicator pair if \(G\) is certified non-canonical.
    Proof.
    For proving the proposition, we mention some invariants for GetIndicatorPair which will allow us to argue that the invariants are also satisfied at recursive calls. The invariants are as follows:
    P1.
    The vertices which are mapped to the first \(r-1\) vertices are already determined, i.e., \(|V_{i}|=1\) for every \(i \lt r\) .
    P2.
    For every permutation \(\pi\in\operatorname{Perm}(P)\) , every vertex pair \((i^{\prime},j^{\prime})\preceq(r-1,n)\) is \((G,\pi)\) -greater-equal.
    P3.
    For every \(\pi\in\operatorname{Perm}(P)\) , no vertex pair \((i,j)\preceq(r-1,n)\) is a \((G,\pi)\) -indicator pair.
    Invariant P2 helps us to show that we indeed find indicator pairs, so the returned permutations are nc-certificates by Proposition 2. We need Invariant P2 to show that we don’t omit any indicator pair. More precisely, if there is a \((G,\pi)\) -indicator pair, then it should have been found at a more shallow recursion depth.
    Let \(G\in\mathcal{P}_{n}\) , \(P=[V_{1},\ldots,V_{k}]\) , \(r\in\{1,\ldots,n\}\) and assume the Invariants P1–P3 are satisfied. We show by induction on the recursion level that GetIndicatorPair( \(G,P,r\) ) will return a \((G,\pi)\) -indicator pair of \(G\) with \(\pi(u)\in V_{u}\) for \(u \lt r\) and a \((G,\pi)\) -indicator pair if and only if such an indicator pair exists; otherwise the procedure returns nil. From this the proposition follows, since \(\mathcal{S}_{n}=\operatorname{Perm}([\{1,\ldots,n\}])\) and all invariants are satisfied for GetIndicatorPair \((G,[\{1,\ldots,n\}],1)\) .
    So, let \(G\in\mathcal{P}_{n}\) , \(r\in\{1,\ldots,n\}\) , and \(P=[V_{1},\ldots,V_{k}]\) an ordered partition such that Invariants P1–P3 hold. Due to Invariant P3, we only have to check the presence of \((G,\pi)\) -indicator pairs \((i,j)\) satisfying \((r-1,n)\prec(i,j)\) for \(\pi\in\operatorname{Perm}(P)\) . Additionally, we are only interested in permutations, where \(\pi(v)=r\) for \(v\in V_{r}\) , hence, we don’t have to consider any vertices not in \(V_{r}\) for branching.
    By splitting \(V_{r}\) into \(\{v\}\) and \(V_{r}\setminus\{v\}\) for \(v\in V_{r}\) , Invariant P1 is satisfied for recursive calls. It remains to show that the splitting of the equivalence classes is correct. We do this for each \(v\in V_{r}\) separately. We say that
    Invariant P2 holds up to \((i,j)\) if for every permutation \(\pi\in\operatorname{Perm}(P_{v})\) , every vertex pair \((i^{\prime},j^{\prime})\preceq(i,j)\) is \((G,\pi)\) -greater-equal,
    Invariant P3 holds up to \((i,j)\) if for every \(\pi\in\operatorname{Perm}(P_{v})\) , no vertex pair \((i^{\prime},j^{\prime})\preceq(i,j)\) is a \((G,\pi)\) -indicator pair.
    We show that Invariants P2 and P3 hold up to \((r,u_{i})\) after refining the equivalence class \(V_{i}\) . Additionally, we show that partitions are refined in a way, such that only permutations are excluded, which have been shown to not have an indicator pair. More precisely, we exclude a permutation \(\pi\) , if there is a vertex pair which isn’t \((G,\pi)\) -greater-equal and more important than any \((G,\pi)\) -greater vertex pair. Observe that in this case \(\pi\) cannot have a \((G,\pi)\) -indicator pair.
    In each step of the procedure for splitting an equivalence class \(V_{i}\) , we ensure that the vertex pairs are \((G,\pi)\) -greater-equal for all permutations represented by the refined partition. So, Invariant P2 holds up to \((r,u_{i})\) . Let us have a closer look at the two steps for refining the equivalence class.
    (1)
    If the set \(J=\{ u\;{:}\;A_{G}(r,u)\not=0,l_{i}\leq u \lt l_{i}+|V_{i}^{0}| \}\not=\emptyset\) , then we found an indicator pair and return; otherwise, if any vertex in \(V_{i}^{\star}\cup V_{i}^{1}\) is mapped to a vertex \(w\) in \(\{l_{i},\ldots,l_{i}+|V_{i}^{0}|\}\) , then \((r,w)\) is neither \((G,\pi)\) -greater-equal nor \((G,\pi)\) -greater, but more important than any \((G,\pi)\) -greater vertex pair. Hence, splitting \(V_{i}\) into \(V_{i}^{0}\) and \(V_{i}^{\star}\cup V_{i}^{1}\) removes only irrelevant permutations from \(\operatorname{Perm}(P_{v})\) and Invariant P3 holds up to the vertex pair \((r,u_{i})\) by splitting \(V_{i}\) .
    (2)
    We focus on the case \(A_{G}(r,p)=\star\) , the other two cases are already clarified in the procedure itself.
    For any permutation represented by the ordered partition, we have \(A_{G}(r,p)=\star\) and \(A_{\pi}(G)(r,p)\in\{\star,1\}\) . The only way to ensure that \((r,p)\) is \((G,\pi)\) -greater-equal is by refining the ordered partition such that \((r,p)\) is \(\pi\) -stable for every permutation represented by the refined partition. This can only be ensured if the branching vertex \(v\) is in \(\{p,r\}\) , one vertex of \(\{p,r\}\) is in \(V_{i}^{\star}\) .
    Since \(u_{k}=n\) , all invariants hold for recursive calls. To sum up, if we find an indicator pair in the current row, we return it and we only backtrack if we can ensure that there is no indicator pair with a permutation represented by the current ordered partition. □
    Example 4.
    Figure 2 shows how the initial ordered partition \([V]\) is refined, given the partially defined graph \(G_{\mathit{ex}}\) . Starting with the first row, we select vertex \(1\) to be mapped to itself, resulting in the ordered partition \([\{1\},\{2,3,4,5\},\{6\},\{7\},\{8,9,10\}]\) , because the vertices in \(\{2,3,4,5\}\) are not adjacent to \(1\) (therefore, it is best to place them on the left side). It is still undefined whether the vertices \(6\) and \(7\) are adjacent to \(1\) , so they have to be in their own equivalence class; the remaining vertices are adjacent to \(1\) . We can see that for the first row \(r=1\) all vertex pairs \((r,v)\) are \((G_{\mathit{ex}},\pi)\) -greater-equal for each \(\pi\in\operatorname{Perm}([\{1\},\{2,3,4,5\},\{6\},\{7\},\{8,9,10\}])\) , especially \((1,6)\) and \((1,7)\) are \(\pi\) -stable. The selection for later rows is indicated at the right-hand side. We select vertex \(2\) for row \(2\) . We add \(\{2\}\) as a new equivalence class and refine the other equivalence classes. For example, \(\{8,9,10\}\) is split into \(\{8\}\) and \(\{9,10\}\) , since \(8\) is not adjacent to \(2\) , but \(9\) and \(10\) both are.
    If we select vertex \(5\) for the second row, we get a different ordered partition. We split \(\{2,3,4\}\) into \(\{4\}\) and \(\{2,3\}\) because, again, \(4\) is the only vertex adjacent in this equivalence class to \(5\) . The set \(\{6\}\) only consists of a single vertex which is not adjacent to \(5\) , while in the original matrix on this position there is an edge. We found an indicator pair highlighted with a box. More precisely, for any \(\pi\in\operatorname{Perm}([\{1\},\{5\},\{4\},\{2,3\},\{6\},\{7\},\{8,9,10\}])\) , \((2,6)\) is a \((G_{\mathit{ex}},\pi)\) -indicator pair and hence \(\pi\) is an nc-certificate of \(G_{\mathit{ex}}\) due to Proposition 2.
    Figure 2.
    Figure 2. Example for the minimality check.
    Given Procedure 1 for finding indicator pairs, a procedure for checking whether a partially defined graph is canonical is given by Procedure 2.
    Procedure 2: IsMinimal
    Input: A partially defined graph \(G\) .
    Output: \(G\) is non-canonical if false is returned.
    IsMinimal( \(G\) ):
    \(p\) \(:=\) GetIndicatorPair \({G,V,1}\)
    if  \(p=\) nil then
           return unknown
    else if  \(p\) is a weak \((G,\pi)\) -indicator pair then
            \(i,j\) \(:=\) \(p\)
           if  \(A_{G}(i,j)=\star\)  then
               Add non-edge \(ij\) to \(G\)
           else
               Add defined edge \(\pi^{-1}(i)\pi^{-1}(j)\) to \(G\)      
           return IsMinimal( \(G\) )
    else        \(\triangleright\) \(p\) is a strong indicator pair
           return false
    Proposition 5.
    Let \(G\in\mathcal{P}_{n}\) . If IsMinimal( \(G\) ) returns false, then \(G\) is non-canonical. If \(G\) is certified non-canonical, then IsMinimal( \(G\) ) returns false.
    Proof.
    The lemma follows from the correctness of GetIndicatorPair established in Proposition 4 and from Lemma 1 and Proposition 3. □

    Constructing Obstructions

    Finally, we present a procedure GetObstruction( \(G\) ) (Procedure 3) to extract a \(G\) -obstruction \(G^{\prime}\) . The procedure removes defined edges and non-edges as long as the resulting graph is shown to be non-canonical.
    Procedure 3: GetObstruction
    Input: A partially defined non-canonical graph G
    Output: A G-obstruction.
    GetObstruction( \(G\) ):
    for all defined edges and non-edges \(e\) of \(G\)  do
            \(G^{\prime}\) \(:=\) \(G\) except \(e\) is undefined
           if IsMinimal \(G^{\prime}\) = false then
                \(G\) \(:=\) \(G^{\prime}\)      
    return \(G\)
    Proposition 6.
    Given a non-canonical partially defined graph \(G\in\mathcal{P}_{n}\) , GetObstruction( \(G\) ) returns a \(G\) -obstruction.
    Proof.
    Since IsMinimal guaranties to correctly classify certified non-canonical partially defined graphs, we ensure that every \(G^{\prime\prime}\sqsubseteq G^{\prime}=\) GetObstruction \((G)\) isn’t certified non-canonical and \(G^{\prime}\) is non-canonical, hence \(G^{\prime}\) is a \(G\) -obstruction. □
    Recall that a clause blocking the obstruction \(G^{\prime}\) is given by
    \begin{align*}\bigvee_{i \lt j,A_{G^{\prime}}(i,j)=1}\lnot e_{i,j}\lor\bigvee_{i \lt j,A_{G^{\prime} }(i,j)=0}e_{i,j}.\end{align*}
    Since \(G^{\prime}\) is non-canonical, this clause must be satisfied by every assignment which represents a canonical graph.
    If IsMinimal concludes that the partially defined graph is not canonical without a recursive call, i.e., we have a certificate \(\pi\) and a strong \((G,\pi)\) -indicator pair, then we can start the procedure GetObstruction with a partially defined graph with potentially more undefined edges constructed by the procedure ExtractSmall. The resulting graph \(G^{\prime}\) has the property that \(G^{\prime}\sqsubseteq G\) , \((i,j)\) is a strong \((G^{\prime\prime},\pi)\) -indicator pair, but for any \(G^{\prime\prime}\sqsubset G^{\prime}\) , the vertex pair \((i,j)\) isn’t a strong \((G^{\prime\prime},\pi)\) -indicator pair.
    Procedure 4: ExtractSmall
    Input: A partially defined graph \(G\) , a nc-certificate \(\pi\) and a \((G,\pi)\) -indicator pair \((i,j)\) .
    Output: A partially defined non-canonical graph \(G^{\prime}\sqsubseteq G\) .
    ExtractSmall( \(G,\pi,(i,j)\) ):
      We start with a partially defined graph \(G^{\prime}\in\mathcal{P}_{n}\) where all vertex pairs are undefined.
      We iterate over all vertex pairs \((i^{\prime},j^{\prime})\prec(i,j)\) with \(i^{\prime} \lt j^{\prime}\) :
    If \((i^{\prime},j^{\prime})\) is \(\pi\) -stable, we ignore the vertex pair and continue with the next vertex pair.
    If \(A_{G}(i^{\prime},j^{\prime})=1\) we set \(A_{G^{\prime}}(i^{\prime},j^{\prime})=A_{G^{\prime}}(j^{\prime},i^{\prime})=1\) and continue with the next vertex pair.
    If \(A_{\pi(G)}(i^{\prime},j^{\prime})=0\) we set \(A_{\pi(G^{\prime})}(i^{\prime},j^{\prime})=A_{\pi(G^{\prime})}(j^{\prime},i^{ \prime})=A_{G^{\prime}}(\pi^{-1}(i),\pi^{-1}(j))\) \(=A_{G^{\prime}}(\pi^{-1}(j),\pi^{-1}(i))=0\) .
    At the end, we set \(A_{G^{\prime}}(i,j)=A_{G^{\prime}}(j,i)=1\) and \(A_{\pi(G')}(i,j)= A_{G'}(\pi^{-1}(i),\pi^{-1}(j))=A_{G'}(\pi^{-1}(j),\pi^{-1}(i)) = 0\) . We return \(G^{\prime}\) given by its adjacency matrix.
    Example 5.
    For constructing a symmetry breaking clause given \(G_{\mathit{ex}}\) , let us pick a concrete permutation \(\pi\) from the ordered partition \([\{1\},\{5\},\{4\},\{2,3\},\{6\},\{7\},\{8,9,10\}]\) , e.g., \(\pi=(1)(25)(34)(6)(7)\) \((8)(9)(10)\) . ExtractSmall( \(G_{\mathit{ex}},\pi,(i,j)\) ) results in a partially defined graph \(G^{\prime}\) with \(A_{G^{\prime}}(i^{\prime},j^{\prime})=1\) for \((i^{\prime},j^{\prime})\in\{(2,4),(2,6)\}\) and \(A_{G^{\prime}}(i^{\prime},j^{\prime})=0\) for \((i^{\prime},j^{\prime})\in\{(1,5),(1,4),(1,3),(1,2),(5,6)\}\) , all other vertex pairs are undefined edges. Removing any defined edge or non-edge results in graph which isn’t certified non-canonical.
    So, the resulting clause is \(\lnot e_{2,4}\lor e_{1,5}\lor e_{1,4}\lor e_{1,3}\lor e_{1,2}\lor\lnot e_{2,6} \lor e_{5,6}\) .
    An intuitive way for getting the clause is by iterating over the more important vertex pairs \((i^{\prime},j^{\prime})\) than the indicator pair \((i,j)\) like in ExtractSmall, and proceeding as follows (i) if \((i^{\prime},j^{\prime})\) is \(\pi\) -stable then ignore it, (ii) if \(A_{G}(i^{\prime},j^{\prime})=1\) add the literal \(\lnot e_{i^{\prime},j^{\prime}}\) , and (iii) if \(A_{\pi(G)}(i^{\prime},j^{\prime})=0\) add the literal \(e_{\pi^{-1}(i^{\prime}),\pi^{-1}(j^{\prime})}\) . At the end, we add \(\lnot e_{2,6}\lor e_{5,6}\) resulting in the same clause as given above.
    We see that the clause is conflicting with the current partially defined graph. The given clause forbids a certain partially defined graph \(G^{\prime\prime}\sqsubseteq G_{\mathit{ex}}\) . We highlight the edges and non-edges of \(G^{\prime\prime}\) . For symmetric reasons, we omit marking the lower triangular matrix
    Bringing everything together, the algorithm MinCheck is given by Algorithm 5.
    Theorem 1.
    Given \(G\in\mathcal{P}_{n},\) as input, MinCheck(G) returns a \(G\) -obstruction or nil. If \(G\) is certified non-canonical then MinCheck(G) returns a \(G\) -obstruction.
    Proof.
    The correctness of Theorem 1 follows from Proposition 5 and Proposition 6. □
    Corollary 1.
    Given a fully defined graph \(G\in\mathcal{G}_{n}\) as input, MinCheck(G) returns a \(G\) -obstruction if and only if \(G\) is non-canonical.
    Algorithm 5: MinCheck
    Input: A partially defined graph \(G\in\mathcal{P}_{n}\) .
    Output: A \(G\) -obstruction if \(G\) is certified non-canonical.
      1: if IsMinimalG = false then
      2:      return GetObstructionG
      3: else
      4:      return nil

    Propagating Edges

    With some minor modifications of the algorithms, we can propagate the presence of a defined edge/non-edge given a partially defined graph \(G\in\mathcal{P}_{n}\) assuming the resulting fully defined graph \(H\in\mathcal{X}(G)\) to be canonical.
    We can use the procedure ExtractSmall as is with weak indicator pairs for getting a partially defined graph \(G^{\prime}\) with an nc-certificate. More precisely, the weak indicator pair of \(G\) is a strong indicator pair of \(G^{\prime}\) . The graph \(G^{\prime}\) is not necessarily an obstruction of \(G\) but still a non-canonical partially defined graph. So, the clause forbidding all partially defined graphs \(G^{\prime\prime}\) with \(G^{\prime}\sqsubseteq G^{\prime\prime}\) still must be satisfied by every canonical graph. Given the current variable assignment, all literals of the clause are assigned false or it is a unit clause. In the latter case, a literal can be propagated by boolean constraint propagation.
    This means that for each symmetry breaking clause, we have exactly one permutation used for constructing it. As we will see later, this also has the benefit that these eases validating the symmetry breaking clauses in a practical setting.

    Restricting nc-Certificates

    In many applications, it is tempting to fix a certain (induced) subgraph by assigning specific edge variables due to some knowledge of the structure of the searched for graphs. For example, if it is known that all graphs, satisfying the specified property, contain a clique of size \(k\) , one can add clauses to the encoding ensuring that the edge variables \(e_{u,v}\) for \(1\leq u\leq v\leq k\) are true in each model. As a result, SMS is not applicable, since the encoded property is not preserved by every permutation in \(\mathcal{S}_{n}\) . We still can use the SMS framework if we restrict the set of all permutations \(\mathcal{S}_{n}\) to permutations preserving the substructure. For example, if we encode that the first \(k\) vertices form a clique, then applying any permutations in \(\operatorname{Perm}([\{1,\ldots,k\},\{k+1,\ldots,n\}])\) to the graph still results in a clique of the first \(k\) vertices.
    SMS can be adapted to search for nc-certificates s solely described by an ordered partition \(P\) , by calling GetIndicatorPair with the ordered partition \(P\) (i.e., GetIndicatorPair \((G,P,1)\) ) instead of the ordered partition \([\{1,\ldots,n\}]\) representing \(\mathcal{S}_{n}\) . Then, the procedure only returns nc-certificates in \(\operatorname{Perm}(P)\) . Given an nc-certificate \(\pi\in\operatorname{Perm}(P)\) , we apply GetObstruction \((G,\pi)\) to get a \((G,\pi)\) -obstruction and construct a clause blocking this partially defined graph.

    5 Prototype Implementation and Experimental Setup

    In this section, we will describe our experimental setup and some implementation details.
    As the underlying solver, we use CaDiCaL with the new IPASIR-UP interface [20] which supports custom propagators. We used this interface to integrate our implementation of MinCheck written in C++ and add symmetry-breaking clauses during search. The most important callback functions in SMS for CaDiCaL are ”cb_has_external_clause,” which indicates whether a symmetry breaking clause can be added, and ”cb_add_external_clause_lit” allowing to add a clause literal by literal to the underlying solver. For more details, when ”cb_has_external_clause” is called, we refer to the IPASIR-UP paper.
    In previous work, we used Clingo [22, 23], an answer set programming solver containing a CDCL SAT solver. The source code and scripts for reproducing the results are available as part of the SMS package at https://github.com/markirch/sat-modulo-symmetries with documentation at https://sat-modulo-symmetries.readthedocs.io/.
    For the sake of simplicity, we generate our CNF encodings in Python and feed the encoding to the solver.
    The parameter frequency allows us to balance the time spent on the minimality check and the time spent by the SAT solver itself. If frequency has the value \(1/q\) , then MinCheck is called only every \(q\) th time when ”cb_has_external_clause” is called assuming a new edge variable has been assigned since the last call of MinCheck. The parameter cutoff is used to abort MinCheck if too much time is spend in the algorithm. If the cutoff has the value \(c\) , then we return nil, if after \(c\) calls of GetIndicatorPair, including recursive calls, no certificate was found.
    Using the parameters frequency and cutoff may result in an incomplete symmetry breaking. To circumvent this problem, one can either call MinCheck for fully defined graphs without a cutoff or use tools like Nauty [42] to filter isomorphic copies in a post-processing phase. In our experiments, we call MinCheck for fully defined graphs with a cutoff, if specified, and filter isomorphic copies with Nauty.
    Each of our experiments runs on a cluster of machines with different processors,4 under Ubuntu 18.04. All tests are executed with a single thread.

    6 Extremal Graphs with Required Girth

    A prominent research topic in Extremal Graph Theory [6] is the study of extremal graphs (i.e., graphs with the largest possible number of edges) on n vertices that exclude a given family \(\mathcal{F}\) of graphs as subgraphs. \(\mathrm{EX}(n,\mathcal{F})\) denotes the class of extremal graphs with that property, and \(\mathrm{ex}(n,\mathcal{F})\) denotes the number of edges of the graphs in \(\mathrm{EX}(n,\mathcal{F})\) . The special case, where \(\mathcal{F}=\mathcal{C}_{k}\) , the family of cycles up to length \(k\) , has received much attention; for convenience, we write \(f_{k}(n)=\mathrm{ex}(n,\mathcal{C}_{k})\) . The girth of a graph \(G\) is the length of a shortest cycle in \(G\) (or \(\infty\) if \(G\) is acyclic). Hence, \(\mathrm{EX}(n,\mathcal{C}_{k})\) contains precisely the edge-maximal graphs of girth \(\gt k\) . The base case of \(k=3\) has been settled over a century ago by Mantel's Theorem [40]: \(f_{3}(n)=\mathrm{ex}(n,\mathcal{C}_{3})=\lfloor n^{2}/4\rfloor\) , where \(\mathrm{EX}(n,\mathcal{F})\) contains precisely the complete bipartite graph \(K_{\lceil n/2\rceil,\lfloor n/2\rfloor}\) . For the general case \(k \gt 3\) , however, no closed formula is known, and researchers have tried to compute \(f_{k}(n)\) for small values of \(k\) [3, 11, 21, 51, 52], or at least provide lower and upper bounds.
    We describe a SAT encoding that produces for given integers \(n,m,k\) a propositional CNF formula \(F(n,m,k)\) . The formula is satisfiable if and only if there is a graph \(G\in\mathrm{EX}(n,\mathcal{C}_{k})\) with \(m\) edges. We will then evaluate the formula with our SMS-solver and report the experimental results.

    6.1 Encoding

    We state a useful result before we present the encoding for \(F(n,m,k)\) , where \(\delta_{G}\) and \(\Delta_{G}\) denote the minimum and maximum degree of a graph \(G\) , respectively.
    Lemma 2.
    ([21]). If \(G\) is a graph of girth \(\geq 5\) with n vertices and \(m\) edges, then \(n\geq 1+\Delta_{G}\cdot\delta_{G}\) , \(\delta_{G}\geq m-f_{4}(n-1)\) , and \(\Delta_{G}\cdot n\geq 2m\) .
    Proof.
    By taking a maximum degree vertex \(r\) and the simple observation that for each distinct \(u_{1},u_{2}\in N(r)\) the vertex \(r\) is the only common neighbor, we conclude that \(G\) contains a rooted tree \(T\) as subgraph with root \(r\) , where the \(\Delta_{G}\) children of \(r\) have at least \(\delta_{G}-1\) children, resulting in \(1+\Delta_{G}+(\Delta_{G}\cdot\delta_{G}-1)=1+\Delta_{G}\cdot\delta_{G}\) vertices.
    The inequality \(\delta_{G}\geq m-f_{4}(n-1)\) follows from the fact that a graph resulting from deleting a vertex with the lowest degree results in a graph with girth \(\geq 5\) .
    The last inequality follows from the Handshaking Lemma [53]. □
    In particular, Lemma 2 applies to all graphs in \(\mathrm{EX}(n,\mathcal{C}_{k})\) for \(k\geq 4\) . We also use the obvious inequalities \(\delta_{G}(n-1)+\Delta_{G}\leq 2m\) and \(\Delta_{G}(n-1)+\delta_{G}\geq 2m\) , which follow from the Handshaking Lemma and the presence of one maximum/minimum degree vertex, to discard some cases.
    According to Lemma 2, we can compute for each pair \(n,m\) the set \(I_{n,m}\) of possible intervals \([a,b]\) such that for each graph \(G\) with n vertices and \(m\) edges, we have \(a\leq\delta_{G}\leq\Delta_{G}\leq b\) for some \([a,b]\in I\) . We add to \(F(n,m,k)\) suitable cardinality constraints that ensure that vertex degrees belong to one of the intervals.
    For higher girths, we generalize Lemma 2 as follows:
    Lemma 3.
    If \(G\) is a graph of girth \(k\geq 7\) with n vertices and \(m\) edges, then \(n\geq 1+\Delta_{G}+\Delta_{G}\cdot(\delta_{G}-1)+\Delta_{G}\cdot(\delta_{G}-1) ^{2}\) , \(\delta_{G}\geq m-f_{k-1}(n-1)\) , and \(\Delta_{G}\cdot n\geq 2m\) .
    Proof.
    We take the rooted tree \(T\) mentioned in the proof of Lemma 2 as starting point. Two leaves of the tree \(T\) cannot have a common neighbor in \(V(G)\setminus V(T)\) . Otherwise, there would exist a cycle in \(G\) of length \(\leq\) 6. Hence, there is a subtree with \(1+\Delta_{G}+\Delta_{G}\cdot(\delta_{G}-1)+\Delta_{G}\cdot(\delta_{G}-1)^{2}\) vertices.
    The proof of the other two claims is analog to the proof of Lemma 2. □
    To guarantee that the resulting graph has girth \(\gt k\) , we use two methods: a basic one and a compact one for higher girths. The basic method explicitly forbids that any subset of up to \(k\) vertices forms a cycle. The set of all possible cycles of length \(k\) can be described with some basic symmetry breaking as follows:
    \begin{align*}C_{k}=\{ (v_{1},\dotsc,v_{k})\in\{1,\dots,n\}^{k}\;{:}\;i\not=j\rightarrow v_ {i}\not=v_{j},v_{1}=\min\{v_{1},\dotsc,v_{k}\},v_{2} \lt v_{k} \}.\end{align*}
    Taking \(v_{1}\) as the minimum fixes a particular rotation of the cycle, requiring \(v_{2} \lt v_{k}\) fixes an orientation of the cycle. Now we add for each element of \(C_{k}\) the constraint that one edge of the corresponding cycle must be absent
    \begin{align*}\bigwedge\limits_{(v_{1},\ldots,v_{k})\in C_{k}}(\lnot e_{v_{1},v_{2}}\lor \lnot e_{v_{2},v_{3}}\lor\cdots\lor\lnot e_{v_{k-1},v_{k}}\lor\lnot e_{v_{k},v _{1}}).\end{align*}
    For \(k\leq 4\) this is a workable solution, but the improved method scales better for larger \(k\) . It is based on the following observation where \(\mathit{dist}_{G}(u,v)\) denotes the number of edges of a shortest path between vertices \(u\) and \(v\) in graph \(G\) .
    Observation 3.
    A shortest cycle in a graph \(G\) containing the edge \(uv\in E(G)\) has length \(\mathit{dist}_{G-uv}(u,v)+1\) .
    Hence, we can enforce that for every edge \(uv\) , \(\mathit{dist}_{G-uv}(u,v)+1\geq g\) for a required girth \(g\) , equivalently \(\mathit{dist}_{G-uv}(u,v)\geq g-1\) . We proceed similar to breadth-first search. We start at vertex \(i\) and mark all vertices adjacent to \(i\) in \(G-ij\) . In the next step, we additionally mark all vertices which are adjacent to already marked vertices. This will be repeated \(g-2\) times. If at the end the vertex \(j\) is marked, the girth is smaller than desired.
    For the concrete encoding, we introduce propositional variables \(\mathit{reached}_{i,j,k,s}\) for representing that \(\mathit{dist}_{G-ij}(i,k)\leq s\) . Consequently
    \begin{align*}\begin{array}{lcl} \mathit{reached}_{i,j,k,1} & = & e_{i,k} \text{ for } k\in\{ 1,\dots,n\}\setminus\{i,j\} \text{and}\\\mathit{reached}_{i,j,k,s} & = & \bigvee\limits_{l\in V(G) \setminus\{k\}}(e_{l,k}\land\mathit{reached}_{i,j,l,s-1}) \text{ for } s\in\{2, \dotsc,g-2\}, k\in\{1,\dots,n\}\setminus\{i\}.\end{array}\end{align*}
    If at any point vertex \(j\) is reached, the girth restriction is violated. Hence, we can use the following encoding:
    \begin{align*}\mathit{girth}=\bigwedge\limits_{i \lt j}\bigwedge\limits_{s=2}^{g-2}(\lnot\mathit {reached}_{i,j,j,s}\lor\lnot e_{i,j}).\end{align*}
    We further improve this encoding. If we start checking for a vertex \(v\) whether \(\mathit{dist}_{G-uv}+1\geq g\) for all \(vu\in E\) , and we conclude yes, then \(v\) cannot be on a cycle which is shorter than the girth \(g\) . So for all subsequent vertices \(v^{\prime} \gt v\) , we only consider the graph \(G-v\) . This yields the following final encoding for the variables \(\mathit{reached}_{i,j,k,s}\) :
    \begin{align*}\begin{array}{lcl} \mathit{reached}_{i,j,k,1} & = & e_{i,k} \text{ for } k\in\{i+1, \dots,n\}\setminus\{j\} \text{ and }\\\mathit{reached}_{i,j,k,s} & = & \bigvee\limits_{l\in V(G) \setminus\{k\}}(e_{l,k}\land\mathit{reached}_{i,j,l,s-1}) \text{ for }s\in\{2, \dotsc,g-2\}, k\in\{i+1,\dots,n\}.\end{array}\end{align*}
    Codish et al. [11] improved their encoding by fixing the rooted tree mentioned in Lemma 2 as subgraph. These subtrees are also known as stars. By fixing a subgraph, not all permutations are applicable for symmetry breaking. As solution, they only test swapping vertex pairs which are not in the star and pairs of leaf nodes from the star with the same parent.
    Our framework allows breaking all symmetries coming from permuting vertices not in the star and leaf nodes from the star with the same parent. This is achieved by starting the minimality check with a different ordered partition \(P\) which ensures that each \(\pi\in\operatorname{Perm}(P)\) preserves the star. More precisely, let \(\Delta\) be the maximum degree of the graph sought for, \(r\) the root of the star, \(c_{1},\ldots,c_{\Delta}\) the children of \(r\) , \(C_{i}\) the set of children of \(c_{i}\) , and \(R\) the set of vertices not in the star (see Figure 3), then
    \begin{align*}P=[R,C_{1},\ldots,C_{\Delta},\{c_{1}\},\ldots,\{c_{\Delta}\},\{r\}],\end{align*}
    assuming that \(n=r\) , \(c_{i}=n-(\Delta+1)+i\) , \(v_{1} \lt v_{2}\) for all \(v_{1}\in C_{i},v_{2}\in C_{j}\) if \(i \lt j\) , and \(R=\{1,\ldots,|R|\}\) . For example, if \(\Delta=4,\delta=3\) and \(n=16\) , then \(R=\{1,2,3\},C_{1}=\{4,5\},C_{2}=\{6,7\},C_{3}=\{8,9\},C_{4}=\{10,11\},c_{1}=12, c_{2}=13,c_{3}=14,c_{4}=15,\) and \(r=16\) .
    Fig. 3.
    Fig. 3. Example of a star with \(\Delta=4\) and \(\delta=3\) .
    In general, we can consider all permutations for symmetry breaking which preserve the fixed subgraph, i.e., all permutations which, if restricted to the vertices of the star, are automorphisms. This allows us to further generalize the previous idea by swapping two subtrees of the star, i.e., starting with the ordered partition
    instead of
    for \(i \lt j\) and \(i,j\in\{1,\ldots,\Delta\}\) .
    To sum up, instead of calling the minimality check once, we call it several times with different initial ordered partitions. Note that this still results in an incomplete symmetry breaking. In future work, we plan to extend SMS to allow fixing arbitrary subgraphs while still producing only one graph per isomorphism class.

    6.2 Results

    We compute \(f_{k}(n)\) for \(k\in\{4,5,6\}\) , and thereby verify known results [3, 11]. For fixed \(k\) and n, we run SMS on the formulas \(F(n,f_{k}(n),k)\) and \(F(n,f_{k}(n)+1,k)\) ; we performed separate runs for all the intervals in \(I_{n,m}\) where \(m\) denotes the number of edges. The first formula must be satisfiable for at least one interval in \(I_{n,f_{k}(n)}\) while the second must be unsatisfiable for every interval in \(I_{n,f_{k}(n)+1}\) . In some cases, we don’t need to compute \(F(n,f_{k}(n)+1,k)\) , since already the bounds from Lemma 2 or Lemma 3 show the non-existence of a graph with \(f_{k}(n)+1\) edges.
    In general, for fixed \(k\) and n, we run SMS on \(F(n,m,k)\) for different values of \(m\) , starting from a lower bound obtained by Lemma 1. As long as \(F(n,m,k)\) is satisfiable, we increment \(m\) by one and repeat until we arrive at a value for which \(F(n,m,k)\) is unsatisfiable. Then, we know that \(f_{k}(n)=m-1\) .
    Tables 2 and 3 show our results for \(k=4\) and \(n\in\{15,\dots,28\}\) without and with using embedded stars. We use the basic method to encode the girth requirement and choose a frequency of \(1/20\) and no cutoff. For all tables in the current section, the runtimes are given in seconds; for SMS, we provide in parenthesis the fraction of the total time spent on the minimality check. The columns labeled ”sat” give the minimal time over all intervals in \(I_{n,m}\) which are satisfiable; the columns labeled ”unsat” give the maximum over all intervals. An entry ”n.a.” indicates that the unsatisfiability check is covered by Lemma 2; ”t.o.” indicates that the timeout of 4 hours has been reached without producing a result.
    Table 2.
      satunsat
    n \(f_{4}(n)\) SMSStaticSMSStatic
    15260.28(9%)0.18(0.3)n.a. n.a. 
    16280.19(8%)0.06(0.61)1.57(8%)17.45(32.2)
    17310.97(8%)0.07(0.48)n.a. n.a. 
    18340.85(9%)0.18(0.6)n.a. n.a. 
    19380.30(13%)0.11(0.57)n.a. n.a. 
    20414.75(10%)2.11(161.41)n.a. n.a. 
    21441.14(12%)0.23(151.84)1.51(15%)280.88(1,019.41)
    22473.54(26%)2.99(16.69)6.35(28%)8,848.13(t.o.)
    235023.54(36%)5.69(367.83)19.59(34%)t.o.(t.o.)
    24543.16(13%)22.30(80.74)n.a. n.a. 
    2557433.47(31%)4.09(655.66)1,161.00(34%)t.o.(t.o.)
    266169.27(27%)26.05(168.9)n.a. n.a. 
    27654,143.65(34%)403.25(193.44)n.a. n.a. 
    2868328.30(10%)96.50(t.o.)t.o. t.o.(t.o.)
    Table 2. Results for Computing \(f_{4}(n)\) in Seconds
    Table 3.
      satunsat
    n \(f_{4}(n)\) SMS \(+\) starStatic \(+\) starSMS \(+\) starStatic \(+\) star
    15260.05(1%)0.06(0.11)n.a. n.a. 
    16280.05(2%)0.06(0.25)0.47(3%)5.63(3.63)
    17310.09(2%)0.06(0.19)n.a. n.a. 
    18340.16(5%)0.08(0.27)n.a. n.a. 
    19380.10(1%)0.08(0.21)n.a. n.a. 
    20411.62(5%)4.70(8.51)n.a. n.a. 
    21440.16(3%)0.16(15.57)0.23(3%)0.78(0.56)
    22470.39(3%)0.29(23.72)0.56(3%)6.37(24.31)
    23500.62(3%)0.34(6.94)3.98(4%)265.51(2,269.73)
    24543.95(5%)2.28(12.47)n.a. n.a. 
    25572.54(4%)4.66(59.7)215.51(5%)t.o.(t.o.)
    266117.51(6%)5.85(24.41)n.a. n.a. 
    2765120.78(7%)16.13(23.62)n.a. n.a. 
    286868.73(6%)70.07(52.81)t.o. t.o.(t.o.)
    Table 3. Results for Computing \(f_{4}(n)\) Fixing a Subtree
    We would like to emphasize that the purpose of the experiments is not to identify which algorithm is the fastest but rather to gain insights into the potential of a dynamic symmetry breaking for graph generation. We provide for reference the running times of our encoding of the static symmetry breaking (columns labeled ”Static”) and the times reported by Codish et al. [11] with their “improved lexicographic break” (given in parentheses) for the same problems. This is not meant as a direct comparison, as the results by Codish et al. [11] have been run on different hardware, but just to give a rough idea on the order of magnitude the two approaches take. It is not completely clear how Codish et al. combined runtimes over all intervals \(I_{n,m}\) into one single result. This has no impact on the unsat-times reported by Codish et al., because for those which finished within the given time limit, there is only a single interval in \(I_{n,m}\) .
    We can see that SMS is significantly faster for the unsatisfiable instances. For example, SMS determines the unsatisfiable case for \(n=23\) under 20 seconds without fixing embedded stars, although the static approach reached the timeout of 4 hours. SMS could also establish the unsatisfiability case for \(n=25\) . We see that SMS, in many cases, uses a significant fraction of the time for the minimality check. Therefore, a speedup for the check would have a substantial impact on the runtime. As expected, the time spend in the minimality check decreases when fixing embedded stars as fewer permutations must be considered by the minimality check.
    Next, we report on results for computing \(f_{k}(v)\) for \(k\in\{5,6\}\) . For these cases, we used the girth constraints based on edge removal from Section 6.1. In these experiments, we see that far less time is spent on the minimality check than in the previous experiments, although there we had a frequency of \(1/20\) . Most likely, the reasons are the increased number of clauses and the additionally created variables for the girth-constraints, because the minimality check is only called when a variable \(e_{i,j}\) is assigned. The results are shown in Table 4.
    Table 4.
    n \(f_{5}(n)\) satunsat \(f_{6}(n)\) satunsat
    15221.31(7%)5.96(6%)180.44(8%)2.13(5%)
    16240.28(6%)1.19(5%)200.63(6%)n.a. 
    17263.05(9%)1.26(6%)221.59(5%)n.a. 
    18290.79(7%)n.a. 232.36(5%)14.62(9%)
    19319.52(10%)6.67(7%)252.93(5%)n.a. 
    20345.86(9%)n.a. 273.39(5%)n.a. 
    21364.39(11%)29.30(12%)297.24(6%)n.a. 
    223910.83(16%)n.a. 3126.57(9%)n.a. 
    2342109.99(18%)n.a. 336.87(6%)n.a. 
    244547.88(13%)n.a. 363.79(4%)n.a. 
    254823.33(10%)n.a. 3722.21(8%)23,291.21(18%)
    26523.29(7%)n.a. 393.99(4%)n.a. 
    275343.61(10%)t.o. 4179.56(14%)n.a. 
    28567.28(26%)25.35(17%)431,226.54(13%)n.a. 
    Table 4. Results for Computing \(f_{5}(v)\) and \(f_{6}(v)\) in Seconds
    Table 5 shows the influence of the parameter frequency on SMS's performance. For this analysis, we took the unsatisfiable case for \(f_{4}(25)\) with the degree interval \([4,6]\) and the satisfiable case for \(f_{4}(27)\) with the degree interval \([4,5]\) .
    Table 5.
    frequency \(n=27\) (sat) \(n=25\) (unsat)
    1/11,220.22(84%)5,756.80(90%)
    1/21,789.70(83%)3,447.59(84%)
    1/59,846.08(62%)1,699.04(70%)
    1/10t.o. 901.56(54%)
    1/201,869.03(43%)1,203.74(40%)
    1/502,513.94(18%)1,221.33(19%)
    1/100841.28(9%)594.95(10%)
    1/200797.20(4%)871.52(5%)
    1/500379.97(1%)1,694.70(2%)
    1/1,000423.31(0%)2,303.42(1%)
    Table 5. Results for Different Frequencies
    For the satisfiable instance, it seems that lower frequencies perform better peaking with \(1/500\) while for the unsatisfiable instance, it performed best with a frequency of \(1/100\) . For very low frequencies, both instances do not perform well. The reason seems to be the high fraction of the time spent in MinCheck and possibly the increased number of added symmetry breaking clauses.

    7 Diameter- \(\mathbf{2}\) -Critical Graphs

    The diameter of a graph \(G\) is the largest distance over all vertex pairs in \(G\) , where the distance of two vertices is the length of a shortest path between them. A disconnected graph has diameter \(\infty\) . A graph is diameter- \(d\) -critical if its diameter is \(d\) , but the deletion of any edge increases the diameter. The study of extremal properties of graphs with prescribed diameter has been initiated by Erdős and Rényi in the early 1960s [17] and has been the subject of intensive research. An important topic in the field is the characterization of diameter- \(d\) -critical graphs [7, 8, 26, 39]. An intriguing open problem is whether the Murty–Simon Conjecture [7] holds, which states that if \(G\) is a diameter- \(2\) -critical graph with n vertices and \(m\) edges, then \(n\leq\lfloor n^{2}/4\rfloor\) , with equality precisely for the complete bipartite graph \(K_{\lceil n/2\rceil,\lfloor n/2\rfloor}\) (i.e., similar to Mantel's Theorem mentioned above). Using the list of non-isomorphic graphs generated with Nauty [42], Radosavljević and Živković [47] computed all diameter- \(2\) -critical graphs with up to 10 vertices. Also, Dailly et al. [13] reported on a “computer search” for graphs with up to 11 vertices, focusing on graphs with a certain number of edges. With SMS, we were able to extend these results to graphs with 13 vertices. The basis for this computation is a SAT encoding that produces for given integers n and \(m\) a propositional CNF formula \(D_{2}(n,m)\) which is satisfiable if and only if there is a diameter-2-critical graph \(G\) with n vertices and \(m\) edges. As above, one can construct \(G\) from the satisfying assignment.

    7.1 Encoding

    Equivalently to the above definition, a graph with at least three vertices is diameter-2-critical if and only if (i) its diameter is at most 2 and (ii) when any edge is deleted, the diameter is larger than 2. We observe that property (i) holds for graphs with diameter one, i.e., complete graphs. However, for graphs with order of at least 3, deleting any edge would still result in a diameter of at most \(2\) , which violates property (ii).
    Our encoding of \(D_{2}(n,m)\) handles both properties separately. We use variables \(c_{i,j,k}\) to indicate whether \(k\) is a common neighbor of \(i\) and \(j\) , i.e., \(c_{i,j,k}\leftrightarrow(e_{i,k}\land e_{j,k}).\) To encode property (i), we use
    \begin{align*}\bigwedge_{1\leq i \lt j\leq n}\big{(}e_{i,j}\lor\bigvee_{\begin{subarray}{c}1\leq k \leq n,\\k\notin\{i,j\}\end{subarray}}c_{i,j,k}\big{)}.\end{align*}
    For property (ii), we use the following observation:
    Observation 4.
    A graph \(G\) with diameter 2 is diameter- \(2\) -critical if and only if for every edge \(ij\in E(G)\) at least one of the following cases holds:
    The vertices \(i,j\) have no common neighbor.
    There is a vertex \(k\notin\{i,j\}\) such that \(ik\notin E(G)\) and the vertex \(j\) is the only common neighbor of \(i\) and \(k\) .
    Similarly, there is a vertex \(k\notin\{i,j\}\) such that \(jk\notin E(G)\) and the vertex \(i\) is the only common neighbor of \(j\) and \(k\) .
    Proof.
    ( \(\Leftarrow\) ) In the first case, \(\mathit{dist}_{G-ij}(i,j) \gt 2\) in the later cases either \(\mathit{dist}_{G-ij}(i,k) \gt 2\) or \(\mathit{dist}_{G-ij}(j,k) \gt 2\) .
    ( \(\Rightarrow\) ) Let \(G\) be a diameter- \(2\) -critical graph. By definition, for every edge \(ij\in E(G)\) , there exists two vertices \(k_{1},k_{2}\in V(G)\) such that \(\mathit{dist}_{G-ij}(k_{1},k_{2}) \gt 2\) and \(\mathit{dist}_{G}(k_{1},k_{2})\leq 2\) . This means, that each path between \(k_{1}\) and \(k_{2}\) with length \(\leq 2\) contains the edge \(ij\) and there is a path between \(k_{1}\) and \(k_{2}\) with length \(\leq 2\) containing the edge \(ij\) . Let \(ij\in E(G)\) and \(k_{1},k_{2}\in V(G)\) such that \(\mathit{dist}_{G-ij}(k_{1},k_{2}) \gt 2\) and \(\mathit{dist}_{G}(k_{1},k_{2})\leq 2\) . We distinguish the following cases:
    \(k_{1}=k_{2}\) : this cannot be the case, otherwise \(\mathit{dist}_{G-ij}(k_{1},k_{2})=0\) , in conflict with \(\mathit{dist}_{G-ij}(k_{1},k_{2}) \gt 2\) .
    \(k_{1}\notin\{i,j\},k_{2}\notin\{i,j\},\) and \(k_{1}\not=k_{2}\) : this is not possible, because each path in \(G\) containing the vertices \(k_{1},k_{2}\) and the edge \(ij\) would have length \(\gt 2\) , in conflict with the existence of a path between \(k_{1}\) and \(k_{2}\) with length \(\leq 2\) containing the edge \(ij\) .
    \(\{k_{1},k_{2}\}=\{i,j\}\) : in this case, the vertices \(i,j\) cannot have a common neighbor, otherwise \(\mathit{dist}_{G-ij}(k_{1},k_{2})=\mathit{dist}_{G-ij}(i,j)=2\) .
    \(k_{1}=i,\) and \(k_{2}\notin\{i,j\}\) : the vertices \(i,k_{2}\) are not adjacent and have only \(j\) as common neighbor, otherwise \(\mathit{dist}_{G-ij}(k_{1},k_{2})=\mathit{dist}_{G-ij}(i,k_{2})\leq 2\) .
    \(k_{1}=j,\) and \(k_{2}\notin\{i,j\}\) : analog to the previous case, the vertices \(j,k_{2}\) are not adjacent and have only \(i\) as common neighbor.
    Because the distance of two vertices is symmetric, we omit the following two cases: (i) \(k_{2}=i,\) and \(k_{1}\notin\{i,j\}\) , and (ii) \(k_{2}=j,\) and \(k_{1}\notin\{i,j\}\) .
    The case distinction is exhaustive. Thus, we showed that if a graph \(G\) is diameter- \(2\) -critical and \(ij\in E(G)\) , then (i) the vertices \(i,j\) have no common neighbor, (ii) there is a vertex \(k\notin\{i,j\}\) such that \(ik\notin E(G)\) and \(j\) is the only common neighbor of \(i\) and \(k\) , or (iii) there is a vertex \(k\notin\{i,j\}\) such that \(jk\notin E(G)\) and \(i\) is the only common neighbor of \(j\) and \(k\) . □
    The case distinction from Observation 4 can be encoded as follows:
    \(F_{1}:=\bigwedge_{k\in V\setminus\{i,j\}}\lnot c_{i,j,k}\)
    \(F_{2}:=\bigvee_{k\in V\setminus\{i,j\}}\big{(}\lnot e_{i,k}\land\bigwedge_{l \in V\setminus\{i,j,k\}}\lnot c_{i,k,l}\big{)}\)
    \(F_{3}:=\bigvee_{k\in V\setminus\{i,j\}}\big{(}\lnot e_{j,k}\land\bigwedge_{l \in V\setminus\{i,j,k\}}\lnot c_{j,k,l}\big{)}\)
    Hence, we can encode property (ii) as follows:
    \begin{align*}\bigwedge_{1\leq i \lt j\leq n}e_{i,j}\rightarrow(F_{1}\lor F_{2}\lor F_{3}).\end{align*}

    7.2 Results

    We use the encoding \(D_{2}(n,m)\) to enumerate all canonical, diameter- \(2\) -critical graphs in \(\mathcal{G}_{n}\) . Therefore, we run SMS repeatedly; each time we find a new graph, we explicitly exclude it from the search space until no further graph is found. We us a frequency of 1/20 and a cutoff of 20,000.
    Table 6 shows the results of this computation. Column ”#-sol” gives the number of solutions found; column ”#-graphs” gives the number of solutions up to isomorphism computed produced by SMS and filtered with Nauty; column ”time” gives the runtime in seconds; as above, the percentage of the runtime that has been spent for the minimality check is given in parenthesis. Column ”Static” gives the number of solutions found with the static symmetry breaking method, without filtering isomorphic solutions. The static version could not find all solutions for \(n=12\) within an hour.
    Table 6.
      SMSStatic
    n#-graphs#-soltime#-soltime
    3110.00(23%)10.00
    4220.00(22%)20.00
    5330.00(23%)40.00
    6550.00(32%)110.00
    710100.01(37%)320.01
    830300.05(47%)1630.04
    91031030.17(39%)1,0240.30
    105195190.73(26%)9,8363.58
    113,7463,7484.48(18%)135,01077.00
    1240,86640,87647.71(14%)t.o.t.o.
    13688,120688,1431,184.47(8%)t.o.t.o.
    Table 6. Results for Generating All Diameter- \(2\) -Critical Graphs with \(n\leq 13\)
    The number of solutions for \(n\in\{11,12,13\}\) , stated in boldface, was unknown, as this goes beyond a generate-and-test approach. One can see from the table, even with a cutoff parameter of 20,000, SMS produces only a few isomorphic copies, which can be easily filtered. Checking the computed graphs, we could confirm the Murty–Simon Conjecture for graphs with up to \(13\) vertices.
    If we know the degree of the vertices in advance, we can create an initial ordered partition for the minimality check, such that only vertices with the same degree can be permuted. So, we can use SMS for every possible degree sequence. Trivially, all cases where a vertex has degree 1 can be excluded. Additionally, we can use the following theorem by Fan [19] to discard further sequences in advance ( \(d_{G}(v)\) denotes the degree of vertex \(v\) in \(G\) ):
    Theorem 2.
    ([19]). If \(G\) is a diameter- \(2\) -critical with n vertices and \(m\) edges, then \(\sum_{v\in V(G)}d_{G}(v)^{2}\leq\frac{4}{15}n^{3}\) . If \(n\leq 24\) , then \(m\leq\lfloor n^{2}/4\rfloor\) .
    Consequently, since \(\sum_{v\in V(G)}d_{G}(v)=2m\) , Theorem 2 limits the degree sequences, i.e., we can list all of them and separately search for graphs with SMS satisfying a specific degree sequence. Further, we can restrict the maximal degree using the following theorem:
    Theorem 3.
    ([25]). If \(G\) is a diameter- \(2\) -critical with n vertices and maximum degree \(\geq 0.7\cdot n\) , then \(G\) has fewer than \(\lfloor n^{2}/4\rfloor\) edges.
    Parallelizing over all relevant combinations of vertex degrees resulting from Theorems 1 and 2, we could confirm the conjecture for \(n\in\{14,\dots,19\}\) . We give some details on the computation in Table 7.
    Table 7.
    ntotal timemax-time#-seq
    1416 minutes9 seconds406
    152.2 hours20 seconds1,729
    167.9 hours35 seconds3,480
    1719.9 hours74 seconds5,620
    183.4 days132 seconds12,974
    1923.7 days312 seconds50,054
    Table 7. Confirming the Murty–Simon Conjecture for \(n\in\{14,\dots,19\}\)
    Column ”n” denotes the number of vertices, column ”#-seq” the number of degree sequences, ”max-time” the maximal runtime of a single degree sequence, and ”total-time” the accumulated runtime over all sequences.
    Corollary 2.
    The Murty–Simon Conjecture holds for graphs with up to 19 vertices.

    8 Ramsey Numbers and Sets of Ramsey Graphs

    Our last showcase example are Ramsey numbers and sets of Ramsey graphs. Given two positive integers \(x\) and \(y\) , \(\mathcal{R}(x,y,n)\) denotes the set of all graphs up to isomorphism with n vertices not containing an independent set of size \(x\) nor a clique of size \(y\) . The Ramsey number \(R(x,y)\) is the smallest integer such that \(\mathcal{R}(x,y,R(x,y))=\emptyset\) . The problem of finding lower and upper bounds for Ramsey numbers is a well-known research topic started by Ramsey in 1930 [48, 49]. Despite the great interest and effort in this research area, exact Ramsey numbers are only known for small values of \(x\) and \(y\) . Table 8 summarizes these results. For symmetric reasons, i.e., \(R(x,y)=R(y,x)\) , we omit the lower half.
    Table 8.
      \(x=3\) \(x=4\) \(x=5\) \(x=6\) \(x=7\) \(x=8\)
    \(y=3\) 6914182328
    \(y=4\)  182536–4149–6159–84
    \(y=5\)   43–4858–8780–143101–216
    \(y=6\)    102–165115–298134–495
    Table 8. Exact Values and Bounds for Ramsey Numbers \(R(x,y)\)
    Although we could not improve these bounds, to the best of our knowledge, we are the first to be able to produce proofs for sets \(\mathcal{R}(x,y,n)\) being complete. This can be achieved by a verification process described by Kirchweger et al. [33]. First, we generate the additional symmetry breaking clauses needed and verify them for correctness. To efficiently verify the correctness of a symmetry breaking clause, we additionally store the nc-certificate used for deriving the clause. Each clause blocks a partially defined graph \(G\) . Given the nc-certificate \(\pi\) , we check whether \(G\) has a \(\pi\) -indicator pair. This is possible in polynomial time by iterating over all vertex pairs in lexicographic order, and verifying that all more important vertex pairs than the most important \((G,\pi)\) -greater vertex pair are \((G,\pi)\) -greater-equal.
    Next, we extend our original formula with the additional clauses and produce a deletion, reverse asymmetric tautology (DRAT) proof [12] by a second solver supporting proof production. The DRAT proof itself can be verified by a separate proof checker. To verify that the set of (canonical) graphs is complete, we add clauses ensuring that at least one edge/non-edge is different for each graph. If the set is complete, SMS reports unsat.
    It remains to verify that the list of graphs doesn’t contain isomorphic copies. Since we generate lexicographically minimal graphs, isomorphic copies would be identical. However, for this argument one needs to trust that the minimality check is indeed complete for fully defined graphs. To provide a certificate for minimality, we transform the adjacency matrix of a graph \(G\in\mathcal{G}_{n}\) into a CNF-formula \(M_{G}\) , such that \(M_{G}\) is unsatisfiable if and only if \(G\) is canonical. Consequently, we can use DRAT proofs for certifying that \(G\) is canonical. Let us informally sketch the construction of \(M_{G}\) based on Proposition 2. We use propositional variables \(p_{v,u}\) representing a permutation and \(q_{i,j}\) for indicating whether \((i,j)\) is an indicator pair with respect to the permutation represented by the variables \(p_{v,u}\) and the graph \(G\) . Encoding that there is an indicator pair and the variables \(p_{v,u}\) indeed represent a permutation is straightforward.

    8.1 Encoding and Results

    We encode the problem by ensuring that every subset of vertices of size \(x\) contains an edge, and for every subset of vertices of size \(y\) , there is a non-edge. Hence, our encoding \(F(x,y,n)\) is as follows:
    \begin{align*}F(x,y,n)=\bigwedge_{S\subseteq\{1,\ldots,n\},|S|=x}\Big{(}\bigvee_{i,j\in S,i \lt j}e_{i,j}\Big{)}\land\bigwedge_{S\subseteq\{1,\ldots,n\},|S|=y}\Big{(}\bigvee_ {i,j\in S,i \lt j}\lnot e_{i,j}\Big{)}.\end{align*}
    Using this encoding, we are able to enumerate the sets \(\mathcal{R}(3,5,n)\) and \(\mathcal{R}(4,4,n)\) . The results are summarized in Table 9. The results themselves were already computed by other intricate tools that do not provide any kind of certification. The graphs were previously used for computing the Ramsey number \(R(4,5)\) by “gluing” together graphs in \(\mathcal{R}(3,5,n_{1})\) and \(\mathcal{R}(4,4,n_{2})\) , i.e., by fixing some induced subgraphs [43]. More precisely, for every graph \(G\in\mathcal{R}(4,5,n)\) , one can pick a vertex \(v\) . The neighborhood of the vertex must form a graph in \(\mathcal{R}(4,4,n_{1})\) and all non-adjacent vertices form a graph in \(\mathcal{R}(3,5,n_{2})\) , where \(n_{1}\) is the size of the neighborhood of \(v\) and \(n_{2}=n-n_{1}-1\) .
    Table 9.
      \(\mathcal{R}(3,5,n)\) \(\mathcal{R}(4,4,n)\)
    n#-soltime#-soltime
    110.0010.00
    220.0020.00
    330.0040.00
    470.0090.00
    5130.00240.00
    6320.00840.01
    7710.013620.03
    81790.032,0790.16
    92900.0514,7011.25
    103130.05103,70611.99
    111050.05546,35680.92
    12120.031,449,166531.44
    1310.021,184,231227.95
    14  130,81628.70
    15  6400.66
    16  20.15
    17  10.14
    total1,0290.243,432,184883.41
    Table 9. Results for Generating All \((4,4,n)\) Graphs and \((3,5,n)\) Graphs in Seconds

    9 Conclusion

    We presented SMS, a novel approach for SAT-based graph generation that utilizes dynamic symmetry breaking. A key ingredient of SMS is the concept of partially defined graphs and an algorithm that checks the lexicographical minimality of such graphs. We evaluated a prototype implementation of SMS on three showcase problems from Extremal Combinatorics, related to the girth, diameter, and forbidden cliques and independent sets, respectively. We compared SMS with static symmetry breaking, using the same encoding for the graph property and the same underlying SAT solver for both approaches. We think that this double strategy might be of independent interest, as it supports comparing the very same SAT-encoding on both methods. The experiments show encouraging results for SMS, in particular on unsatisfiable instances. As a side effect of our experiments on diameter- \(2\) -critical graphs, we could compute some values that haven’t been known before and confirm the Murty–Simon Conjecture for graphs with up to \(19\) vertices.
    Since the release of the preliminary version of SMS in 2021 [36], some extensions and applications have come to the fore. SMS has been extended to matroids, contributing to advancements in Rota's Basis Conjecture [33]. Additionally, it has been adapted for hypergraphs to tackle the Erdős–Faber–Lovász Conjecture [32], extended to encompass planar and directed graphs [34], and utilized to compute smallest universal graphs [55], smallest unsatisfiable \((k,s)\) -SAT instances [54], and the exact rainbow cycle numbers for small values [37]. Also, it was the first method to show that the size of a Kochen-Specker vector system is at least 24 [31]. Notably, this result was independently matched using a SAT \(+\) CAS approach [38], in which a SAT solver interacts with a computer algebra system.
    In the future, we plan to use SMS to make progress on many other conjectures related to combinatorial structures and try to find better constraint-based approaches for graph generation and enumeration.

    Footnotes

    1
    CDCL is the predominantly leading algorithmic paradigm for SAT solvers [41].
    2
    For example, one can choose a generator of the symmetry group.
    3
    Codish et al. [11] also use the term ordered partition, but our definition is more general. We don’t require that for a later set in the partition all elements must be greater than in all previous sets from the partition.
    4
    Intel Xeon E5540, E5649, E5-2630 v2, E5-2640 v4@ at most 2.60 GHz, AMD EPYC [email protected] GHz.

    References

    [1]
    2023a. The On-Line Encyclopedia of Integer Sequences. Number of Connected Graphs with n Nodes. Retrieved from http://oeis.org/A001349
    [2]
    2023b. The On-Line Encyclopedia of Integer Sequences. Number of Connected Labeled Graphs with n Nodes. Retrieved from http://oeis.org/A001187
    [3]
    E. Abajo and A. Diánez. 2015. Exact Value of \(ex(n;\{C_{3},\ldots,C_{s}\})\) for \(n\leq\lfloor\frac{25(s-1)}{8}\rfloor\) . Discrete Math. 185, 1–7. DOI:
    [4]
    László Babai and Eugene M. Luks. 1983. Canonical Labeling of Graphs. In Proceedings of the 15th Annual ACM Symposium on Theory of Computing. ACM, New York, NY, 171–183. DOI:
    [5]
    Rolf Backofen and Sebastian Will. 2002. Excluding Symmetries in Constraint-Based Search. Constraints 7, 3–4 (2002), 333–349. DOI:
    [6]
    Béla Bollobás. 1978. Extremal Graph Theory. Academic Press.
    [7]
    Louis Caccetta and Roland Häggkvist. 1979. On Diameter Critical Graphs. Discrete Math. 28, 3 (1979), 223–229. DOI:
    [8]
    Ya-Chen Chen and Zoltán Füredi. 2005. Minimum Vertex-Diameter-2-Critical Graphs. J. Graph Theory 50, 4 (2005), 293–315. DOI:
    [9]
    Geoffrey Chu, Maria Garcia de la Banda, Christopher Mears, and Peter J. Stuckey. 2014. Symmetries, Almost Symmetries, and Lazy Clause Generation. Constraints 19, 4 (2014), 434–462. DOI:
    [10]
    Michael Codish, Graeme Gange, Avraham Itzhakov, and Peter J. Stuckey. 2016. Breaking Symmetries in Graphs: The Nauty Way. In Proceedings of the Principles and Practice of Constraint Programming—22nd International Conference, CP’16, Lecture Notes in Computer Science, Vol. 9892. Springer Verlag, 157–172. DOI:
    [11]
    Michael Codish, Alice Miller, Patrick Prosser, and Peter J. Stuckey. 2019. Constraints for Symmetry Breaking in Graph Representation. Constraints 24, 1 (2019), 1–24. DOI:
    [12]
    Luís Cruz-Filipe, Marijn J. H. Heule, Warren A. Hunt, Matt Kaufmann, and Peter Schneider-Kamp. 2017. Efficient Certified RAT Verification. In Automated Deduction—CADE 26. Leonardo de Moura (Ed.). Springer International Publishing, Cham, 220–236.
    [13]
    Antoine Dailly, Florent Foucaud, and Adriana Hansberg. 2019. Strengthening the Murty-Simon Conjecture On Diameter 2 Critical Graphs. Discrete Math. 342, 11 (2019), 3142–3159. DOI:
    [14]
    Jo Devriendt, Bart Bogaerts, and Maurice Bruynooghe. 2017. Symmetric Explanation Learning: Effective Dynamic Symmetry Handling for SAT. In Proceedings of the Theory and Applications of Satisfiability Testing—SAT 2017 — 20th International Conference, Lecture Notes in Computer Science, Vol. 10491. Springer Verlag, 83–100. DOI:
    [15]
    Jo Devriendt, Bart Bogaerts, Maurice Bruynooghe, and Marc Denecker. 2016. Improved Static Symmetry Breaking for SAT. In Proceedings of the Theory and Applications of Satisfiability Testing—SAT 2016—19th International Conference, Lecture Notes in Computer Science, Vol. 9710. Springer Verlag, 104–122. DOI: https://doi.org/10.1007/978-3-319-40970-2_8
    [16]
    Jo Devriendt, Bart Bogaerts, Broes De Cat, Marc Denecker, and Christopher Mears. 2012. Symmetry Propagation: Improved Dynamic Symmetry Breaking in SAT. In Proceedings of the IEEE 24th International Conference on Tools with Artificial Intelligence, ICTAI12. IEEE Computer Society, 49–56. DOI:
    [17]
    P. Erdős and A. Rényi. 1962. On a problem in the theory of graphs. Publ. Math. Inst. Hung. Acad. Sci. 7A, 623–641.
    [18]
    Torsten Fahle, Stefan Schamberger, and Meinolf Sellmann. 2001. Symmetry Breaking. In Proceedings of the Principles and Practice of Constraint Programming—CP’01, Lecture Notes in Computer Science, Vol. 2239. Springer Verlag, 93–107. DOI:
    [19]
    Genghua Fan. 1987. On Diameter 2-Critical Graphs. Discret. Math. 67, 3 (1987), 235–240. DOI:
    [20]
    Katalin Fazekas, Aina Niemetz, Mathias Preiner, Markus Kirchweger, Stefan Szeider, and Armin Biere. 2023. IPASIR-UP: User Propagators for CDCL. In Proceedings of the 26th International Conference on Theory and Applications of Satisfiability Testing, SAT’23, LIPIcs, Vol. 271. Schloss Dagstuhl—Leibniz-Zentrum für Informatik, 8:1–8:13. DOI:
    [21]
    David K. Garnick, Y. H. Harris Kwong, and Felix Lazebnik. 1993. Extremal Graphs Without Three-Cycles or Four-Cycles. J. Graph Theory 17, 5 (1993), 633–645. DOI:
    [22]
    Martin Gebser, Roland Kaminski, Benjamin Kaufmann, Max Ostrowski, Torsten Schaub, and Philipp Wanko. 2016. Theory Solving Made Easy with Clingo 5. In Proceedings of the Technical Communications of the 32nd International Conference on Logic Programming (ICLP’16), OASICS, Vol. 52. Dagstuhl, 2:1–2:15. DOI:
    [23]
    Martin Gebser, Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub. 2014. Clingo = ASP + Control: Preliminary Report. http://arXiv.org/abs/1405.3694arXiv:1405.3694.
    [24]
    Ian P. Gent, Karen E. Petrie, and Jean-François Puget. 2006. Symmetry in Constraint Programming. In Handbook of Constraint Programming. Foundations of Artificial Intelligence, Vol. 2. Elsevier, 329–376.
    [25]
    Teresa Haynes, Michael Henning, Lucas Merwe, and Anders Yeo. 2014. A Maximum Degree Theorem for Diameter-2-Critical Graphs. Open Math. 12, 12 (2014), 1882–1889. DOI:
    [26]
    Teresa W. Haynes, Michael A. Henning, Lucas C. van der Merwe, and Anders Yeo. 2015. Progress on the Murty-Simon Conjecture on Diameter-2 Critical Graphs: A Survey. J. Comb. Optim. 30, 3 (2015), 579–595. DOI:
    [27]
    Marijn J. H. Heule. 2019. Optimal Symmetry Breaking for Graph Problems. Math. Comput. Sci. 13, 4 (2019), 533–548. DOI:
    [28]
    Avraham Itzhakov and Michael Codish. 2016. Breaking Symmetries in Graph Search with Canonizing Sets. Constraints 21, 3 (2016), 357–374. DOI:
    [29]
    Avraham Itzhakov and Michael Codish. 2020. Incremental Symmetry Breaking Constraints for Graph Search Problems. In Proceedings of the 34rth AAAI Conference on Artificial Intelligence, AAAI’20, the 32nd Innovative Applications of Artificial Intelligence Conference, IAAI’20, the 10th AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI’20. AAAI Press, 1536–1543. DOI:
    [30]
    Avraham Itzhakov and Michael Codish. 2023. Breaking Symmetries with High Dimensional Graph Invariants and Their Combination. In Proceedings of the Integration of Constraint Programming, Artificial Intelligence, and Operations Research—20th International Conference, CPAIOR’23, Lecture Notes in Computer Science, Vol. 13884. Springer Verlag, 133–149. DOI:
    [31]
    Markus Kirchweger, Tomás Peitl, and Stefan Szeider. 2023a. Co-Certificate Learning with SAT Modulo Symmetries. In Proceedings of the 32nd International Joint Conference on Artificial Intelligence, IJCAI’23. 1944–1953. DOI:
    [32]
    Markus Kirchweger, Tomás Peitl, and Stefan Szeider. 2023b. A SAT Solver's Opinion on the Erdős-Faber-Lovász Conjecture. In Proceedings of the 26th International Conference on Theory and Applications of Satisfiability Testing, SAT’23, LIPIcs, Vol. 271. Schloss Dagstuhl—Leibniz-Zentrum für Informatik, 13:1–13:17. DOI:
    [33]
    Markus Kirchweger, Manfred Scheucher, and Stefan Szeider. 2022. A SAT Attack on Rota's Basis Conjecture. In Proceedings of the Theory and Applications of Satisfiability Testing—SAT 2022—25th International Conference, Proceedings. 1–18. DOI:
    [34]
    Markus Kirchweger, Manfred Scheucher, and Stefan Szeider. 2023c. SAT-Based Generation of Planar Graphs. In Proceedings of the 26th International Conference on Theory and Applications of Satisfiability Testing, SAT’23, LIPIcs, Vol. 271. Schloss Dagstuhl—Leibniz-Zentrum für Informatik, 14:1–14:18. DOI:
    [35]
    Markus Kirchweger and Stefan Szeider. 2021a. SAT Modulo Symmetries for Graph Generation. DOI:
    [36]
    Markus Kirchweger and Stefan Szeider. 2021b. SAT Modulo Symmetries for Graph Generation. In Proceedings of the 27th International Conference on Principles and Practice of Constraint Programming (CP’21), LIPIcs. Dagstuhl, 39:1–39:17. DOI:
    [37]
    Markus Kirchweger and Stefan Szeider. 2024. Computing Small Rainbow Cycle Numbers with SAT Modulo Symmetries. To appear.
    [38]
    Zhengyu Li, Curtis Bright, and Vijay Ganesh. 2023. A SAT Solver and Computer Algebra Attack on the Minimum Kochen-Specker Problem. CoRR. DOI:
    [39]
    Po-Shen Loh and Jie Ma. 2016. Diameter Critical Graphs. J. Combin. Theory Ser. B 117, 34–58. DOI:
    [40]
    W. Mantel. 1907. Problem 28. Wiskundige Opgaven 10, 60–61.
    [41]
    João Marques-Silva and Sharad Malik. 2018. Propositional SAT Solving. In Handbook of Model Checking. Edmund M. Clarke, Thomas A. Henzinger, Helmut Veith and Roderick Bloem (Eds.), Springer, 247–275. DOI:
    [42]
    Brendan D. McKay and Adolfo Piperno. 2014. Practical Graph Isomorphism, II. J. Symbolic Comput. 60, 94–112. DOI:
    [43]
    Brendan D. McKay and Stanisław P. Radziszowski. 1995. R(4,5)=25. J. Graph Theory 19, 3 (May 1995), 309–322. DOI:
    [44]
    Hakan Metin, Souheib Baarir, Maximilien Colange, and Fabrice Kordon. 2018. CDCLSym: Introducing Effective Symmetry Breaking in SAT Solving. In Proceedings of the Tools and Algorithms for the Construction and Analysis of Systems - 24th International Conference, TACAS’18, Lecture Notes in Computer Science, Vol. 10805. Springer, 99–114. DOI:
    [45]
    Amit Metodi and Michael Codish. 2012. Compiling Finite Domain Constraints to SAT with BEE. Theory Pract. Log. Program. 12, 4–5 (2012), 465–483. DOI:
    [46]
    Jean-Francois Puget. 2003. Symmetry Breaking Using Stabilizers. In Proceedings of the Principles and Practice of Constraint Programming—CP’23, Lecture Notes in Computer Science, Vol. 2833. Francesca Rossi (Ed.). Springer Verlag, 585–599. DOI:
    [47]
    Jovan Radosavljević and Miodrag Živković. 2020. The List of Diameter-2-Critical Graphs with at Most 10 Nodes. IPSI Trans. Adv. Res. 16, 1 (Jan. 2020), 1–5. Retrieved from http://ipsitransactions.org/journals/papers/tar/2020jan/p9.pdf.
    [48]
    Stanislaw Radziszowski. 2021. Small Ramsey Numbers. Electron. J. Comb. 1, 1–29. DOI:
    [49]
    F. P. Ramsey. 1930. On a Problem of Formal Logic. Proc. Lond. Math. Soc. s2–30, 1 (1930), 264–286. DOI:
    [50]
    Bas Schaafsma, Marijn Heule, and Hans van Maaren. 2009. Dynamic Symmetry Breaking by Simulating Zykov Contraction. In Proceedings of the Theory and Applications of Satisfiability Testing—SAT’09, Lecture Notes in Computer Science, Vol. 5584. Springer Verlag, 223–236. DOI:
    [51]
    Jianmin Tang, Yuqing Lin, Camino Balbuena, and Mirka Miller. 2009. Calculating the Extremal Number \(ex(v;\{C_{3},C_{4},\dots,C_{n}\})\) . Discr. Appl. Math. 157, 9 (2009), 2198–2206. DOI:
    [52]
    P. Wang, G. W. Dueck, and S. MacMillan. 2001. Using Simulated Annealing to Construct Extremal Graphs. Discr. Math. 235, 1–3 (2001), 125–135. DOI: (Prague, 1998).
    [53]
    Douglas B. West. 2021. Combinatorial Mathematics. Cambridge University Press. 220 pages.
    [54]
    Tianwei Zhang, Tomáš Peitl, and Stefan Szeider. 2024. Small Unsatisfiable \(k\) -CNFs with Bounded Literal Occurrence. In Proceedings of the 27th International Conference on Theory and Applications of Satisfiability Testing (SAT’24), LIPIcs. Schloss Dagstuhl—Leibniz-Zentrum fuer Informatik.
    [55]
    Tianwei Zhang and Stefan Szeider. 2023. Searching for Smallest Universal Graphs and Tournaments with SAT. In Proceedings of the 29th International Conference on Principles and Practice of Constraint Programming, CP’23, LIPIcs, Vol. 280. Schloss Dagstuhl—Leibniz-Zentrum für Informatik, 39:1–39:20. DOI:

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Transactions on Computational Logic
    ACM Transactions on Computational Logic  Volume 25, Issue 3
    July 2024
    36 pages
    ISSN:1529-3785
    EISSN:1557-945X
    DOI:10.1145/3613691
    • Editor:
    • Anuj Dawar
    Issue’s Table of Contents
    This work is licensed under a Creative Commons Attribution International 4.0 License.

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 31 July 2024
    Online AM: 09 June 2024
    Accepted: 05 May 2024
    Revised: 14 February 2024
    Received: 08 November 2023
    Published in TOCL Volume 25, Issue 3

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Graph generation
    2. dynamic symmetry breaking
    3. SAT solving
    4. Ramsey numbers
    5. extremal graph theory
    6. Murty–Simon Conjecture

    Qualifiers

    • Research-article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • 0
      Total Citations
    • 134
      Total Downloads
    • Downloads (Last 12 months)134
    • Downloads (Last 6 weeks)89
    Reflects downloads up to 12 Aug 2024

    Other Metrics

    Citations

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Get Access

    Login options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media