\documentclass[11pt]{amsart} \usepackage[utf8]{inputenc} \usepackage{upquote} \usepackage{amssymb} \usepackage[margin=1in]{geometry} \usepackage{enumitem} \usepackage{tikz} \usepackage{booktabs} \usepackage{longtable} \usepackage{array} \usepackage[hidelinks]{hyperref} % Unicode characters used in the Lean excerpt of Section 8 \DeclareUnicodeCharacter{2115}{\ensuremath{\mathbb{N}}} \DeclareUnicodeCharacter{2203}{\ensuremath{\exists}} \DeclareUnicodeCharacter{2200}{\ensuremath{\forall}} \DeclareUnicodeCharacter{2194}{\ensuremath{\leftrightarrow}} \DeclareUnicodeCharacter{2192}{\ensuremath{\to}} \DeclareUnicodeCharacter{2209}{\ensuremath{\notin}} \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} \DeclareUnicodeCharacter{2264}{\ensuremath{\le}} \DeclareUnicodeCharacter{2243}{\ensuremath{\simeq}} \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{corollary}[theorem]{Corollary} \theoremstyle{definition} \newtheorem{definition}[theorem]{Definition} \newtheorem{example}[theorem]{Example} \newtheorem{question}[theorem]{Question} \theoremstyle{remark} \newtheorem{remark}[theorem]{Remark} \newcommand{\Lam}{\Lambda} \newcommand{\Tr}[1]{T(#1)} \newcommand{\D}{\mathcal{D}} \newcommand{\cl}{\operatorname{cl}} \newcommand{\intr}{\operatorname{int}} \newcommand{\doi}[1]{\href{https://doi.org/#1}{doi:\nolinkurl{#1}}} \newcommand{\arXiv}[1]{\href{https://arxiv.org/abs/#1}{arXiv:\nolinkurl{#1}}} \newcommand{\grepo}{\url{https://github.com/LucasAlves8Sp/THE-INVERSE-PROBLEM-FOR-THE-NUMBER-OF-CONNECTED-INDUCED-SUBGRAPHS}} \newcommand{\repo}{\url{https://github.com/LucasAlves8Sp/ALL-FINITE-CARDINALITIES-OF-THE-HYPERSPACE-OF-REGULAR-SUBCONTINUA}} \begin{document} \title[The number of connected induced subgraphs]{The inverse problem for the number of\\ connected induced subgraphs} \author{Lucas Alves de Almeida} \address{Independent researcher} \email{lucasderiva8x@gmail.com} \date{November 2026} \subjclass[2020]{Primary 05C30; Secondary 05C40, 54B20, 68V20} \keywords{Connected induced subgraph, connected set, inverse problem, graph invariant, subtrees, cone, formal verification, Lean} \begin{abstract} For a finite graph $G$, let $c(G)$ be the number of nonempty vertex sets that induce a connected subgraph. We show that a positive integer $k$ equals $c(G)$ for some finite connected graph $G$ if and only if $k\notin\{2,4,5,8,9,16\}$. Every attainable value $k\ne25$ is attained on $\lfloor\log_2k\rfloor+1$ vertices, the least possible number, and $25$ needs six vertices. More precisely, for every $m\ge6$ each integer from $2^{m-1}$ to $2^m-1$ is the value of $c$ on a connected graph with exactly $m$ vertices. The proofs of these results are short and use no computer; computer calculations serve only as independent checks, and for two auxiliary results: the values on six to eight vertices, and the result on all connected subgraphs described below. The value $16$ falls into a gap above the path: a connected graph on $n\ge4$ vertices other than the path $P_n$ has at least $n-3$ more connected sets than $P_n$. The values $k\ge17$ are realized by a recursive construction from cones, disjoint unions and a family of graphs that we call near-cones, starting from seven small graphs; it produces a graph with $c(G)=k$ in time polynomial in $\log k$. The question arose from a problem of Ordo\~nez in continuum theory, through a reduction by Camargo, Ordo\~nez and Ram\'irez, who found the values up to $255$ by a computer search. The proof is formalized in Lean~4. We also observe that a theorem of Czabarka, Sz\'ekely and Wagner on subtrees reduces the corresponding problem for the number of all connected subgraphs to a finite computation, and we report its outcome. We did not find these results in the literature, but we make no claim of novelty or priority. \end{abstract} \maketitle \section{Introduction}\label{sec:intro} Let $G$ be a finite simple graph. A \emph{connected set} of $G$ is a nonempty set of vertices that induces a connected subgraph, and $c(G)$ denotes the number of connected sets of $G$. Equivalently, $c(G)$ is the number of connected induced subgraphs of $G$, where subgraphs induced by different vertex sets are counted separately even when they are isomorphic. For instance, \[ c(P_n)=\frac{n(n+1)}2,\qquad c(K_n)=2^n-1,\qquad c(K_{1,d})=2^d+d,\qquad c(C_n)=n(n-1)+1 \] for the path, the complete graph, the star and the cycle; these and several other closed formulas are given by Vince \cite[Example~1]{Vi}. For a tree, $c(G)$ is the number of subtrees. Write $\Tr{n}=n(n+1)/2$. If $G$ is connected with $n$ vertices, then \begin{equation}\label{eq:range} \Tr{n}\le c(G)\le 2^n-1 \end{equation} (Lemma~\ref{lem:rules}(f)). The \emph{inverse problem} for $c$ asks which positive integers are of the form $c(G)$. The question is only interesting for connected graphs: $c$ is additive over components, so every positive integer $k$ is $c$ of the edgeless graph on $k$ vertices. \begin{theorem}\label{thm:main} A positive integer $k$ equals $c(G)$ for some finite connected graph $G$ if and only if \[ k\notin\{2,4,5,8,9,16\}. \] \end{theorem} The upper bound in \eqref{eq:range} shows that a connected graph with $c(G)=k$ has at least $\lfloor\log_2k\rfloor+1$ vertices. This bound is attained with a single exception. \begin{theorem}\label{thm:order} Let $k$ be a positive integer with $k\notin\{2,4,5,8,9,16\}$. The least number of vertices of a connected graph $G$ with $c(G)=k$ is $\lfloor\log_2k\rfloor+1$ if $k\ne25$, and $6$ if $k=25$. \end{theorem} Both theorems follow from a statement about graphs with a prescribed number of vertices. For $m\ge0$ let \begin{align*} V_m&=\{c(G): G\text{ a connected graph with exactly }m\text{ vertices}\},\\ \Lam_m&=\{c(G): G\text{ a graph with exactly }m\text{ vertices}\}. \end{align*} For integers $a\le b$ we write $[a,b]=\{a,a+1,\dots,b\}$. By \eqref{eq:range}, $V_m\subseteq[\Tr{m},2^m-1]$. \begin{theorem}\label{thm:dyadic-intro} \begin{enumerate}[label=\textup{(\alph*)}] \item For every $m\ge6$, $V_m\supseteq[2^{m-1},2^m-1]$: every integer $k$ with $2^{m-1}\le k\le 2^m-1$ is $c(G)$ for a connected graph $G$ with exactly $m$ vertices. \item For every $m\ge7$, $\Lam_m\supseteq[m,2^m-1]$. \end{enumerate} \end{theorem} Part (a) fails for $m=5$, since $25\notin V_5$ (Proposition~\ref{prop:V5}). A computer search shows that part (b) fails for $m=6$, since $26\notin\Lam_6$ (Section~\ref{sec:computation}). \emph{Where the exceptions come from.} By \eqref{eq:range}, the values of $c$ on connected graphs with $n=1,2,3,4,5,6$ vertices lie in the intervals \[ [1,1],\quad[3,3],\quad[6,7],\quad[10,15],\quad[15,31],\quad[21,63], \] and from $n=4$ on consecutive intervals overlap. The five integers $2,4,5,8,9$ lie in none of these intervals. The integer $16$ lies only in the interval for $n=5$, and there it equals $\Tr{5}+1$. It falls into a gap just above the path. A connected graph on $n\ge4$ vertices other than $P_n$ has at least $\Tr{n}+n-3$ connected sets (Proposition~\ref{prop:pathgap}), so $\Tr{n}+1,\dots,\Tr{n}+n-4$ are never attained on $n$ vertices. For $n\ge6$ these gaps are covered by graphs with fewer vertices, but for $n=5$ the gap is the single value $16$, and no other order covers it. Theorems~\ref{thm:main}--\ref{thm:dyadic-intro} say that nothing else is lost. \emph{The method.} The proofs of Theorems~\ref{thm:main}--\ref{thm:dyadic-intro} use no computer. Computer calculations appear in this paper only as independent checks of explicit counts (Section~\ref{sec:computation}), in the census of the values on six to eight vertices (Section~\ref{sec:fixed}), and in Proposition~\ref{prop:F} on all connected subgraphs, which is labelled as computer-assisted. The exclusions come from \eqref{eq:range} and Proposition~\ref{prop:pathgap}. For the realizations, the basic observation is that adding a universal vertex to a graph $K$ (taking the \emph{cone} over $K$) adds exactly $2^{|K|}$ connected sets. So the cones over the graphs with $m-1$ vertices realize $2^{m-1}+\Lam_{m-1}$ on $m$ vertices. Every graph on $m-1$ vertices has at least $m-1$ connected sets, so cones miss the $m-1$ values at the bottom of $[2^{m-1},2^m-1]$. To fill this gap we use \emph{near-cones} (Definition~\ref{def:nearcone}). A near-cone is the cone over the disjoint union of a star and a graph $R$, with one edge at the apex removed; removing that edge destroys exactly $2^{|R|}$ connected sets. Choosing the size of the star near $\log_2m$ makes the missing values reachable from $\Lam_{|R|}$ by induction (Theorem~\ref{thm:dyadic}). The induction starts at seven vertices and needs seven small graphs, which we call \emph{sporadic}. The construction is explicit and yields a graph with $c(G)=k$ on $\lfloor\log_2k\rfloor+1$ vertices in time polynomial in $\log k$ (Remark~\ref{rem:algorithm}). \subsection{How the problem arose}\label{subsec:origin} This work started from a question in continuum theory. A \emph{continuum} is a nonempty compact connected metric space. A subcontinuum $A$ of a continuum $X$ is \emph{regular} if $A=\cl_X\intr_XA$, and Ordo\~nez \cite{Or18} introduced the hyperspace $\D(X)$ of regular subcontinua of $X$. He asked for which $n$ there is a continuum $X$ with exactly $n$ regular subcontinua \cite[Problem~4.14]{Or18}. Camargo, Ordo\~nez and Ram\'irez \cite{CORa} showed that when $\D(X)$ is finite, it is determined by its minimal elements, which have pairwise disjoint interiors and cover $X$ \cite[Theorem~3.16]{CORa}. This reduces the computation of $|\D(X)|$ to a count in a graph: $|\D(X)|$ is the number of connected sets of the intersection graph of these minimal elements, a finite connected graph \cite{CORa}, \cite[Proposition~3.2]{AA2}. They proved that $|\D(X)|\notin\{2,4,5,8,9\}$ \cite[Proposition~3.18]{CORa}. A computer search over all graphs with at most eight vertices showed that $16$ does not occur as a value of $c$, while every integer from $17$ to $255$ does \cite[Remark~3.20]{CORa}. They asked whether every $k\ge256$ is the cardinality of some $\D(X)$ \cite[Question~3.21]{CORa}. The author was working on this question. In a companion paper \cite{AA2} we answer it: the finite cardinalities of $\D(X)$ are exactly the positive integers outside $\{2,4,5,8,9,16\}$. That paper realizes every finite connected graph by copies of the Knaster continuum glued at points. Hence the topological question is equivalent to the graph-theoretic one, which is Theorem~\ref{thm:main}. The graph-theoretic result does not depend on continuum theory and may be of independent interest. So we present it here on its own, with complete proofs and a more detailed explanation of the construction. Compared with \cite{AA2}, this paper also contains a new and more conceptual treatment of five vertices (Propositions~\ref{prop:pathgap} and~\ref{prop:V5}) and some related observations (Sections~\ref{sec:fixed} and~\ref{sec:related}). \subsection{Related work and the status of the result}\label{subsec:literature} The invariant $c(G)$ has been studied mainly from the extremal point of view. For trees, $c$ is the number of subtrees, studied by Sz\'ekely and Wang \cite{SW}, among others. For general graphs, Dossou-Olory \cite{DO1,DO2,DO3}, Andriantiana and Dossou-Olory \cite{ADO} (Nordhaus--Gaddum inequalities), and Haslegrave \cite{Ha} studied the extremal values of $c$ and of related counts of connected sets. Vince \cite{Vi} studied the growth of $c$, and of the number of partitions of the vertex set into connected sets, along infinite families of graphs; he computed $c$ for several families and bounded it in terms of the number of edges. The invariant is a specialization of the subgraph component polynomial of Tittmann, Averbouch and Makowsky \cite{TAM}, which counts vertex sets by their size and by the number of components of the induced subgraph; $c(G)$ counts the vertex sets inducing exactly one component. Pandey and Patra \cite{PP} studied extremal problems for the number $F(G)$ of all connected subgraphs, not necessarily induced. Inverse problems ask which values a graph invariant takes. Linek \cite{Li} showed that every positive integer is the number of independent sets of a bipartite graph. Wang and Yu \cite{WY} showed that all but $49$ positive integers are Wiener indices of trees. Czabarka, Sz\'ekely and Wagner \cite{CSW} solved the inverse problem for several tree parameters; in particular, every positive integer except $34$ explicit values, the largest being $89$, is the number of subtrees of some tree. More recently, Alizadeh et al.\ \cite{Mostar} showed that every nonnegative integer except $1$ is the Mostar index of a graph, and Bernert and Shaw \cite{BS} showed that, for each fixed $k\ge2$, all sufficiently large integers are Steiner--Wiener $k$-indices of graphs. \emph{Status.} We searched the literature for a classification of the values of $c$ on general connected graphs. The search used web and arXiv searches on connected sets, connected induced subgraphs, the subgraph component polynomial and inverse problems for graph invariants, and the references of the works above. We did not find Theorems~\ref{thm:main}--\ref{thm:dyadic-intro}. The only previous determination of these values that we know is the computational one of \cite[Remark~3.20]{CORa} for graphs with at most eight vertices. We also note that Theorem~\ref{thm:main} can be deduced from the theorem of \cite{CSW} on subtrees by a finite computation (Remark~\ref{rem:CSWroute}); that route uses a computer and gives neither Theorem~\ref{thm:order} nor Theorem~\ref{thm:dyadic-intro}. The question is natural and the proof is elementary, so the result may be known, or folklore, in a form that we did not find. We therefore make no claim of novelty or priority, and we would be grateful for references. \subsection{Formalization, computations and organization} Theorems~\ref{thm:main}--\ref{thm:dyadic-intro}, the other results of Sections~\ref{sec:rules}--\ref{sec:proofs} and~\ref{sec:fixed}, and Lemma~\ref{lem:F} are formalized in Lean~4 with Mathlib (Section~\ref{sec:lean}). All explicit finite counts in this paper were also checked by computer (Section~\ref{sec:computation}). The \LaTeX{} source, the Lean formalization, the programs and their outputs are in the repository \cite{GRep}. Section~\ref{sec:rules} collects the counting rules. Section~\ref{sec:small} treats graphs with at most five vertices and proves the gap above the path. Section~\ref{sec:large} contains the construction, and Section~\ref{sec:proofs} the proofs of the main theorems. Section~\ref{sec:fixed} discusses the values on a fixed number of vertices. Section~\ref{sec:related} discusses subtrees, all connected subgraphs, and the topological interpretation. \section{Counting rules}\label{sec:rules} Graphs are finite and simple; they need not be connected, and the graph with no vertices is allowed, with $c=0$. For a graph $G$ we write $|G|$ for its number of vertices, and $G[F]$ for the subgraph induced by $F\subseteq V(G)$. We write $c_v(G)$ for the number of connected sets containing a vertex $v$. For sets $A,B$ of integers and an integer $t$ we write $t+A=\{t+a:a\in A\}$ and $A+B=\{a+b:a\in A,\ b\in B\}$. A vertex is \emph{universal} if it is adjacent to every other vertex. The \emph{cone} over a graph $H$ is obtained by adding one new vertex adjacent to every vertex of $H$. A \emph{pendant vertex} is a vertex of degree one. A \emph{spider} consists of a vertex, its \emph{centre}, and paths, its \emph{legs}, each joined to the centre by an edge at one of its ends and otherwise disjoint from each other. The \emph{length} of a leg is its number of vertices, not counting the centre. The \emph{paw} is a triangle with one pendant vertex, and the \emph{diamond} is $K_4$ minus an edge. \begin{lemma}\label{lem:rules} Let $G$, $H$ and $K$ be graphs. \begin{enumerate}[label=\textup{(\alph*)}] \item \textup{(Disjoint union.)} If $G$ is the disjoint union of $H$ and $K$, then $c(G)=c(H)+c(K)$. \item \textup{(Monotonicity.)} If $H$ is a spanning subgraph of $G$, then $c(H)\le c(G)$. If moreover some edge of $G$ is not an edge of $H$, then $c(H){\raggedright\arraybackslash}p{#1}} \begin{tabular}{c P{3.0cm} P{3.7cm} c P{1.7cm} P{3.4cm}} \toprule $m$ & cones (C) & near-cones (N), with $(d,r)$ & sporadic & $V_m\supseteq$ & $\Lam_m\supseteq$ by (U) and $V_m$\\ \midrule 2 & $2+\{1\}=\{3\}$ & --- & --- & $\{3\}$ & $1+\{1\}$; so $\{2,3\}$\\ 3 & $4+\{2,3\}=\{6,7\}$ & --- & --- & $\{6,7\}$ & $1+\{2,3\}$; so $\{3,4,6,7\}$\\ 4 & $8+\{3,4,6,7\}=\{11,12,14,15\}$ & $(1,1)$: $10$; $(2,0)$: $13$ & --- & $[10,15]$ & $1+\{3,4,6,7\}$, $3+3$; so $[4,8]\cup[10,15]$\\ 5 & $16+\Lam_4$: $[20,24]\cup[26,31]$ & $(1,2)$: $15+\{2,3\}=\{17,18\}$ & $19$ & $[17,24]\cup[26,31]$ & $[5,9]\cup[11,16]$, $7+3$; so $[5,24]\cup[26,31]$\\ 6 & $32+\Lam_5$: $[37,56]\cup[58,63]$ & $(1,3)$: $27+\{3,4,6,7\}=\{30,31,33,34\}$; $(2,2)$: $34+\{2,3\}=\{36,37\}$ & $32,35,57$ & $[32,63]$ & $[6,25]\cup[27,32]$; so $[6,25]\cup[27,63]$\\ 7 & $64+\Lam_6$: $[70,89]\cup[91,127]$ & $(1,4)$: $51+[13,15]=[64,66]$; $(2,3)$: $62+\{6,7\}=\{68,69\}$ & $67,90$ & $[64,127]$ & $[7,26]\cup[28,64]$, $24+3$; so $[7,127]$\\ \bottomrule \end{tabular} \caption{The steps of the proof of Lemma~\ref{lem:base}. In the cone and near-cone columns, $\Lam_r$ stands for the part of $\Lam_r$ established in the previous rows. The last column lists $1+\Lam_{m-1}$ and the sums $x+y$ with $x\in V_a$, $y\in\Lam_{m-a}$ that are needed, for instance $3+3\in V_2+\Lam_2$ and $24+3\in V_5+\Lam_2$.} \label{tab:base} \end{table} \begin{remark}\label{rem:sharpbase} Two statements must be distinguished here: a value may fail to be produced by the rules (C) and (N), and a value may fail to be realized by any graph. Lemma~\ref{lem:base} is sharp in the second sense. Indeed $25\notin\Lam_5$, because $25\notin V_5$ (Proposition~\ref{prop:V5}) and a disconnected graph with five vertices has $c\le15+1$. Also $26\notin\Lam_6$, by the computation of Section~\ref{sec:computation}. In the first sense, even with every sporadic graph of smaller order available, the rules (C) and (N) produce on five vertices every value in $[17,31]$ except $19$ and $25$, on six vertices every value in $[32,63]$ except $32$, $35$ and $57$, and on seven vertices every value in $[64,127]$ except $67$ and $90$ (Section~\ref{sec:computation}). All these values except $25$ do lie in $V_m$, and the six sporadic graphs above the line in Table~\ref{tab:sporadic} realize them. \end{remark} \subsection{The induction} \begin{theorem}\label{thm:dyadic} For every $m\ge8$: \begin{enumerate} \item[$(\mathrm G_m)$] $V_m\supseteq[2^{m-1},2^m-1]$; \item[$(\mathrm H_m)$] $\Lam_m\supseteq[m,2^m-1]$. \end{enumerate} \end{theorem} The two assertions play different roles. The assertion $(\mathrm H_m)$ provides auxiliary graphs, possibly disconnected, with every count from $m$ to $2^m-1$. The assertion $(\mathrm G_m)$ provides connected graphs for the upper half of the range. We prove $(\mathrm G_m)$ from earlier $(\mathrm H)$-statements, and then obtain $(\mathrm H_m)$ by combining $(\mathrm G_m)$ with the isolated-vertex rule (U). In the proof of $(\mathrm G_m)$ the interval splits as \[ [2^{m-1},2^m-1]=\underbrace{[2^{m-1},\,2^{m-1}+m-2]}_{\text{near-cones}}\ \cup\ \underbrace{[2^{m-1}+m-1,\,2^m-1]}_{\text{cones}}. \] \begin{proof} We use induction on $m\ge8$. The induction hypothesis is $(\mathrm H_{m'})$ for every $m'$ with $7\le m'F(G)$. \end{enumerate} \end{lemma} \begin{proof} (a) The connected subgraphs without edges are the $n$ single vertices. A connected subgraph with a nonempty edge set $E'$ has vertex set $V(E')$, the set of ends of edges of $E'$, and the graph $(V(E'),E')$ is connected if and only if $E'$ is a connected set of $L(G)$. (b) Each connected set $S$ gives the connected subgraph $G[S]$. If $G$ is a forest, then $G[V']$ is a forest, so a connected spanning subgraph of $G[V']$ must be $G[V']$ itself. If $G$ has a cycle, the cycle minus one of its edges is a connected subgraph that is not induced. (c) All connected subgraphs of $G$ remain, and the new edge with its two ends is a new one. \end{proof} \begin{proposition}\label{prop:F} A positive integer $k$ equals $F(G)$ for some finite connected graph $G$ if and only if \[ k\notin E_F=\{2,4,5,7,8,9,12,13,14,16,19,22,23,35,38,39,46\}. \] \end{proposition} \begin{proof}[Proof \textup{(computer-assisted)}] By Lemma~\ref{lem:F}(b) and \cite{CSW}, every positive integer outside $E_T$ is a value of $F$ on a tree, and $\max E_T=89$. It remains to decide which elements of $E_T$ are values of $F$. We separate the reduction, which is proved, from the finite search, which is a computation. \emph{Reduction.} Let $G$ be connected with $n$ vertices and $F(G)\le89$. By Lemma~\ref{lem:F}(b) and Lemma~\ref{lem:rules}(f), $\Tr{n}\le c(G)\le F(G)\le89$, so $n\le12$. Let $S$ be a spanning tree of $G$, and add the edges of $E(G)\setminus E(S)$ to $S$ one at a time. This gives connected graphs $S=G_0,G_1,\dots,G_s=G$, each obtained from the previous one by adding one edge. By Lemma~\ref{lem:F}(c), $F(G_0)89$, or if it is isomorphic to a graph found before. The isomorphism test compares Weisfeiler--Lehman hashes and then tests exact isomorphism. Levels $1,2,3,4$ contain $69$, $13$, $1$ and $0$ graphs, so the search stops. It finds $177$ pairwise non-isomorphic connected graphs with $F\le89$. By the reduction, every connected graph with $F\le89$ is isomorphic to one of them, and their values of $F$ are all integers in $[1,89]$ except the elements of $E_F$. The $17$ elements of $E_T\setminus E_F$ are realized by the graphs of Table~\ref{tab:F}. The values of $F$ were computed in two independent ways, by Lemma~\ref{lem:F}(a) and by testing all edge subsets; Section~\ref{sec:computation} describes the programs and the machine-readable list of the $177$ graphs. \end{proof} \begin{table}[ht] \centering \small \begin{tabular}{rrl@{\qquad}rrl} \toprule $F$ & $n$ & edges & $F$ & $n$ & edges\\ \midrule 18 & 4 & 01 02 03 13 \ (paw) & 54 & 5 & 01 02 03 13 24 34\\ 26 & 5 & 01 02 13 24 34 \ ($C_5$) & 60 & 7 & 01 02 12 14 23 45 56\\ 27 & 5 & 01 02 12 13 34 & 65 & 8 & 01 02 15 23 34 47 56 67\\ 29 & 5 & 01 02 04 13 34 & 68 & 7 & 01 02 05 14 23 45 46\\ 31 & 5 & 01 02 03 13 34 & 72 & 7 & 01 02 12 13 15 34 56\\ 33 & 4 & 01 02 03 12 13 \ (diamond) & 77 & 7 & 01 02 03 04 15 16 56\\ 42 & 6 & 01 02 05 14 23 45 & 89 & 8 & 01 02 13 15 23 24 56 67\\ 43 & 6 & 01 02 14 23 25 45 & & & \\ 50 & 7 & 01 02 14 23 36 45 56 & & & \\ 52 & 6 & 01 02 03 05 14 45 & & & \\ \bottomrule \end{tabular} \caption{Connected graphs realizing, as values of $F$, the $17$ subtree exceptions of \cite{CSW} that are values of $F$. Each graph has the least possible number of vertices and, among those, the least number of edges. Vertices are $0,\dots,n-1$, and $ij$ denotes the edge joining $i$ and $j$.} \label{tab:F} \end{table} For instance, $F(C_5)=5+c(C_5)=26$, the paw has $F=4+c(\text{diamond})=18$, and the diamond has $F=4+c(W_4)=4+29=33$, where $W_4$, the cone over $C_4$, is the line graph of the diamond. Unlike Theorem~\ref{thm:main}, Proposition~\ref{prop:F} depends on computer calculations, both through \cite{CSW} and through our search. A proof in the spirit of Section~\ref{sec:large} would be of interest. \subsection{The topological interpretation} As explained in Section~\ref{subsec:origin}, Theorem~\ref{thm:main} answers \cite[Question~3.21]{CORa}. Combined with the reduction of \cite{CORa} and a realization of every finite connected graph by copies of the Knaster continuum glued at points, it gives the following result of the companion paper. \begin{theorem}[{\cite[Theorem~A]{AA2}}]\label{thm:topology} A positive integer $k$ is the number of regular subcontinua of some metric continuum if and only if $k\notin\{2,4,5,8,9,16\}$. For every $k\ge32$ such a continuum can be chosen as the union of $\lfloor\log_2k\rfloor+1$ copies of the Knaster continuum, any two of which meet in at most one point, and no continuum with exactly $k$ regular subcontinua has fewer minimal regular subcontinua. \end{theorem} \section{Formal verification in Lean}\label{sec:lean} The results of Sections~\ref{sec:rules}--\ref{sec:proofs} and~\ref{sec:fixed} and Lemma~\ref{lem:F} are formalized in Lean~4 \cite{Lean} with Mathlib \cite{Mathlib}, in the library \texttt{ConnectedSets} in the directory \texttt{lean} of the repository \cite{GRep} of this paper. The file \texttt{MANIFEST.txt} there lists the SHA-256 checksums of all files of this version, including the Lean sources and the scripts of Section~\ref{sec:computation}. The toolchain is Lean \texttt{v4.35.0} with Mathlib commit \texttt{6015dbbfc399f4548bafd46f9560ff61595fd328}, both fixed in the files \texttt{lean-toolchain}, \texttt{lakefile.toml} and \texttt{lake-manifest.json}. In the directory \texttt{lean}, the commands \begin{center} \texttt{lake exe cache get}\qquad\texttt{lake build}\qquad\texttt{lake env lean CheckAxioms.lean} \end{center} download a compiled Mathlib (this step is optional), build the library, and print the axioms of every statement of Table~\ref{tab:lean}. The library has $20$ modules and $4623$ lines. Eleven of them (\texttt{Basic}, \texttt{Defs}, \texttt{Rules}, \texttt{Transport}, \texttt{Checker}, \texttt{Five}, \texttt{Sporadic}, \texttt{Base}, \texttt{Intervals}, \texttt{Induction} and \texttt{Main}; $2201$ lines) are the graph-theoretic part of the formalization written for the companion paper \cite{AA2}, which is in the directory \texttt{lean} of \cite{Rep}. They are copied with the namespace renamed and the comments renumbered, and the scripts in \texttt{lean/gen} regenerate the modules \texttt{Sporadic}, \texttt{Base} and \texttt{Intervals} byte for byte. The other modules are new: \texttt{Gap} and \texttt{Path} (Proposition~\ref{prop:pathgap}), \texttt{Spider}, \texttt{Small} (Lemmas~\ref{lem:rules}(b) and~\ref{lem:upto4}, Corollaries~\ref{cor:gap} and~\ref{cor:upto16}, Propositions~\ref{prop:V5} and~\ref{prop:fixed}, and Theorem~\ref{thm:order} for every $k$), \texttt{Glue} (Lemma~\ref{lem:rules}(c)), \texttt{LineGraph} (Lemma~\ref{lem:F}), \texttt{Extras}, and \texttt{Paper}, which states the results with the numbering of this paper. For a graph \texttt{G} on a finite type \texttt{V}, the number \texttt{c G} is the number of finite sets \texttt{S} of vertices such that the induced graph \texttt{G.induce S} is connected; Mathlib's notion of a connected graph includes nonemptiness. The statement \texttt{InV m k} says that some connected graph on \texttt{Fin m} has \texttt{c = k}, that is, $k\in V_m$, and \texttt{InLam m k} says $k\in\Lam_m$. Paths, forests and line graphs are Mathlib's \texttt{pathGraph}, \texttt{IsAcyclic} and \texttt{lineGraph}. The number \texttt{F G} counts the pairs $(S,E)$ of a finite set of vertices and a finite set of edges of \texttt{G} with both ends in $S$ such that the graph with vertex set $S$ and edge set $E$ is connected. Two of the statements of the module \texttt{Paper} read as follows; there \texttt{T n} is $\Tr{n}$. \begin{verbatim} theorem theorem_1_1 (k : ℕ) (hk : 0 < k) : (∃ n, ∃ G : SimpleGraph (Fin n), G.Connected ∧ c G = k) ↔ k ∉ ({2, 4, 5, 8, 9, 16} : Finset ℕ) theorem proposition_3_2 (G : SimpleGraph V) (hG : G.Connected) : (IsEmpty (pathGraph (Fintype.card V) ≃g G) → T (Fintype.card V) + (Fintype.card V - 3) ≤ c G) ∧ (c G = T (Fintype.card V) ↔ Nonempty (pathGraph (Fintype.card V) ≃g G)) \end{verbatim} Table~\ref{tab:lean} lists the correspondence between this paper and the module \texttt{Paper}; all its declarations are in the namespace \texttt{ConnectedSets.Paper}. \begin{table}[ht] \centering \small \begin{tabular}{l>{\raggedright\arraybackslash}p{8.4cm}} \toprule this paper & declarations in \texttt{ConnectedSets/Paper.lean}\\ \midrule Theorems~\ref{thm:main}, \ref{thm:order}, \ref{thm:dyadic-intro} & \texttt{theorem\_1\_1}, \texttt{theorem\_1\_1\_type}, \texttt{theorem\_1\_2}, \texttt{theorem\_1\_3}, \texttt{theorem\_1\_3\_sharp}\\ formulas of Section~\ref{sec:intro} & \texttt{section\_1\_formulas} (path, complete graph, star)\\ Lemma~\ref{lem:rules}(a)--(f) & \texttt{lemma\_2\_1\_a}, \dots, \texttt{lemma\_2\_1\_f}\\ Lemma~\ref{lem:upto4} & \texttt{lemma\_3\_1\_a}, \texttt{lemma\_3\_1\_b}\\ Proposition~\ref{prop:pathgap} & \texttt{proposition\_3\_2}, \texttt{proposition\_3\_2\_spider}\\ Corollaries~\ref{cor:gap}, \ref{cor:upto16}; Proposition~\ref{prop:V5} & \texttt{corollary\_3\_3}, \texttt{corollary\_3\_5}, \texttt{proposition\_3\_4}\\ Lemmas~\ref{lem:threerules}, \ref{lem:sporadic}, \ref{lem:base} & \texttt{lemma\_4\_2}, \texttt{lemma\_4\_3}, \texttt{lemma\_4\_4\_a}, \texttt{lemma\_4\_4\_b}\\ Remark~\ref{rem:sharpbase} ($25\notin\Lam_5$) & \texttt{remark\_4\_5}\\ Theorem~\ref{thm:dyadic}, Example~\ref{ex:128} & \texttt{theorem\_4\_6}, \texttt{example\_4\_7}\\ Proposition~\ref{prop:fixed} & \texttt{proposition\_6\_1}\\ Lemma~\ref{lem:F}(a)--(c) & \texttt{lemma\_7\_2\_a}, \texttt{lemma\_7\_2\_b}, \texttt{lemma\_7\_2\_c}\\ \bottomrule \end{tabular} \caption{Correspondence between the results of this paper and the Lean formalization.} \label{tab:lean} \end{table} The formal proofs follow the paper, with four differences. \begin{enumerate}[label=\textup{(\arabic*)}] \item Proposition~\ref{prop:pathgap} is proved by a different argument, an induction on connected sets that avoids spanning trees. Call a vertex $y$ of a connected set $S$ an \emph{end} of $S$ if $S$ has exactly one connected subset containing $y$ of each size. An end forces $S$ to have exactly $\Tr{|S|}$ connected subsets, and it gives an enumeration of $S$ in which two vertices are adjacent exactly when they are consecutive. Conversely, if $S$ has exactly $\Tr{|S|}$ connected subsets, then every vertex whose removal leaves $S$ connected is an end. In the induction, remove such a vertex $w$. If $S\setminus\{w\}$ has the minimum number of connected subsets, it is a path, and the intervals of this path that form a connected set together with $w$ give at least $2|S|-3$ connected sets containing $w$, unless $S$ itself has the minimum. Otherwise the induction hypothesis applies to $S\setminus\{w\}$. This gives $c(G)=\Tr{n}$ or $c(G)\ge\Tr{n}+n-3$ for every connected graph $G$ with $n$ vertices, and $c(G)=\Tr{n}$ exactly when $G$ is isomorphic to \texttt{pathGraph n}. \item In Proposition~\ref{prop:V5} the values $16$ and $25$ are excluded by a kernel computation (\texttt{decide +kernel}) over all $2^{10}$ labeled graphs on five vertices, not by the case analysis of the paper; for $16$ the formalized Corollary~\ref{cor:gap} gives a second proof. The computation uses a bitmask counting procedure proved equal to \texttt{c}. The same procedure checks the counts of the sporadic graphs, the $353$ derivations of Lemma~\ref{lem:base}, the exclusions $5\notin\Lam_3$ and $9\notin\Lam_4$ of Lemma~\ref{lem:upto4} (over all labeled graphs on three and four vertices), and $25\notin\Lam_5$ in Remark~\ref{rem:sharpbase}. \item Lemma~\ref{lem:rules}(c) is formalized inside one graph: the vertex set is covered by sets $A$ and $B$ with $A\cap B=\{v\}$ and no edge between $A\setminus\{v\}$ and $B\setminus\{v\}$, and $G[A]$ and $G[B]$ play the roles of $G_1$ and $G_2$. \item Lemma~\ref{lem:rules}(e) and the near-cone formula of Lemma~\ref{lem:threerules} are stated without subtraction, for instance as $c(G)+2^{|K|-1-d}=c(K)+2^{|K|}$, where $d$ is the size of a finite set listing the neighbours of $u$. \end{enumerate} Not formalized are the general formulas of Example~\ref{ex:formulas}, whose instances used in the proofs are checked by the kernel; the computer census behind Table~\ref{tab:Vn} for $n=6,7,8$, and with it $26\notin\Lam_6$; the statements of Remark~\ref{rem:sharpbase} about which values the rules produce; the running time in Remark~\ref{rem:algorithm}; Remark~\ref{rem:CSWroute} and Proposition~\ref{prop:F}, which rely on the computer-assisted theorem of \cite{CSW} and on our search; and Appendix~\ref{app:witnesses}. Theorem~\ref{thm:topology} is formalized in the companion formalization \cite{AA2}. The library uses neither \texttt{sorry} nor \texttt{native\_decide} and declares no axioms. Its $31$ statements in the module \texttt{Paper} depend only on the axioms \texttt{propext}, \texttt{Classical.choice} and \texttt{Quot.sound}, and one of them, \texttt{theorem\_1\_2\_minOrder}, depends on none. We checked the library in four ways, recorded in the file \texttt{CHECKS.txt} of the formalization. It builds from an empty build directory, and a copy of the sources in a fresh directory builds with the same output. The declarations of all modules were replayed through the kernel with \texttt{leanchecker}, and the whole import closure, including Lean core and Mathlib, with \texttt{leanchecker --fresh}. Finally, the statements of \texttt{Paper} were exported together with everything they depend on, $10538$ declarations in all, and checked by the independent type checker \texttt{nanoda}, with only the three axioms above permitted; no errors were reported. \section{Computational verification}\label{sec:computation} The proofs of Theorems~\ref{thm:main}--\ref{thm:dyadic-intro} do not use a computer. We checked every explicit finite count in this paper, and the computer-assisted result of \cite{CORa}, with programs written for this purpose. The programs for the census of small graphs, the construction and the subtrees, with their outputs, are in the repository \cite{Rep} of the companion paper; the file \texttt{CHECKS.md} there maps each computational statement of \cite{AA2} to the program that checks it. The scripts for Proposition~\ref{prop:F} and Appendix~\ref{app:witnesses}, the construction program \texttt{construct.py} with its certificate for Lemma~\ref{lem:base}, and the outputs are in the directories \texttt{code} and \texttt{data} of the repository \cite{GRep} of this paper. \emph{Counting.} We compute $c(G)$ in three ways: by testing all $2^n-1$ nonempty vertex sets; by the ESU enumeration scheme \cite{We}, which lists each connected set once; and by a recurrence over vertex sets. In the recurrence, $g(S)=1$ if $G[S]$ is connected and $g(S)=0$ otherwise. The component of $G[S]$ containing $\min S$ is the only connected set $T\subseteq S$ with $\min S\in T$ and no edge between $T$ and $S\setminus T$. Hence $g(S)=1-\sum g(T)$, the sum running over sets $T\ne S$ with $\min S\in T\subseteq S$ and no edge between $T$ and $S\setminus T$. \emph{Graphs on at most eight vertices.} Program A takes the graphs on at most seven vertices from the atlas of Read and Wilson \cite{RW}, as distributed with NetworkX \cite{NX}. It extends each of the $1044$ graphs on seven vertices, connected or not, by every nonempty neighbourhood of a new vertex, and removes isomorphic copies in two independent ways. Both give the $11117$ connected graphs on eight vertices of OEIS A001349 \cite{OEIS}. Program B, written in C, uses no atlas and no isomorphism test. It runs over all labeled graphs on at most seven vertices, and over the graphs on eight vertices obtained by extending the labeled graphs on seven vertices with nonincreasing degree sequence. Its numbers of labeled connected graphs agree with OEIS A001187. The two programs give the same sets $V_n$ for $n\le8$, as in Table~\ref{tab:Vn}. Every value in $[1,255]$ except $2,4,5,8,9,16$ occurs, and every value in $[17,127]$ occurs on at most seven vertices. This confirms \cite[Remark~3.20]{CORa}. Program B also rederives each witness of Appendix~\ref{app:witnesses} by brute force over all labeled graphs. \emph{The construction.} We implemented Lemma~\ref{lem:base} and the procedure of Remark~\ref{rem:algorithm} literally, and checked the gaps stated in Remark~\ref{rem:sharpbase}. An independently written program re-checked each of the $353$ derivations for $m\le7$. For every $k\in[17,70000]$, and for $300$ random $k<2^{22}$, we built the resulting graph and counted its connected sets. For every $8\le m\le16$ and every $v\in[m,2^m-1]$, the graph $\mathrm{Re}(m,v)$ has exactly $m$ vertices, is connected when $v\ge2^{m-1}$, and has $c=v$; in total $130708$ graphs were checked. \emph{Subtrees.} We re-verified the list $E_T$ of \cite{CSW} from all trees with at most $18$ vertices, generated and counted in two independent ways. A tree with $n\ge19$ vertices has at least $\Tr{19}=190$ subtrees, so this determines the subtree counts below $190$. \emph{All connected subgraphs.} The script \texttt{code/f\_values.py} of \cite{GRep} carries out the search in the proof of Proposition~\ref{prop:F}; the command \texttt{python3 f\_values.py 89} runs it, with Python~3.13 and NetworkX~3.7, in about two seconds. During the search it computes $F$ through Lemma~\ref{lem:F}(a), counting the connected sets of the line graph with the ESU scheme and stopping as soon as the count exceeds $89$. For every graph found it then recomputes $F$ by testing all nonempty edge subsets with a union-find structure; the two methods agree on all $177$ graphs. The script prints the number of trees of each order at level $0$, the size of each level, and the missing values, as stated in the proof (output file \texttt{f\_values\_output.txt}). It also writes the file \texttt{f\_graphs\_le\_89.csv}, which lists the $177$ graphs with $F$, $c$, the numbers of vertices and edges, and the edge list. Together with the reduction in the proof, this list certifies both that the values in $[1,89]\setminus E_F$ occur and that the elements of $E_F$ do not. A separate program in C, \texttt{f\_edge\_subsets.c}, recomputed $c$ by vertex subsets and $F$ by edge subsets for all $996$ connected graphs with at most seven vertices of the atlas, independently of the search. It agrees with the values below $36$, where those graphs suffice, since $F\ge\Tr{n}\ge36$ for $n\ge8$. \section*{AI disclosure} Artificial intelligence was used extensively in this work, both to obtain the results and to check them. \emph{Solving and proving.} The main model used to solve the problem and to prove the theorems was Claude Opus 5.5 (Anthropic). In an iterative process directed by the author, it carried out most of the exploratory proof development, including the near-cones of Section~\ref{sec:large} and the arguments of Section~\ref{sec:small}. It also wrote and ran the programs of Section~\ref{sec:computation}, carried out the literature search of Section~\ref{subsec:literature}, and generated most of the first draft of this manuscript and of the Lean~4 formalization of Section~\ref{sec:lean}. \emph{Reading and checking.} ChatGPT-Astra (OpenAI) was used, together with the author, to read the manuscript and check the arguments. AI was used extensively for proofreading and proof checking, and for repeated rounds of checking the arguments and comparing the proofs with one another, for instance the two proofs of Proposition~\ref{prop:pathgap} and the two exclusions of $16$ on five vertices. In each round the author, with ChatGPT-Astra, reviewed the text, the proofs and the supplementary material and sent feedback, and Claude revised them. \emph{The author's role.} The author formulated the problem, which arose from Questions~3.5 and~3.21 of \cite{CORa}, provided the mathematical context and constraints, and steered the iterations through prompts and feedback. The author also supplied ideas and suggested strategies, selected and revised the outputs, and reviewed the final arguments. The explicit finite counts are checked by programs (Section~\ref{sec:computation}), and the results listed in Table~\ref{tab:lean} are formally verified in Lean (Section~\ref{sec:lean}). No independent expert has yet verified the proofs. The author takes full responsibility for the content. \begin{thebibliography}{99} \bibitem{Mostar} Y.~Alizadeh, N.~Ba\v{s}i\'c, I.~Damnjanovi\'c, T.~Do\v{s}li\'c, T.~Pisanski, D.~Stevanovi\'c, and K.~Xu, \emph{Solving the Mostar index inverse problem}, preprint, \arXiv{2312.13083}. \bibitem{AA2} L.~Alves de Almeida, \emph{All finite cardinalities of the hyperspace of regular subcontinua}, preprint, version~2.3, 2026, available in \cite{Rep}. \bibitem{GRep} L.~Alves de Almeida, \emph{The inverse problem for the number of connected induced subgraphs: paper, Lean formalization and programs}, GitHub repository, \grepo. \bibitem{Rep} L.~Alves de Almeida, \emph{All finite cardinalities of the hyperspace of regular subcontinua: paper, programs and Lean formalization}, GitHub repository, \repo. \bibitem{ADO} E.~O.~D.~Andriantiana and A.~A.~V.~Dossou-Olory, \emph{Nordhaus--Gaddum inequalities for the number of connected induced subgraphs in graphs}, preprint, \arXiv{2006.01187}. \bibitem{BS} C.~Bernert and J.~Shaw, \emph{The inverse problem for the Steiner--Wiener index via additive number theory}, preprint, 2026, \arXiv{2603.17559}. \bibitem{CORa} J.~Camargo, N.~Ordo\~nez, and D.~Ram\'irez, \emph{On the hyperspaces of meager and regular continua}, Appl. Gen. Topol. \textbf{25} (2024), no.~2, 385--406. \doi{10.4995/agt.2024.20116}. \bibitem{CSW} \'E.~Czabarka, L.~A.~Sz\'ekely, and S.~Wagner, \emph{The inverse problem for certain tree parameters}, Discrete Appl. Math. \textbf{157} (2009), no.~15, 3314--3319. \doi{10.1016/j.dam.2009.07.004}. \bibitem{Lean} L.~de~Moura and S.~Ullrich, \emph{The Lean~4 theorem prover and programming language}, in: Automated Deduction -- CADE~28, Lecture Notes in Comput. Sci. \textbf{12699}, Springer, Cham, 2021, 625--635. \doi{10.1007/978-3-030-79876-5_37}. \bibitem{DO1} A.~A.~V.~Dossou-Olory, \emph{Graphs and unicyclic graphs with extremal number of connected induced subgraphs}, preprint, \arXiv{1812.02422}. \bibitem{DO2} A.~A.~V.~Dossou-Olory, \emph{Cut and pendant vertices and the number of connected induced subgraphs of a graph}, preprint, \arXiv{1910.04552}. \bibitem{DO3} A.~A.~V.~Dossou-Olory, \emph{On the maximum number of connected induced subgraphs of a graph}, preprint, 2023, \arXiv{2303.01964}. \bibitem{NX} A.~A.~Hagberg, D.~A.~Schult, and P.~J.~Swart, \emph{Exploring network structure, dynamics, and function using NetworkX}, in: Proceedings of the 7th Python in Science Conference (SciPy 2008), 11--15. \bibitem{Ha} J.~Haslegrave, \emph{The number and average size of connected sets in graphs with degree constraints}, preprint, \arXiv{2105.13332}. \bibitem{Li} V.~Linek, \emph{Bipartite graphs can have any number of independent sets}, Discrete Math. \textbf{76} (1989), 131--136. \doi{10.1016/0012-365X(89)90306-3}. \bibitem{Mathlib} The mathlib Community, \emph{The Lean mathematical library}, in: Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs (CPP 2020), 367--381. \doi{10.1145/3372885.3373824}. \bibitem{OEIS} OEIS Foundation Inc., \emph{The On-Line Encyclopedia of Integer Sequences}, sequences A001187 and A001349, \url{https://oeis.org}. \bibitem{Or18} N.~Ordo\~nez, \emph{The hyperspace of regular subcontinua}, Topology Appl. \textbf{234} (2018), 415--427. \doi{10.1016/j.topol.2017.11.038}. \bibitem{PP} D.~Pandey and K.~L.~Patra, \emph{On the number of connected subgraphs of graphs}, Indian J. Pure Appl. Math. \textbf{52} (2021), no.~2, 571--583. \doi{10.1007/s13226-021-00061-4}. \bibitem{RW} R.~C.~Read and R.~J.~Wilson, \emph{An Atlas of Graphs}, Oxford University Press, Oxford, 1998. \bibitem{SW} L.~A.~Sz\'ekely and H.~Wang, \emph{On subtrees of trees}, Adv. in Appl. Math. \textbf{34} (2005), 138--155. \doi{10.1016/j.aam.2004.07.002}. \bibitem{TAM} P.~Tittmann, I.~Averbouch, and J.~A.~Makowsky, \emph{The enumeration of vertex induced subgraphs with respect to the number of components}, European J. Combin. \textbf{32} (2011), no.~7, 954--974. \doi{10.1016/j.ejc.2011.03.017}. \bibitem{Vi} A.~Vince, \emph{Counting connected sets and connected partitions of a graph}, Australas. J. Combin. \textbf{67} (2017), no.~2, 281--293. \bibitem{WY} H.~Wang and G.~Yu, \emph{All but 49 numbers are Wiener indices of trees}, Acta Appl. Math. \textbf{92} (2006), 15--20. \doi{10.1007/s10440-006-9037-2}. \bibitem{We} S.~Wernicke, \emph{Efficient detection of network motifs}, IEEE/ACM Trans. Comput. Biol. Bioinform. \textbf{3} (2006), no.~4, 347--359. \doi{10.1109/TCBB.2006.51}. \end{thebibliography} \appendix \section{Witnesses for the values from 17 to 127}\label{app:witnesses} A \emph{witness} for an integer $k$ is a connected graph $G$ with $c(G)=k$. We record witnesses as graph6 strings. A \emph{graph6 string} is a standard printable encoding of a finite labeled graph with vertex set $\{0,\dots,n-1\}$. For $n\le62$ its first character is the one with ASCII code $n+63$. The remaining characters encode the entries above the diagonal of the adjacency matrix, read column by column, that is, in the order $(0,1),(0,2),(1,2),(0,3),(1,3),(2,3),\dots$. These bits are padded with zeros to a multiple of six, and each group of six bits, read as a binary number $b$, is written as the character with ASCII code $b+63$. For example, \verb!D?{! encodes the star $K_{1,4}$ with centre $4$: the bits of \verb!?! and \verb!{! are $000000$ and $111100$, so the edges are $(0,4),(1,4),(2,4),(3,4)$. \emph{Canonical strings.} A graph6 string depends on the labeling. For a fixed $n$ all graph6 strings have the same length, and we compare them lexicographically by their ASCII characters. The \emph{canonical graph6 string} of a graph is the least graph6 string among all its labelings with vertex set $\{0,\dots,n-1\}$; two graphs are isomorphic if and only if their canonical strings coincide. \emph{Witness rule.} For each $k\in[17,127]$ the table gives a witness of least possible order $n$; among those, of least number of edges; and among those, the one with the least canonical graph6 string. The table lists $k$, $n$ and the canonical string. By Theorem~\ref{thm:order}, $n=\lfloor\log_2k\rfloor+1$ except for $k=25$. Program~B of Section~\ref{sec:computation} rederives every entry by brute force over all labeled graphs on at most seven vertices. Edge lists are in the file \texttt{data/witnesses\_small.csv} of \cite{GRep}. The script \texttt{code/check\_witnesses.py} of \cite{GRep} reads this table from the \LaTeX{} source of the paper, decodes each string with the rule above, and checks that it gives a connected graph with $n$ vertices and exactly $k$ connected sets; all $111$ rows pass. {\footnotesize \begin{longtable}{rcl@{\hspace{3em}}rcl@{\hspace{3em}}rcl} \toprule $k$ & $n$ & graph6 & $k$ & $n$ & graph6 & $k$ & $n$ & graph6 \\ \midrule \endfirsthead \toprule $k$ & $n$ & graph6 & $k$ & $n$ & graph6 & $k$ & $n$ & graph6 \\ \midrule \endhead \bottomrule \endfoot 17 & 5 & \verb!D@s! & 54 & 6 & \verb!EB~o! & 91 & 7 & \verb!F?Nv_! \\ 18 & 5 & \verb!DJc! & 55 & 6 & \verb!EFz_! & 92 & 7 & \verb!F?Fno! \\ 19 & 5 & \verb!DBk! & 56 & 6 & \verb!EFzg! & 93 & 7 & \verb!F@Q~o! \\ 20 & 5 & \verb!D?{! & 57 & 6 & \verb!EL~o! & 94 & 7 & \verb!F?Fnw! \\ 21 & 5 & \verb!D@{! & 58 & 6 & \verb!EFzw! & 95 & 7 & \verb!F?]~_! \\ 22 & 5 & \verb!DJk! & 59 & 6 & \verb!EF~w! & 96 & 7 & \verb!F@Vn_! \\ 23 & 5 & \verb!DB{! & 60 & 6 & \verb!E]~o! & 97 & 7 & \verb!F@N^W! \\ 24 & 5 & \verb!DLs! & 61 & 6 & \verb!E]~w! & 98 & 7 & \verb!F?Nvo! \\ 25 & 6 & \verb!E@QW! & 62 & 6 & \verb!E^~w! & 99 & 7 & \verb!F@vf_! \\ 26 & 5 & \verb!DFw! & 63 & 6 & \verb!E~~w! & 100 & 7 & \verb!F?B~o! \\ 27 & 5 & \verb!DF{! & 64 & 7 & \verb!F?DnO! & 101 & 7 & \verb!F?B~w! \\ 28 & 5 & \verb!DN{! & 65 & 7 & \verb!F??^o! & 102 & 7 & \verb!F?F~w! \\ 29 & 5 & \verb!D]{! & 66 & 7 & \verb!F?C^W! & 103 & 7 & \verb!F?N~o! \\ 30 & 5 & \verb!D^{! & 67 & 7 & \verb!F?KuW! & 104 & 7 & \verb!F?^vo! \\ 31 & 5 & \verb!D~{! & 68 & 7 & \verb!F?Cng! & 105 & 7 & \verb!F@^vo! \\ 32 & 6 & \verb!E?NW! & 69 & 7 & \verb!F?@|w! & 106 & 7 & \verb!F@vv_! \\ 33 & 6 & \verb!E@Ug! & 70 & 7 & \verb!F??Fw! & 107 & 7 & \verb!F?^~o! \\ 34 & 6 & \verb!EJ]G! & 71 & 7 & \verb!F??Nw! & 108 & 7 & \verb!FBnnO! \\ 35 & 6 & \verb!E@Uw! & 72 & 7 & \verb!F?Cfw! & 109 & 7 & \verb!F@vvo! \\ 36 & 6 & \verb!E?No! & 73 & 7 & \verb!F??^w! & 110 & 7 & \verb!FBzv_! \\ 37 & 6 & \verb!E?Bw! & 74 & 7 & \verb!F?C^w! & 111 & 7 & \verb!F@vvw! \\ 38 & 6 & \verb!E?Fw! & 75 & 7 & \verb!F@Q^G! & 112 & 7 & \verb!F?~v_! \\ 39 & 6 & \verb!E@Rw! & 76 & 7 & \verb!F?Cnw! & 113 & 7 & \verb!F?~vg! \\ 40 & 6 & \verb!E?Nw! & 77 & 7 & \verb!F??~w! & 114 & 7 & \verb!F@~vg! \\ 41 & 6 & \verb!E@Nw! & 78 & 7 & \verb!F?Dno! & 115 & 7 & \verb!F?~vw! \\ 42 & 6 & \verb!E?^o! & 79 & 7 & \verb!F@Um_! & 116 & 7 & \verb!F?~~w! \\ 43 & 6 & \verb!E@Vw! & 80 & 7 & \verb!F?LVw! & 117 & 7 & \verb!F@~~w! \\ 44 & 6 & \verb!E?^w! & 81 & 7 & \verb!F@Q^W! & 118 & 7 & \verb!FFzng! \\ 45 & 6 & \verb!E@vg! & 82 & 7 & \verb!F?Dnw! & 119 & 7 & \verb!FFzfw! \\ 46 & 6 & \verb!EBn_! & 83 & 7 & \verb!F?@~o! & 120 & 7 & \verb!FFznw! \\ 47 & 6 & \verb!E@vo! & 84 & 7 & \verb!F?D~o! & 121 & 7 & \verb!FFz~o! \\ 48 & 6 & \verb!EBz_! & 85 & 7 & \verb!F?@~w! & 122 & 7 & \verb!FFz~w! \\ 49 & 6 & \verb!E@vw! & 86 & 7 & \verb!F?Fng! & 123 & 7 & \verb!FF~~w! \\ 50 & 6 & \verb!EJfw! & 87 & 7 & \verb!F@Umg! & 124 & 7 & \verb!F]~vw! \\ 51 & 6 & \verb!E?~o! & 88 & 7 & \verb!F?NNg! & 125 & 7 & \verb!F]~~w! \\ 52 & 6 & \verb!E?~w! & 89 & 7 & \verb!F?N^_! & 126 & 7 & \verb!F^~~w! \\ 53 & 6 & \verb!E@~w! & 90 & 7 & \verb!F@]v_! & 127 & 7 & \verb!F~~~w! \\ \end{longtable} } \end{document}