Abstract
Given a graph G, the k-coloring graph \(\mathcal {C}_k(G)\) is constructed by selecting proper k-colorings of G as vertices, with an edge between two colorings if they differ in the color of exactly one vertex. The number of vertices in \(\mathcal {C}_k(G)\) is the famous chromatic polynomial of G. Asgarli, Krehbiel, Levinson and Russell showed that for any subgraph H, the number of induced copies of H in \(\mathcal {C}_k(G)\) is a polynomial function in k. Hogan, Scott, Tamitegama, and Tan found a shorter proof for polynomiality of these chromatic H-polynomials. In this paper, we provide a method of constructing these polynomials explicitly in terms of chromatic polynomials of shadow graphs. We illustrate the practicality of our formulas by computing an explicit formula for H-polynomial for trees when \(H=Q_d\) is an arbitrary hypercube, a task which does not seem approachable from previous methods. The coefficients of the resulting polynomials feature generalized degree sequences introduced by Crew. In the special case when H is the complete graph on 2 vertices, the corresponding polynomial is dubbed the chromatic pairs polynomial. We present a pair of graphs \(G_1\) and \(G_2\) sharing the same chromatic pairs polynomial but different chromatic polynomials, disproving a conjecture raised by Asgarli, Krehbiel, Levinson and Russell.
Similar content being viewed by others
1 Introduction
The chromatic polynomial \(\pi _G(k)\) of a simple graph G counts the number of ways to properly color G using k colors. This polynomial invariant was introduced by Birkhoff [5] in an attempt to prove the Four Color Theorem. This concept is foundational in graph theory and combinatorics. Instead of simply counting the number of colorings, we can also keep track of how two different colorings are related. One such framework, known as a reconfiguration of k-colorings, declares a precise adjacency between two colorings. More precisely, the coloring graph \(\mathcal {C}_k(G)\) represents all proper colorings of G, with edges between colorings that differ at exactly one vertex. Viewed through this lens, the chromatic polynomial of G is the number of vertices in \(C_k(G)\) as k varies.
Working with \(\mathcal {C}_k(G)\) allows us to generalize the chromatic polynomial by counting other subgraphs of \(\mathcal {C}_k(G)\). Asgarli et al. [3] introduce the notation \(\pi _G^{(H)}(k)\) to denote the function that counts occurrences of a graph H as an induced subgraph of \(\mathcal {C}_k(G)\). There are now two different proofs that \(\pi _G^{(H)}(k)\) is indeed a polynomial function of k: the first proof is in the original paper [3] and the second proof appeared in a subsequent work by Hogan et al. [7]. In this paper, we offer a new proof of the polynomiality which has the advantage of being constructive in nature. We present a method using shadow graphs to calculate these polynomials and derive explicit formulas.
Theorem 1.1
Given a fixed connected graph H, there exists an algorithm (whose complexity depends on H) which applied to any base graph G produces a sequence of graphs \(G_1, G_2, \ldots , G_r\), derived from G, such that \(\pi _G^{(H)}(k)\) is a rational linear combination of \(\pi _{G_1}(k), \pi _{G_2}(k), \ldots , \pi _{G_r}(k)\).
We also focus on the special case when \(H=Q_d\cong \mathop {\square }_{i=1}^d K_2\) is the hypercube graph and \(G=T\), an arbitrary tree. We discuss how \(\pi _{T}^{(Q_d)}(k)\) relates to the generalized degree sequence of trees, as studied by Crew [6], and their limitations as complete invariants.
Finally, we present a counterexample to the conjecture of Asgarli, Krehbiel, Levinson and Russell. The authors conjectured [3, Conjecture 5.2] that if two graphs \(G_1\) and \(G_2\) satisfy \(\pi _{G_1}^{(K_2)}(k)=\pi _{G_2}^{(K_2)}(k)\), then \(\pi _{G_1}(k)=\pi _{G_2}(k)\). The counterexample below was found quickly using a computer program by applying the formulas involving shadow graphs developed in this paper.

We also have another counterexample, where both graphs are connected.
Outline of this Paper. In Sect. 2, we begin with the simplest non-trivial case, where \(H \cong K_2\) and progressively generalize our construction. In Sect. 3, we generalize further to H-subgraphs that represent multiple recoloring sequences, ending with the fully general construction for arbitrary H. Section 4 applies this construction to the special case of counting hypercube graphs in coloring graphs of trees. In Sect. 5, we investigate how counting hypercube graphs in coloring graphs of trees relates to the generalized degree sequence of a tree. Finally, in Sect. 6, we present two different counterexamples to [3, Conjecture 5.2].
2 Shadow Graphs for Basic Subgraphs
In this section, we introduce shadow graphs, the main constructive tool of this paper. We demonstrate their use in the simplest possible case, when \(H=K_2\) is the complete graph on 2 vertices. We extend this construction to more complex graphs, including cliques and Cartesian products of cliques, the latter of which is used in Sect. 4. The final construction counts induced hexagons, which can represent two possible sequences of recolorings. For disjoint subsets \(U, W\subseteq V(G)\), we use the shorthand \(U\times W\) to mean the set of all edges uw for \(u\in U\) and \(w\in W\). For a set of vertices V, we use the shorthand \((V)_k\) to mean the set of all k-tuples \((v_1,\dots ,v_k)\) of distinct vertices in V.
2.1 Shadow Graphs
A shadow graph, \(G'\) is a specific kind of graph constructed from G to contain many induced subgraphs isomorphic to G, such that the induced subgraphs overlap at some set of vertices. This allows one k-coloring of \(G'\) to induce many k-colorings of G each only differing from each other at a restricted subset of V(G). Recall that our goal is to compute \(\pi _G^{(H)}(k)\), which is the number of induced subgraphs of \(\mathcal {C}_k(G)\) isomorphic to H. By definition, a subgraph of \(\mathcal {C}_k(G)\) is precisely a set of k-colorings of G with some pairwise conditions on the number of vertices at which they differ. Since shadow graphs are constructed, such that their proper k-colorings contain a set of k-colorings of G with pairwise conditions on the number of vertices at which they differ, the problem of counting subgraphs of \(\mathcal {C}_k(G)\) can be translated to counting colorings of an appropriate shadow graph of G.
Definition 2.1
For a graph G, a tuple of vertices \(\textbf{x}=(v_1,\dots ,v_d)\in (V(G))_d\), and corresponding integers \(2\le r_1,\dots ,r_d\), a shadow graph \(G_\textbf{x}\) has vertex set \(V(G)\setminus \textbf{x} \cup \{v_{i,j}:i \le d, \; j\le r_i\}\). The vertices \(v_{i,j}\) are called shadow vertices. The edge set of \(G_\textbf{x}\) is determined by the following rules:
-
(1)
For any \(w_1,w_2\in V(G)\setminus \textbf{x}\), we have \(w_1w_2\in E(G_\textbf{x})\) if and only if \(w_1w_2\in E(G)\).
-
(2)
For any \(v_{i,j}\in V(G_\textbf{x})\) and \(w\in V(G)\setminus \textbf{x}\), we have \(v_{i,j}w\in E(G_\textbf{x})\) if and only if \(v_iw\in E(G)\).
-
(3)
For any fixed i, the shadow vertices \(\{v_{i,j}: j \le r_i\}\) form a clique.
-
(4)
For \(v_{i,j},v_{k,l}\in V(G_\textbf{x})\) with \(i \ne k\): if \(v_iv_k \notin E(G)\), then \(v_{i,j}v_{k,l}\notin E(G_\textbf{x})\). If \(v_iv_k \in E(G)\), then \(v_{i,j}v_{k,l}\) may or may not be an edge.
Below is an example of a shadow graph \(G_\textbf{x}\) of the given graph G, where \(\textbf{x}=(v_1,v_2)\), \(r_1=2\), and \(r_2=3\). The purple dotted edges indicate edges that can either be present or absent in \(G_\textbf{x}\):

The presence or absence of edges \(v_{i,j}v_{k,l}\in E(G_\textbf{x})\) when \(v_iv_k\in E(G)\) is determined according to the structure of H by an algorithm described in Sect. 3. For a given choice of such edges, it may be the case that for some \(j_1,\dots ,j_d\), that \(v_{i,j_i}v_{k,j_k}\in E(G_\textbf{x})\) for all \(v_iv_k\in E(G)\). This means that the induced subgraph of \(G_\textbf{x}\) on \(V(G)\setminus S \cup \{v_{i,j_i}: i\le d\}\) is isomorphic to G. In such a case, any k-coloring c of \(G_\textbf{x}\) will induce a k-coloring \(\phi \) of G, where \(\phi (v_i)=c(v_{i,j_i})\). If multiple such choices of the \(j_i\) exist, c induces multiple colorings of G each agreeing at all \(w\in V(G)\setminus S\), and possibly at some of the vertices in S depending on where different choices overlap.
2.2 Chromatic Pairs Polynomial
The chromatic pairs polynomial is the simplest example of a subgraph counting polynomial aside from the well-studied chromatic polynomial. The chromatic pairs polynomial, denoted \(\pi _G^{(K_2)}(k)\), is defined as the function that counts the number of edges (equivalently the number of induced copies of \(K_2\)) in \(\mathcal {C}_k(G)\). By definition, an edge in \(\mathcal {C}_k(G)\) represents a pair of colorings \(\phi _1,\phi _2\) of G differing only at a single vertex. Given such a vertex, v, we can construct a shadow graph containing two induced copies of G overlapping at all vertices except v.
For a vertex \(v \in V(G)\), the \(K_2\)-shadow graph of G on v is the shadow graph \(G_{(v)}\) from Definition 2.1 with \(d=1\) and \(r_1=2\). For notational simplicity, we write \(v_1, v_2\) for the shadow vertices instead of \(v_{1,1}, v_{1,2}\), and denote this graph by \(G_v^{(K_2)}\) (or simply \(G_v\)). Since \(d=1\), there are no ambiguous edges between distinct cliques. The graph \(G_{v}\) has one more vertex and \(\deg (v)+1\) more edges than G.
Below is an example of the \(K_2\)-shadow graph of a given graph G on a vertex v.
Lemma 2.2
The chromatic pairs polynomial of G is given by

Proof
For any proper coloring c of \(G_v\), define colorings \(\phi _1, \phi _2\) of G, where \(\phi _1(u)=\phi _2(u)=c(u)\) for all \(u\ne v\), and \(\phi _i(v)=c(v_i)\). Since \(v_1v_2 \in E(G_v)\), we have \(c(v_1) \ne c(v_2)\), so \(\phi _1\) and \(\phi _2\) differ only at v, corresponding to an edge in \(\mathcal {C}_k(G)\). These colorings are proper, as the induced subgraph of \(G_v\) on \(V(G_v)\setminus \{v_2\}\) is isomorphic to G, and the restriction of c to this subgraph is \(\phi _1\). Similarly, the induced subgraph of \(G_v\) on \(V(G_v)\setminus \{v_1\}\) is isomorphic to G, and the restriction of c to this subgraph is \(\phi _2\). Conversely, for any edge \(\phi _1\phi _2\in E(\mathcal {C}_k(G))\), we have that \(\phi _1(u)=\phi _2(u)\) for all \(u\ne v\) for some \(v\in V(G)\). Define c as the coloring of \(G_v\), where \(c(u)=\phi _1(u)=\phi _2(u)\) for all \(u\ne v\), \(c(v_1)=\phi _1(v)\), and \(c(v_2)=\phi _2(v)\). For any \(w\in N(v)\), \(c(v_1)\ne c(w)\), because \(\phi _1\) is a proper coloring; therefore, the edges \(v_1w\) do not violate the proper coloring condition. The same holds for edges \(v_2w\), due to the properness of \(\phi _2\). Since \(\phi _1\) and \(\phi _2\) are assumed to differ at v, \(c(v_1)\ne c(v_2)\), so the edge \(v_1v_2\in E(G_v)\) does not violate the proper coloring condition. Therefore, c is a proper coloring of \(G_v\). This correspondence is 2-to-1, as swapping \(c(v_1)\) and \(c(v_2)\) yields the same edge. The formula follows by summing over all vertices. \(\square \)
2.3 r-Clique Polynomials
The construction of \(G_v^{(K_2)}\) can be extended to count occurrences of cliques as subgraphs of \(\mathcal {C}_k(G)\). It is known that an occurrence of \(K_r\) as a subgraph of \(\mathcal {C}_k(G)\) must signify a single vertex changing between r available colors, while the other vertices remain the same color. That is, if \(K_r\cong H \subseteq \mathcal {C}_k(G)\), and \(V(H)=\{\phi _1,\dots ,\phi _r\}\), then \(\phi _1,\dots ,\phi _r\) all differ only at a single vertex. Given such a vertex, v, we can construct a shadow graph containing r induced copies of G each overlapping at all vertices except v as follows:
For a vertex \(v \in V(G)\), the \(K_r\)-shadow graph of G on v is the shadow graph \(G_{(v)}\) from Definition 2.1 with \(d=1\) and \(r_1=r\). As in Sect. 2.2, we write \(v_1, \ldots , v_r\) for the shadow vertices and denote this graph by \(G_v^{(K_r)}\) (or simply \(G_v\) when context is clear). Since \(d=1\), there are no ambiguous edges between distinct cliques. Below is an example of the \(K_5\)-shadow graph of a given graph G on a vertex v:

Lemma 2.3
The r-clique polynomial of G is given by
Proof
For any proper coloring c of \(G_v\), define colorings \(\phi _1,\ldots ,\phi _r\) of G, where \(\phi _i(u)=c(u)\) for all \(u\ne v\), and \(\phi _i(v)=c(v_i)\). Since \(v_iv_j \in E(G_v)\) for all \(i\ne j\), these r colorings all differ from each other only at v, forming a clique in \(\mathcal {C}_k(G)\). Conversely, for an r-clique \(K_r\cong H\subseteq \mathcal {C}_k(G)\), where \(V(H)=\{\phi _1,\dots ,\phi _r\}\), we know that \(\phi _1,\dots ,\phi _r\) all differ at a single vertex, which we will call v. We can construct a coloring c of \(G_v\), where \(c(w)=\phi _1(w)=\dots =\phi _r(w)\) for all \(w \in V(G)\setminus \{v\}\), and \(c(v_i)=\phi _i(v)\). By the properness of \(\phi _i\), \(v_i\) does not share a color with any \(w\in N(v)\), and since the \(\phi _i\) were assumed to be distinct colorings, \(c(v_i)\ne c(v_j)\) for any \(i,j\le r\). This correspondence is r!-to-1, as permuting the colors \(\{c(v_i)\}_{i=1}^r\) yields the same clique, and for any clique there are r! ways of picking the labels \(\phi _i\), each yielding distinct colorings of \(G_v\). The formula follows by summing over \(v \in V(G)\). \(\square \)
2.4 Polynomials Counting Cartesian Products of Cliques
The construction of \(G_v^{(K_r)}\) can be extended further still to count a family of subgraphs that arises from multiple vertices independently switching colors. Suppose we have such a set of vertices \(\{v_1,\dots ,v_d\}\subseteq V(G)\), such that across some set of colorings in \(\mathcal {C}_k(G)\), each vertex \(v_i\) picks its color out of a color palette \(\{c_{i,1},\dots ,c_{i,r_i}\}\). Consider the subgraph induced by all such color choices, assuming the choices can be made independently (with the left over vertices remaining the same color). Any such coloring \(\phi \) can be represented by a tuple \((j_1,\dots ,j_d)\in \{1,\dots ,r_1\}\times \dots \times \{1,\dots ,r_d\}\), where \(\phi (v_i)=c_{i,j_i}\). Two colorings are adjacent if and only if their respective tuples differ at a single index. This is the construction for the graph \(H=\mathop {\square }_{i=1}^d K_{r_i}\), a Cartesian product of complete graphs. Conversely, it is known that an induced Cartesian product of cliques can only arise as a subgraph of \(\mathcal {C}_k(G)\) by some set of d vertices independently switching between their respective \(r_i\) colors in this way. To construct a shadow graph to count occurrences of such a behavior, we do the following:
Given positive integers \(r_1,\dots , r_d\), construct a shadow graph \(G_\textbf{x}\) of G on a d-tuple of vertices \(\textbf{x}=(v_1,\dots ,v_d)\) by replacing each vertex \(v_i\in \textbf{x}\) with an \(r_i\)-clique of vertices \(v_{i,1},\dots ,v_{i,r_i}\). Add edges between each \(v_{i,j}\) and all neighbors of \(v_i\) in G, excluding those neighbors also in \(\textbf{x}\). For any pair of vertices \(v_i,v_k\in \textbf{x}\), where \(v_iv_k\in E(G)\), add all edges \(v_{i,j}v_{k,l}\) between their corresponding shadow vertices.
Since the color choices at distinct vertices are independent, any combination of colors from the respective palettes must yield a proper coloring. This requires that whenever \(v_iv_k \in E(G)\), every pair of colors from their palettes must be distinct, which we enforce by adding all edges between their corresponding cliques.
Below is such an example of such a construction with \(r_1=3,r_2=2,r_3=3\), and \(\textbf{x}=(v_1,v_2,v_3)\) on a graph \(G\cong P_5\):

Lemma 2.4
Let \(H = \mathop {\square }_{i=1}^d K_{r_i}\) be the Cartesian product. Then
Proof
For any proper coloring c of \(G_\textbf{x}\), define colorings \(\phi _{(j_1,\dots ,j_d)}\) for all \((j_1,\dots ,j_d)\in \{1,\dots ,r_1\}\times \dots \times \{1,\dots ,r_d\}\), wherein \(\phi _{(j_1,\dots ,j_d)}(v_i)=c(v_{i,j_i})\). Across all tuples, the vertices in \(\textbf{x}\) take on all possible color combinations within the color palette contained within the clique replacing each vertex. Because \(v_{i,j_i}v_{k,j_k} \in E(G_\textbf{x})\) whenever \(v_iv_k\in E(G)\), we must have that \(\phi _{(j_1,\dots ,j_d)}(v_i)\ne \phi _{(j_1,\dots ,j_d)}(v_k)\); therefore, \(\phi _{(j_1,\dots ,j_d)}\) is a proper coloring. Conversely, for some \(\mathop {\square }_{i=1}^d K_{r_i}\cong H \subseteq \mathcal {C}_k(G)\), we know that across all k-colorings of G in V(H), there must be some set of vertices \(v_1,\dots ,v_d\), with \(v_i\) switching between \(r_i\) different colors \(c_{i,1},\dots , c_{i,r_i}\) independently of the color choice of the other vertices. The subgraph H represents all such possible color choices, which can be indexed as \(\phi _{(j_1,\dots ,j_d)}\), where \(\phi _{(j_1,\dots ,j_d)}(v_i)=c_{i,j_i}\). Let \(\textbf{x}=(v_1,\dots ,v_d)\), and \(S=\{v_{i,j}: i\le d,\; j\le r_i\}\). We can construct a coloring c of \(G_\textbf{x}\), where \(c(w)=\phi (w)\) for all \(\phi \in V(H)\) when \(w\notin S\), and where \(c(v_{i,j})=c_{i,j}\). The edges \(w_1w_2\in E(G_\textbf{x})\), where \(w_1,w_2\notin S\) do not violate the proper coloring condition as \(w_1w_2\in \phi \) for all \(\phi \in V(H)\), and V(H) consists of proper colorings. The edges \(w v_{i,j} \in E(G_\textbf{x})\), where \(w\notin S\) do not violate the proper coloring condition, as \(\phi _{(j_1,\dots ,j_d)}(v_i)\ne \phi _{(j_1,\dots ,j_d)}(w)\). The edges \(v_{i,j}v_{i,l}\in E(G_\textbf{x})\) do not violate the proper coloring condition as the clique replacing \(v_i\) is colored with the color palette of \(v_i\) which by definition does not contain repeat colors. The edges \(v_{i,j}v_{k,l}\in E(G_\textbf{x})\) do not violate the proper coloring condition as distinct vertices \(v_i,v_k\) are assumed to be able to switch between colors in their respective color palettes independently of the other color choices. Therefore, adjacent vertices have non-overlapping color palettes within H.
The factor \(\prod _{i=1}^d r_i!\) accounts for the permutations of colors among the shadows of each \(v_i\). The additional division by \(\prod _{j} m_j!\) corrects for over-counting when identical \(r_i\) values occur multiple times. For instance, if \(r_1=r_2\), then \(G_{(v_1, v_2, \ldots )}\cong G_{(v_2, v_1, \ldots )}\), and they will count the same Cartesian products of cliques, despite being generated by different d-tuples.
Summing over all ordered tuples and dividing by these factors counts instances of \(\mathop {\square }_{i=1}^d K_{r_i}\). \(\square \)
2.5 Calculating \(\pi _G^{(C_6)}(k)\)
So far, all of the subgraphs we have been counting can only appear in \(\mathcal {C}_k(G)\) by a single, predictable pattern of vertex recolorings. A clique can only appear as a result of one vertex changing between multiple colors, and a Cartesian product of cliques can only appear from a set of vertices independently changing between sets of colors. For general H, this is not always the case. For instance, it is established in [1] that an induced copy of \(C_6\) can appear in one of the two ways, either by two vertices switching between three colors, or by three vertices switching between two colors. For completeness, we include a short proof:
Proof
If only one vertex changes, the sequence degenerates into a \(K_6\) as repeated color changes on the same vertex would make every coloring in the sequence adjacent.
If two vertices change color, neither can change color more than 3 times, as that would mean one vertex changes its color multiple times consecutively, inducing a triangle. Since \(C_6\) does not contain a triangle, each can change at most 3 times in total. Since there are only 2, they must each change 3 times exactly.
If three vertices change color, each must change color at least twice, as traversing all edges of the \(C_6\) must end at the same coloring as the start. Since there are 3 vertices, each must change exactly 2 times.
If more than three vertices change color at some point, they all must change back to their original color at some point due to the cyclic nature of the hexagon. This would require more than 6 edges, a contradiction. \(\square \)
We begin by counting occurrences of \(C_6\cong H\subseteq \mathcal {C}_k(G)\), where only 2 vertices \(v_1,v_2\in V(G)\) change color across all edges in H. As established, each vertex has a color palette of three colors, \(\{c_{1,1},c_{1,2},c_{1,3}\}\) and \(\{c_{2,1},c_{2,2},c_{2,3}\}\), respectively. Any coloring \(\phi \) in V(H) can then be identified with a tuple (i, j) signifying that \(\phi (v_1)=c_{1,i}\) and \(\phi (v_2)=c_{2,j}\). The only valid recoloring sequence up to relabeling of \(v_1\), \(v_2\), and their respective color palettes is
Each pair (i, j) represents a coloring state in H. Adjacent colorings in the sequence differ at exactly one vertex, ensuring proper adjacency. Moreover, any two colorings corresponding to non-adjacent vertices in H do not differ by the color of only one vertex, which ensures the subgraph is induced.
To count these hexagons, we construct a shadow graph \(G_{(v_1,v_2)}\) by the following construction on G with vertices \(v_1\) and \(v_2\) selected:
-
Replace \(v_1\) and \(v_2\) each with a triangle containing vertices \(v_{1,1},v_{1,2},v_{1,3}\) and \(v_{2,1},v_{2,2},v_{2,3}\)
-
Add edges between \(v_{1,1},v_{1,2},v_{1,3}\) and all vertices in \(N(v_1)\setminus \{v_2\}\), and add edges between \(v_{2,1},v_{2,2},v_{2,3}\) and \(N(v_2)\setminus \{v_1\}\)
-
If \(v_1v_2\in E(G)\), connect \(v_{1,1},v_{1,2},v_{1,3},v_{2,1},v_{2,2},v_{2,3}\), such that each state in the recoloring sequence, (i, j) is assigned an edge \(v_{1,i} v_{2,j}\). For this recoloring sequence, we add edges \(v_{1,1}v_{2,1},v_{1,2}v_{2,1},v_{1,2}v_{2,2},v_{1,3}v_{2,2},v_{1,3}v_{2,3},\) \(v_{1,1}v_{2,3}\)
This construction yields the shadow graph \(G_{(v_1,v_2)}\) from Definition 2.1 with \(d=2\), \(r_1=r_2=3\), and the specific edge choices between cliques determined by the recoloring sequence. An example is shown below for \(G=P_5\):

These constraints ensure that the chromatic polynomial of \(G_{(v_1,v_2)}\) counts only colorings corresponding to a recoloring sequence forming an induced \(C_6\). For any k-coloring c of \(G_{(v_1,v_2)}\), consider the colorings \(\phi _{(i,j)}\) for which \(\phi _{(i,j)}(v_1)=c(v_{1,i})\), \(\phi _{(i,j)}(v_2)=c(v_{2,j})\), and \(\phi _{(i,j)}(w)=c(w)\) otherwise. Whenever (i, j) is one of the states in the recoloring sequence, \(\phi _{(i,j)}\) is a proper coloring. Edges between pairs of non-shadow vertices do not violate the proper coloring condition, as they inherit the properness of their corresponding edge in c. Similarly, edges from \(v_1\) or \(v_2\) to their non-shadow neighbors do not violate the properness of the coloring, because edges \(wv_{1,i}\) (respectively, \(wv_{2,i}\)) exist in \(G_{(v_1,v_2)}\). Finally, the edge \(v_1v_2\) does not violate the properness of the coloring if it is present, as \(v_{1,i}v_{2,j}\) is present for any (i, j) in the recoloring sequence. Conversely, consider some set of colorings \(\phi _{(i,j)}\) of G forming an induced \(C_6\) in \(\mathcal {C}_k(G)\), where \(\phi _{(i,j)}(v_1)=c_{1,i}\) and \(\phi _{(i,j)}(v_2)=c_{2,j}\) for some pair of vertices \((v_1,v_2)\). Let it also be the case that \(v_1,v_2\) and \(c_{1,i},c_{2,j}\) are chosen, such that for a chosen traversal around the \(C_6\), the order at which we traverse the \(\phi _{(i,j)}\) matches the earlier recoloring sequence. Given this, we can construct a proper coloring c of \(G_{(v_1,v_2)}\). Let \(c(w)=\phi _{(i,j)}(w)\) for all \(w\notin \{v_1,v_2\}\) for all \(\phi _{(i,j)}\). Let \(c(v_{1,i})=c_{1,i}\) and \(c(v_{2,j})=c_{2,j}\). Since our choice of \(v_1,v_2\) and \(c_{1,i},c_{2,j}\) were chosen to align with a chosen traversal of the \(C_6\) matching the recoloring sequence, all edges \(v_{1,i}v_{2,j}\) do not violate the properness of the coloring c. The remaining edges inherit their properness from the \(\phi _{(i,j)}\) in the same way as in the Cartesian product of cliques. Across all k-colorings of \(G_{(v_1,v_2)}\) for all ordered pairs of distinct vertices \((v_1,v_2)\), the correspondence is \(|\operatorname {Aut}(C_6)| = 12\)-to-1, as a specific coloring of a specific \(G_{(v_1,v_2)}\) corresponds to a specific traversal of an induced \(C_6\) in \(\mathcal {C}_k(G)\), of which each \(C_6\) has exactly 12. Summing over all ordered pairs of vertices \((v_1, v_2)\) in G and dividing by 12 gives a polynomial equation counting induced hexagons in G which arise from exactly 2 vertices changing color:
When three vertices \(v_1\), \(v_2\), and \(v_3\) all change color across vertices of an induced \(C_6\cong H \subseteq \mathcal {C}_k(G)\), they have color palettes of \(\{c_{1,1},c_{1,2}\}\), \(\{c_{2,1},c_{2,2}\}\), and \(\{c_{3,1},c_{3,2}\}\), respectively. Each coloring \(\phi \) in V(H) be associated a tuple (i, j, k), representing that \(\phi (v_1)=c_{1,i}\), \(\phi (v_2)=c_{2,j}\), \(\phi (v_3)=c_{3,k}\)
The only valid set of such tuples (up to relabeling \(v_1,v_2,v_3\), and \(c_{1,1},c_{1,2},c_{2,1},\) \(c_{2,2},c_{3,1},c_{3,2}\)) representing an induced hexagon in which 3 vertices all change color is, in order of a traversal around the \(C_6\):
As before, we construct a shadow graph \(G_{(v_1,v_2,v_3)}\) by the following construction on G with vertices \(v_1\), \(v_2\), and \(v_3\) selected:
-
Replace \(v_1,v_2,v_3\) each with a copy of \(K_2\) containing vertices \(v_{1,1},v_{1,2}\), \(v_{2,1},v_{2,2}\), and \(v_{3,1},v_{3,2}\).
-
Add edges between \(v_{1,1},v_{1,2}\) and each vertex in \(N(v_1)\setminus \{v,w\}\). Likewise, with \(v_{2,1},v_{2,2}\) and \(v_{3,1},v_{3,2}\).
-
Add edges between \(v_{1,1},v_{1,2},v_{2,1},v_{2,2},v_{3,1},v_{3,2}\) according to the coloring states in the sequence. If \(v_1v_2\in E(G)\) and the sequence contains a state (i, j, k), then we add an edge \(v_{1,i}v_{2,j}\). Likewise, if \(v_1v_3\in E(G)\) or \(v_2v_3\in E(G)\).
This yields the shadow graph \(G_{(v_1,v_2,v_3)}\) from Definition 2.1 with \(d=3\) and \(r_1=r_2=r_3=2\). An example is shown below for \(G=P_5\):

As before, the chromatic polynomial of the shadow graph counts valid colorings corresponding to the recoloring sequence. Given any k-coloring c of \(G_{(v_1,v_2,v_3)}\), we can create k-colorings \(\phi _{(i,j,k)}\) of G for each tuple (i, j, k) in the earlier recoloring sequence, such that \(\phi _{(i,j,k)}(v_1)=c(v_{1,i}),\phi _{(i,j,k)}(v_2)=c(v_{2,j}),\phi _{(i,j,k)}(v_3)=c(v_{3,k})\), and \(\phi _{(i,j,k)}(w)=c(w)\) otherwise. The edges \(w_1w_2\) for \(w_1,w_2\notin \{v_1,v_2,v_3\}\) do not violate the properness of \(\phi _{(i,j,k)}\) as they inherit their properness from c, as do the edges between \(v_1,v_2,v_3\) and their respective neighbors (excluding eachother), as before. The edges \(v_1v_2,v_1v_3,v_2v_3\), if they exist, do not violate the properness of \(\phi _{(i,j,k)}\), as (i, j, k) is assumed to be in the recoloring sequence, so the necessary edges \(v_{1,i}v_{2,j}, v_{1,i}v_{3,k},v_{2,j}v_{3,k}\) were added to \(G_{(v_1,v_2,v_3)}\). Conversely, given an induced subgraph \(C_6\cong H\subseteq \mathcal {C}_k(G)\) on which 3 vertices change color, by picking a traversal around H we can label these vertices as \(v_1,v_2,v_3\) according to the order they change color, and label their color palettes \(\{c_{1,1},c_{1,2}\}\), \(\{c_{2,1},c_{2,2}\}\), and \(\{c_{3,1},c_{3,2}\}\) according to the order the vertices each take on each color (such that \(c_{1,1}\) is the initial color of \(v_1\) in the traversal, etc). The correspondence is again \(|\text {Aut}(C_6)| = 12\)-to-1, as each k-coloring of some \(G_{(v_1,v_2,v_3)}\) corresponds to a specific traversal around the vertices in an induced \(C_6\) in \(\mathcal {C}_k(G)\). By picking a specific canonical traversal around the vertices of a given \(C_6\), all other traversals can be identified with the automorphism of \(C_6\) that sends it to the canonical traversal. Summing over all ordered triples \((v_1, v_2, v_3)\) in G and dividing by 12 gives the contribution of these sequences to \(\pi _G^{(C_6)}(k)\).
In total
3 General Construction of a Subgraph Counting Polynomial
In this section, we fully extend and formalize the construction of subgraph counting polynomials introduced in the previous section for an arbitrary subgraph \(H\subseteq \mathcal {C}_k(G)\). We extend the ideas of shadow graphs developed in earlier sections to describe how any subgraph-counting polynomial can be constructed.
3.1 General Construction for Arbitrary Connected Subgraphs
To compute \(\pi _G^{(H)}(k)\) for an arbitrary connected subgraph H, we first determine what underlying behaviors on colorings could cause H to arise as an induced subgraph of some \(\mathcal {C}_k(G)\). First, we formalize the concept of an underlying behavior by classifying the behavior of a given induced H-subgraph of \(\mathcal {C}_k(G)\). Then, we determine necessary conditions for a behavior to give rise to an induced H-subgraph. We then show that such a behavior does indeed induce a copy of H wherever it appears in \(\mathcal {C}_k(G)\). The behaviors will be classified relative to a specific ordered traversal of a spanning tree of H
In any induced H-subgraph of \(\mathcal {C}_k(G)\), we observe that some set of d vertices change color, while the rest remain the same. Let us denote the vertices of this H-subgraph as \(\phi _1, \dots , \phi _{|V(H)|}\), ordered according to our chosen traversal of the spanning tree. From this, we can create a canonical ordered tuple \(\textbf{x}=(v_1,\dots ,v_d)\in (V(G))_d\) of the color-changing vertices in G. Here, \(v_i\) is the ith vertex to change from its initial color during our selected traversal. Using a spanning tree, we ensure that each coloring other than \(\phi _1\) differs from at least one previous coloring by exactly one vertex, so that the ordering of \(\textbf{x}\) is unambiguous. We can also assign to each vertex \(v_i\) a canonical ordered color palette \(\mathcal {P}_i=(c_{i,1},\dots ,c_{i,r_i})\), such that \(c_{i,1}\) is the initial color of \(v_i\), and \(c_{i,j}\) is the jth color that \(v_i\) exhibits as we traverse the spanning tree. These orderings allow us to define a map \(f:V(H) \rightarrow \mathbb {N}^d\) of coloring states of G, such that \(f(\phi _k)=(j_1,\dots ,j_d)\), implies that \(\phi _k(v_i)=c_{i,j_i}\). In particular, since we have ordered both the vertices and the colors, \(f(\phi _1)=(1,1,\dots , 1)\), and \(f(\phi _2)=(2,1,\dots , 1)\). We will consider each f to model the underlying behavior that gives rise to an H-subgraph. Whether or not a given f models the underlying behavior of a certain H-subgraph of \(\mathcal {C}_k(G)\) is a question that relies heavily on G and the chosen H-subgraph. However, whether or not some f can model the underlying behavior of some H-subgraph of some coloring graph is a question that relies only on H and our chosen traversal of H.
For a fixed ordered traversal \(\mathcal {O}=(u_1, u_2,\dots u_{|V(H)|})\) of the vertices in a spanning tree of H, a map \(f:V(H) \rightarrow \mathbb {N}^d\) with \(d<|V(H)|\) is called a valid state map if
-
f is injective, ensuring multiple vertices in H are not assigned to the same vertex in \(\mathcal {C}_k(G)\). If two vertices \(u,u'\in V(H)\) both mapped to the same tuple \((j_1,\dots ,j_d)\), this would signify that each color changing vertex \(v_i\) is colored \(c_{i,j_i}\) at two different vertices in H. Since all other vertices are assumed to remain the same color, these colorings would be the same, contradicting them representing distinct vertices in H. Since f should represent the general underlying behavior causing H to appear, only injective f should be included.
-
Two vertices in H have tuples differing at exactly one index if and only if they are adjacent, ensuring H will be an induced subgraph.
-
The presence of some \(j>1\) at index i of \(f(u_k)\) implies \(f(u_{k'})\) has \(j-1\) in spot i for some \(k'<k\), ensuring each index progresses sequentially through a valid ordered color palette. A map in which \(v_i\) exhibits the jth color in its color palette without first exhibiting the \(j-1\)th color, cannot represent traversal in which the color palette is ordered correctly.
-
The presence of \(j>1\) in spot \(i>1\) of \(f(u_k)\) implies \(f(u_{k'})\) has 2 in spot \(i-1\) for some \(k'<k\), ensuring the order within the tuple by which indices change corresponds to the order of the tuple itself. A map in which \(v_i\) changes from its initial color before \(v_{i-1}\) cannot represent a valid traversal in which the vertices are ordered correctly.
The last two conditions are necessary, because we seek only the f that can arise from traversing some H subgraph after having correctly ordered the vertices and their color palettes. Any f that indicates an incorrectly ordered color palette or incorrectly ordered tuple of color changing vertices should be discarded. The set \(\mathcal {F}(H,\mathcal {O})\) of all such f which exist for a given graph H and respect an ordered traversal \(\mathcal {O}\) of H is independent of whichever G we choose as our base graph.
As an example, consider \(H=P_5\), the path on 5 vertices, with traversal \(\mathcal {O}=(u_1,u_2,u_3,u_4,u_5)\) along the path. The set \(\mathcal {F}(P_5,\mathcal {O})\) consists of five valid state maps:

Each valid state map assigns tuples to the vertices of \(P_5\), with adjacent vertices receiving tuples that differ at exactly one index.
Consider a set of colorings \(\phi _1,\dots ,\phi _{|V(H)|}\in V(\mathcal {C}_k(G))\), and some tuple of vertices \(\textbf{x}=(v_1,\dots ,v_d)\in (V(G))_d\), where \(\textbf{x}\) contains exactly the vertices that change color across the \(\phi _i\). Let \(\mathcal {P}_i=(c_{i,1},\dots ,c_{i,r_i})\) denote the color palette of \(v_i\), ordered according to the first coloring at which \(v_i\) exhibits a given color. If a given valid state map f of H containing tuples of length d accurately describes the index \(j_i\) of the color of each \(v_i\) within its color palette at each \(\phi _k\), the colorings \(\phi _1,\dots ,\phi _{|V(H)|}\in V(\mathcal {C}_k(G))\) must form an induced \(H\subseteq \mathcal {C}_k(G)\). This is a direct consequence of the condition that two vertices in H have tuples differing at exactly one index if and only if they are adjacent. Whenever two tuples \((j_1,\dots ,j_i,\dots ,j_d)\) and \((j_1,\dots ,j_i',\dots ,j_d)\) differ at exactly one index, this indicates that the corresponding colorings \(\phi ,\phi '\) color G, such that \(\phi (v_i)=c_{i,j_i}\) and \(\phi '(v_i)=c_{i,j_i'}\), but all other vertices have matching colors across \(\phi ,\phi '\). This is precisely the definition of adjacent colorings of G.
Definition 3.1
Given a base graph G, a valid state map \(f\in \mathcal {F}(H,\mathcal {O})\), where \(f:V(H)\rightarrow \mathbb {N}^{d}\), and an ordered d-tuple \(\textbf{x}=(v_1, \dots , v_d)\in (V(G))_d\), the H-shadow graph \(G_{f,\textbf{x}}\) is the shadow graph from Definition 2.1 constructed as follows:
-
(1)
For each \(1\le i\le d\), replace \(v_i\) with a clique of size \(r_i\) containing vertices \(v_{i,j}\) for \(1 \le j \le r_i\), where \(r_i\) is the maximal color index taken by \(v_i\) across all states in f.
-
(2)
Add edges between each such clique and \(N(v_i)\setminus \textbf{x}\).
-
(3)
For each pair of color palette indices in each state in f(V(H)), say \(j_1\) in position \(i_1\) and \(j_2\) in position \(i_2\), add an edge \(v_{i_1,j_1}v_{i_2,j_2}\) if \(v_{i_1}\) and \(v_{i_2}\) are adjacent in G.
The edges between cliques specified in item (3) ensure that the colorings dictated by states in f actually result in proper colorings once the color palettes are chosen. For example, if some state \((2,5,\dots )\) is in the image of f, this dictates that for some \(\phi \) in the resulting H-subgraph, we will have \(\phi (v_1)=c_{1,2}\) and \(\phi (v_2)=c_{2,5}\). If \(v_1\) and \(v_2\) are adjacent in G we should ensure that \(c_{1,2}\ne c_{2,5}\) by an edge between \(v_{1,2}\) and \(v_{2,5}\).
Given a coloring c of \(G_{f,\textbf{x}}\), we can construct |V(H)| colorings \(\phi _1, \dots ,\)\( \phi _{|V(H)|}\) of G according to f. Let \(\phi _k(w)=c(w)\) for all \(w\notin \textbf{x}\), and let \(\phi _k(v_i)=c(v_{i,j_i})\), where \(f(u_k)=(j_1,\dots ,j_d)\). That is, the equality \(f(u_k)=(j_1,\dots ,j_d)\) dictates that vertex \(v_i\) should take the color of the \(j_i\)th vertex in the clique replacing it. Edges where one endpoint is not in \(\textbf{x}\) are proper in G as they inherit their properness from their corresponding edge in \(G_{f,\textbf{x}}\). For edges \(v_{i}v_{i'}\in E(G)\), where \(v_{i},v_{i'}\in \textbf{x}\), we know that in a coloring \(\phi \) corresponding to some state \((j_1,\dots ,j_d)\) in the image of f, we have added the edge \(v_{i,j_i}v_{i',j_{i'}}\) to \(E(G_{f,\textbf{x}})\). Therefore, these edges will not violate the properness of \(\phi \). Conversely, given an induced \(H\subseteq \mathcal {C}_k(G)\), and a traversal of H according to \(\mathcal {O}\), we can determine f and \(\textbf{x}\) unambiguously by ordering the color changing vertices and their respective color palettes. We can then color each clique in \(G_{f,\textbf{x}}\) replacing a vertex in \(\textbf{x}\) with its respective ordered color palette, and the properness of this coloring is ensured by the properness of all colorings in V(H). To calculate \(\pi _G^{(H)}(k)\), we sum over all valid state maps and all d-tuples, then divide by the number of automorphisms:
The final division by \(|\operatorname {Aut}(H)|\) is necessary, because each coloring counted by each \(\pi _{G_{f,\textbf{x}}}(k)\) corresponds to an ordering of some set of |V(H)| colorings in \(\mathcal {C}_k(G)\) satisfying a specific requirement on which pairs of colorings must have an edge between them, and which must not. If one such set of colorings can be relabeled in multiple ways to satisfy the same adjacency requirements, these different orderings will independently contribute to the sum. This may correspond to some permutation of the labels of the \(v_i\) or the \(c_{i,j}\). We can partition the set of all such ordered tuples of colorings in \(\mathcal {C}_k(G)\) by which induced H-subgraph they span. Each partition will have exactly \(|\operatorname {Aut}(H)|\) such orderings.
3.2 The Construction for Disconnected Graphs
Counting induced disconnected subgraphs \(H\subseteq \mathcal {C}_k(G)\) can be done by multiplying the number of induced subgraphs isomorphic to each connected component, and subtracting out all possible ways of embedding the connected components in a way that is not induced. This involves counting all graphs containing all connected components of H, but which are not H, and do not have extra vertices. Formally, this can be defined as follows.
We define the notion of a graph containing two connected components without extra vertices. Given two graphs A and B, let
For example, when \(A=K_3\) and \(B=K_2\), the collection J(A, B) consists of the following graphs:

.
Given a graphs G, A, and B, define \(f_G(A,B)\) to count the number of embeddings of A, B into G without leftover vertices as follows:
Note that \(V_A,V_B\) may overlap. For example, \(f_{\text {Diamond}}(K_2,K_3)=4\), counting the following 4 embeddings:

For a disconnected graph H, we calculate \(\pi ^{(H)}_G(k)\) by recursion on the connected components. Suppose we select one such component, \(H'\). Given \(H'\) and the complement \(H\setminus H'\) (which may still be disconnected), then
where \(n_{H'}(H)\) counts the number of connected components of H isomorphic to \(H'\).
Proof
The product \(\pi ^{(H')}_G(k)\cdot \pi ^{(H\setminus H')}_G(k)\) counts all pairs of induced subgraphs \((H'_i,(H\setminus H')_j)\), where \(H'_i,(H\setminus H')_j\subseteq \mathcal {C}_k(G)\). Some of these pairs do not constitute an induced subgraph isomorphic to H, as they may be overlapping or have extra edges in \(\mathcal {C}_k(G)\) connecting them. If this is the case, the true induced graph on their vertex set must be some other graph that contains both \(H'\) and \(H\setminus H'\) as induced subgraphs and has no additional vertices. This is precisely the definition of \(J(H',H\setminus H')\). For each such graph, we should subtract out how many invalid pairs of \((H'_i,(H\setminus H')_j)\) in \(\mathcal {C}_k(G)\) actually induce this graph. This is the definition of \(f_U(H', H\setminus H')\). By subtracting all such invalid pairs, we are left with only the pairs that give an induced subgraph isomorphic to H. However, since H contains \(n_{H'}(H)\) connected components isomorphic to \(H'\), then for any induced subgraph of \(\mathcal {C}_k(G)\) isomorphic to H, there will be \(n_{H'}(H)\) pairs of \((H'_i,(H\setminus H')_j)\) which are valid. These can be identified by selecting each \(H'\)-component of the H-subgraph as the prior element of the pair, and the remainder of the H-subgraph as the latter. To account for this we divide by \(n_{H'}(H)\). \(\square \)
4 Hypercube Polynomials of Trees
In this section, we will demonstrate how the shadow graphs established in the previous section can be used to give a closed form for polynomials counting induced hypercubes in trees, a task which did not seem to be attainable using previous methods. As hypercubes are a special, highly symmetric case of a Cartesian product of cliques, we can use the formula from Sect. 2.4. For simplicity, because we are calculating the special case of a Cartesian product of cliques, where all cliques are the same size, we can simply sum over unordered sets of d vertices, and omit the factor of \(\frac{1}{d!}\). It is known that the chromatic polynomial of a tree depends only on the number of vertices in the tree, and that the chromatic pairs polynomial depends only on the degree sequence. Therefore, it is natural to wonder what data are necessary to construct higher dimensional hypercube polynomials. We find a simple expression for the square-counting polynomial and the general d-dimensional hypercube polynomial.
4.1 Chromatic and Chromatic Pairs Polynomial of a Tree
For a tree T with n vertices, the chromatic polynomial is well-known to be \(\pi _T(k) = k(k - 1)^{n - 1}\). This reflects that after choosing a color for a root vertex, each subsequent vertex has \(k - 1\) choices to avoid matching its parent. The chromatic polynomial is the same as \(\pi _{T}^{(Q_0)}(k)\). To calculate the chromatic pairs polynomial \(\pi _{T}^{(Q_1)}(k)=\pi _{T}^{(K_2)}(k)\), the following formula appears in [3, Equation (4.4)]. We give an alternative derivation using shadow graphs.
Proposition 4.1
For a tree T, the chromatic pairs polynomial is
Proof
In the shadow graph \(T_v\), where v is replaced by \(v_1\) and \(v_2\), we have:
-
k choices for \(v_1\).
-
\(k - 1\) choices for \(v_2\) (since \(v_2\) must differ from \(v_1\)).
-
\(k - 2\) choices for all neighbors of \(v_1\) (must differ from both \(v_1\) and \(v_2\)).
-
\(k - 1\) choices for all other vertices (must differ from their parent).
An example of \(T_v\) for one such T, v is shown below, labeled according to the number of colors available:

Multiplying these choices gives
Simplifying, we get \(\pi _{T_v}(k) = k (k - 1)^{n - \deg (v)} (k - 2)^{\deg (v)}\). Summing over all \(v \in V(T)\) and dividing by 2 (as per Lemma 2.2), we obtain the desired formula.
\(\square \)
4.2 Square Polynomial of a Tree
When coloring a shadow graph of a tree with two shadow vertices (say \(u_1,u_2\) and \(v_1,v_2\) replacing base vertices u and v), the construction depends on whether \(uv\in E(T)\). Below is an example of each scenario for one such T, in one case with \(u,v_1\) and another with \(u,v_2\). Both are labeled according to the number of colors available as we traverse the shadow graph:

Case 1: u and v are adjacent.
If u and v are adjacent in T, we show that the contribution to the 2-dimensional hypercube polynomial is
We can color the vertices of the shadow graph in the following order:
-
k choices for \(u_1\).
-
\(k - 1\) choices for \(u_2\), as it must differ from \(u_1\).
-
\(k - 2\) choices for \(v_1\), as it must differ from \(u_1\) and \(u_2\).
-
\(k - 3\) choices for \(v_2\), as it must differ from \(u_1\), \(u_2\), and \(v_1\).
-
All neighbors of \(u_1\) and \(v_1\) (excluding each other) have \(k - 2\) choices as neighbors of \(u_1\) must differ from \(u_1\) and \(u_2\), and likewise for neighbors of \(v_1\). This gives a factor of \((k-2)^{\deg (u)+\deg (v)-2}\).
-
Remaining vertices have can be assigned colors by traversing the remainder of the tree, with \(k - 1\) choices each. This gives a factor of \((k-1)^{n-\deg (u)-\deg (v)}\).
Multiplying these choices gives the formula.
Case 2: u and v are not adjacent.
If u and v are not adjacent in T, we show the corresponding contribution is
The coloring choices are:
-
k choices for \(u_1\).
-
\(k - 1\) choices for \(u_2\) as it must differ from \(u_1\).
-
\(k - 2\) choices for all neighbors of \(u_1\) as they must differ from \(u_1\) and \(u_2\).
-
\(k - 1\) choices for all nodes on the path between \(u_1\) and \(v_1\) excluding \(u_1\), and the neighbor of \(u_1\), but including \(v_1\), as each of these can be assigned a color differing only from their one neighbor which has already been assigned a color.
-
\(k - 2\) choices for \(v_2\) as it must differ from \(v_1\) and the neighbor of \(v_1\) on the path between \(u_1\) and \(v_1\).
-
\(k - 2\) choices for all other neighbors of \(v_1\), as they must differ from \(v_1\) and \(v_2\).
-
\(k - 1\) choices for all other vertices, as they can be assigned colors according to an ordered traversal, in which they only need differ from their neighbor which has already been assigned a color.
The length of the path between u and v does not affect the total count, as each vertex on the path has an identical number of choices to all other vertices of distance at least 2 to u and v. Multiplying the terms yields the formula.
Our analysis above leads to the following result:
Corollary 4.2
4.3 General Case for d Shadow Vertices
In the general case, when coloring the tree with d shadow vertices, we sum over all unordered sets \(S \subseteq V\) with \(|S| = d\).
Theorem 4.3
The d-dimensional hypercube polynomial for a tree T is
where \(\deg (S) = \sum _{v \in S} \deg (v)\) and \(\operatorname {int}(S)\) is the number of interior edges, those with two endpoints in S.
Proof
For each set \(S=\{v_1,v_2,\dots ,v_d\}\) of vertices in T, we:
-
Replace each vertex \(v_i\) in S with two shadow vertices \(v_{i,1}\) and \(v_{i,2}\).
-
Add edges \(v_{i,1}v_{i,2}\) for all \(i\le d\), as well as all edges in \(\{v_{i,1},v_{i,2}\}\times N(v_i)\).
-
Add edges \(\{v_{i,1},v_{i,2}\}\times \{v_{j,1},v_{j,2}\}\) for all \(v_iv_j\in E(T)\).
To color this graph, we begin by assigning any of the k colors to \(v_{1,1}\), and any of the \(k-1\) remaining colors to \(v_{1,2}\). Then, traversing the tree, we make the following coloring choices:
-
\(k-2\) choices for any vertex not in S adjacent to a shadow \(K_2\) that has already been colored.
-
\((k-1)(k-2)\) choices for both vertices in a shadow \(K_2\) which is not adjacent to another shadow \(K_2\) that has already been colored.
-
\((k-2)(k-3)\) choices for both vertices in a shadow \(K_2\) which is adjacent to another shadow \(K_2\) that has already been colored.
-
\(k-1\) choices for a vertex not in S which is not adjacent to a shadow \(K_2\) that has already been colored.
In total, there will be a single factor of k. There will be one factor of \(k-3\) for each shadow \(K_2\), minus one for each connected component, as the first pair to be assigned a color in a connected component will have \((k-1)(k-2)\) choices. This is equivalent to the number of edges in T with two endpoints in S. There will be a factor of \(k-2\) for all vertices not in S that are adjacent to a vertex in S, except for the first vertex to receive a color. There will be an additional factor of \(k-2\) for all pairs of shadow vertices. This is equivalent to the number of edges in T with at least one endpoint in S, which is \(\deg (S)-\operatorname {int}(S)\). The remaining vertices contribute a factor of \(k-1\). Dividing by \(2^d\) corrects for the over-counting due to permuting the colors in the color palette of each shadow vertex. \(\square \)
The data necessary to construct the dth hypercube polynomial is then the multiset of all pairs \((\deg (S),\operatorname {int}(S))\) for all subsets \(S\subseteq V(T)\), where \(|S|=d\). The number of such subsets, \(\left( {\begin{array}{c}|V(T)|\\ d\end{array}}\right) \) increases until \(d=\lfloor \frac{|V(T)|}{2}\rfloor \), at which point \(\left( {\begin{array}{c}|V(T)|\\ d\end{array}}\right) =\left( {\begin{array}{c}|V(T)|\\ |V(T)|-d\end{array}}\right) \) for \(d>\lfloor \frac{|V(T)|}{2}\rfloor \). In fact, for any subset S with degree \(\deg (S)\), the complement of S, \(\overline{S}=V(T)\setminus S\) must have degree \(\deg (\overline{S})=2\left( |V(T)|-1\right) -\deg (S)\), as \(\deg (S)+\deg (\overline{S})=2|E(T)|\) by the handshake lemma, and \(|E(T)|=|V(T)|-1\). Likewise, \(\operatorname {int}(\overline{S})=|V(T)|-1-\deg (S)-\operatorname {int}(S)\), as \(|E(T)|=\operatorname {int}(S)+(\deg (S)-2\operatorname {int}(S))+\operatorname {int}(\overline{S})\). Therefore, the dth multiset can be used to construct the \((|V(T)|-d)\)th multiset.
5 Relation to Generalized Degree Sequence
Having confirmed that d-dimensional hypercube polynomials do indeed require more data to calculate up until \(d=\lfloor \frac{|V(T)|}{2}\rfloor \), it is natural to wonder whether the full set of hypercube polynomials form a complete invariant for trees. In this section, by relating this data to the generalized degree sequence introduced in [6], we answer this question in the negative.
The generalized degree sequence is defined as the multiset of triplets \((|S|, \operatorname {int}(S), \operatorname {ext}(S))\), for all subsets of \(S\subseteq V(T)\), where \(\operatorname {ext}(S) = \deg (S) - 2 \operatorname {int}(S)\) is the number of edges with exactly one endpoint in S. Since we can extract \(\operatorname {int}(S),\deg (S)\) from the generalized degree sequence, the generalized degree sequence is sufficient to determine the full set of hypercube polynomials of a tree by Theorem 4.3.
However, as shown in [6], the generalized degree sequence is not a complete invariant of trees; non-isomorphic trees can share the same set of hypercube polynomials. The minimal example of this is the following pair of trees:

Letting \(M_i(T)\) denote the multiset of pairs \((\operatorname {int}(X),\operatorname {ext}(X))\) across all subsets \(X\subseteq V(T)\), where \(|X|=i\), we have the following implications between hypercube polynomials and sections of the generalized degree sequence. An arrow \(A(T)\implies B(T)\) indicates that for two trees \(T_1,T_2\), where \(A(T_1)=A(T_2)\) it is always the case that \(B(T_1)=B(T_2)\). An arrow \(A(T)\overset{?}{\implies }\ B(T)\) indicates that \(A(T)\implies B(T)\) has been confirmed to hold for trees T, where \(|V(T)| \le 20\). In the diagram below, for all implications, we consider only when \(i\le \lfloor \frac{|V(T)|}{2}\rfloor \), as we have established the amount of data in \(M_i(T)\) decreases past that point:

As mentioned above, the vertical arrows \(M_j(T)\implies \pi _T^{(Q_j)}(k)\) are justified by Theorem 4.3. When \(j=1\), the reverse implication \(\pi _T^{(Q_1)}(k)\implies M_1(T)\) amounts to the statement that degree sequence of a tree can be recovered from the chromatic pairs polynomial [3, Theorem 5.1]. Since \(\pi _T(k)=k(k-1)^{|V(T)|-1}\), the implication \(\pi _T^{(Q_1)}(k)\implies \pi _T(k)\) is immediate. Next, we verify the only remaining implication from the diagram.
Proposition 5.1
We have \(M_2(T) \implies M_1(T)\).
Proof
The given multiset \(M_2(T) = \{(\operatorname {int}(X), \operatorname {ext}(X))\}\) uniquely determines the multiset \(D(T) = \{\deg (u) + \deg (v) \mid \{u,v\} \in \left( {\begin{array}{c}V(T)\\ 2\end{array}}\right) \}\), since \(\deg (u)+\deg (v) = \operatorname {ext}(\{u,v\}) + 2\operatorname {int}(\{u,v\})\). We show D(T) determines the degree sequence \(M_1(T) = d(T)\).
Let \(\#(i,S)\) denote the number of occurrences of the element i in the multiset S. The size \(|D(T)| = \left( {\begin{array}{c}n\\ 2\end{array}}\right) \) determines \(n=|V(T)|\). Assume \(n \ge 2\). The count \(\#(2, D(T)) = \left( {\begin{array}{c}\#(1,d(T))\\ 2\end{array}}\right) \), as any pair of vertices in T whose degrees add to 2 must both be leaves. This allows us to determines the number of leaves \(\#(1,d(T))\).
We proceed by strong induction on \(k \ge 2\) to determine \(\#(k,d(T))\), assuming \(\#(i,d(T))\) are determined for all \(1 \le i<k\). The count \(\#(k+1, D(T))\) can be expressed as
The term in this sum corresponding to \((i,j) = (1,k)\) is \(\#(1, d(T))\#(k, d(T))\). All other terms correspond to pairs (i, j) with \(1 < i \le j\). For these terms, \(i\le j \le k-1\). Thus, all terms in the sum, except for \(\#(1, d(T))\#(k, d(T))\), depend only on counts \(\#(i', d(T))\), where \(i' < k\). By the induction hypothesis, these counts are known. Therefore, \(\#(1, d(T))\#(k, d(T))\) is known, and since \(\#(1, d(T))\) is known, we can uniquely determine the value of \(\#(k,d(T))\).
Thus, D(T) determines \(d(T) = M_1(T)\). Since \(M_2(T)\) determines D(T), the result follows. \(\square \)
To prove that trees with identical 4-dimensional hypercube polynomials need not have identical 3-dimensional cube polynomials, we present the following pair of trees for which this is the case:

We present the following pair of trees \(T_1\) and \(T_2\) for which \(\pi ^{(Q_3)}_{T_1}(k) = \pi ^{(Q_3)}_{T_2}(k)\), but \(M_3(T_1)\ne M_3(T_2)\)

However, in \(T_1\), there are only 2 triplets of vertices with 2 internal edges and 6 external edges, and in \(T_2\) there are 3 such triplets.
Next, we describe connections to the chromatic symmetric function (CSF) of a tree. We begin by recalling the definition of the CSF. If a graph G has the vertex set \(\{v_1, \ldots , v_n\}\), the CSF of G is defined by a power series in infinitely many variables:
where the sum ranges over all proper colorings \(c:V(G)\rightarrow \mathbb {N}\). Stanley asked whether two trees sharing the same CSF must be isomorphic in [8]. Recently, [4] proved that if two trees share the same CSF, then they share the same generalized degree sequence, confirming Crew’s conjecture [6]. Since \(\pi _{T}^{(Q_d)}\) is determined by the generalized degree sequence, we have the following consequence.
Corollary 5.2
If \(T_1\) and \(T_2\) are two trees with the same CSF, then \(\pi _{T_1}^{(Q_d)} = \pi _{T_2}^{(Q_d)}\) for all \(d\ge 0\).
To address Stanley’s question, it would be helpful to extend Corollary 5.2 to conclude equality \(\pi _{T_1}^{(H)} = \pi _{T_2}^{(H)}\) for other graphs H.
In [2], it is shown that \(\mathcal {C}_3(T)\) contains a special subgraph which is not present in a 3-coloring graph of any other tree. In particular, for a tree T on n vertices, there exists a graph H(T) on \(\left( {\begin{array}{c}n\\ 2\end{array}}\right) +2\) vertices and \(n^2-2n+2\) edges, such that \(\pi ^{(H(T))}_T(3)>0\). However, for any other tree G on at most n vertices, \(\pi ^{(H(T))}_G(3)=0\). Thus, the infinite family of polynomials \(\{\pi ^{(H(T))}\}_{T}\) is a complete tree invariant. Recovering \(\pi ^{(H(T))}\) from \(X_T\) would answer Stanley’s question in the affirmative.
To differentiate all trees on n vertices or fewer, the number of polynomials to check using this method grows exponentially in n. This is because there is a bijection \(T \leftrightarrow H(T)\) between trees and their associated polynomials. By reducing the number of polynomials to check, it may become more tractable to extract them from the CSF.
6 Counterexample to Conjecture 5.2 of Asgarli et al.
In this section, we demonstrate the computational advantages of the shadow graph method of counting induced subgraphs over previous methods, especially for smaller graphs. When enumerating graphs in order of vertex count and edge count, chromatic polynomial calculations benefit from knowledge of chromatic polynomials of graphs with fewer vertices or edges. For a shadow graph \(G_{f,\textbf{x}}\), if we can find an edge e with both endpoints outside \(\textbf{x}\), then deletion-contraction terminates in two steps. Contracting e yields the shadow graph of G/e, which is known, since G/e has fewer vertices, while deleting e yields the shadow graph of \(G\setminus e\), which is known, since \(G\setminus e\) has fewer edges. The number of chromatic polynomials necessary to construct \(\pi ^{(K_2)}_G\) grows linearly with the order of G, making calculation of \(\pi ^{(K_2)}_G\) using shadow graphs relatively inexpensive compared to previous methods. This computational advantage has allowed us to perform a deeper direct search of chromatic pairs polynomials and find a counterexample to a conjecture posed by Asgarli et al.
6.1 Statement of the Conjecture
Asgarli et al. state the following conjecture in their work:
Conjecture 5.2 (Asgarli et al. [3]): If two graphs \(G_1\) and \(G_2\) satisfy \(\pi _{G_1}^{(K_2)}(k) = \pi _{G_2}^{(K_2)}(k)\), then \(\pi _{G_1}(k) = \pi _{G_2}(k)\).
This conjecture suggests that if two graphs have identical chromatic pairs polynomials, they must also have identical chromatic polynomials. Indeed no counterexample was found on graphs G of order at most 7. We present a counterexample to this conjecture using two graphs of order 8 with equal \(\pi ^{(K_2)}(k)\) but differing \(\pi (k)\).
6.2 The Counterexample Graphs
We present the two graphs \( G_1 \) and \( G_2 \) that form our counterexample (Fig. 1).
The chromatic pairs polynomials of both graphs are as follows:
The chromatic polynomials of the graphs are:
As seen, \(\pi _{G_1}(k) \ne \pi _{G_2}(k)\).
Another counterexample involving connected graphs is the following:

7 Conclusion
In this paper, we introduced a novel method based on shadow graphs to explicitly compute the polynomials \(\pi _G^{(H)}(k)\), counting induced copies of a graph H within the k-coloring graph \(\mathcal {C}_k(G)\) of a base graph G. This method provides a constructive proof for the polynomial nature of \(\pi _G^{(H)}(k)\), complementing existing proofs by Asgarli et al. [3] and Hogan et al. [7]. We demonstrated the practicality of this construction conceptually by determining the strength of all hypercube counting polynomials as tree invariants, as well as computationally by implementing the chromatic pairs polynomial to find a counterexample to a conjecture by Asgarli et al. [3]. Looking ahead, there are several avenues for future research. The connection between \(\pi _T^{(Q_d)}(k)\) and the generalized degree sequence, combined with the recent result that the CSF determines the generalized degree sequence, naturally leads to Corollary 5.2. Determining which other \(\pi _T^{(H)}(k)\) polynomials can be readily determined from the CSF would likely further illuminate the potential of the CSF as a complete tree invariant.
Overall, shadow graphs provide a powerful and explicit tool for exploring the structure of coloring graphs and their connection to fundamental graph invariants. The results presented here open up new computational possibilities and theoretical questions about graph colorings, reconfiguration problems, and graph invariants.
Data Availability
No data sets were used in the current manuscript.
References
Francisco Alvarado, Ashley Butts, Lauren Farquhar, and Heather M Russell, Forbidden subgraphs of coloring graphs, Involve, a Journal of Mathematics 11(2), 311–324 (2017).
Shamil Asgarli, Sara Krehbiel, and Howard W. Levinson, Coloring graphs as complete graph invariants, arXiv e-prints (2025), available at https://arxiv.org/abs/2504.20978.
Shamil Asgarli, Sara Krehbiel, Howard W. Levinson, and Heather M. Russell, Counting subgraphs of coloring graphs, Graphs Combin. 41 (2025), no. 4, Paper No. 82, 38. MR493147720
José Aliste-Prieto, Jeremy L. Martin, Jennifer D. Wagner, and José Zamora, Chromatic symmetric functions and polynomial invariants of trees, Bull. Lond. Math. Soc. 56 (2024), no. 11, 3452–3476. MR4828026
George D. Birkhoff, A determinant formula for the number of ways of coloring a map, Ann. of Math. (2) 14 (1912/13), no. 1–4, 42–46. MR1502436
Logan Crew, Vertex-weighted generalizations of chromatic symmetric functions, Ph.D. Thesis, 2020 (English).
Emma Hogan, Alex Scott, Youri Tamitegama, and Jane Tan, A Note on Graphs of k-Colourings, Electron. J. Combin. 31 (2024), no. 4, Paper No. 4.48. MR4831821
Richard P Stanley, A symmetric function generalization of the chromatic polynomial of a graph, Advances in Mathematics 111(1), 166–194 (1995).
Acknowledgements
I gratefully acknowledge the support of Santa Clara University through a research stipend I received during Summer 2024, which made this work possible. This funding was administered via the REAL (Research Experience for Advanced Learning) program. I also wish to acknowledge the honor of receiving the Rick Scott Memorial Scholarship. I am also grateful to the anonymous referee for their valuable feedback that improved the exposition.
Funding
Open access funding provided by SCELC, Statewide California Electronic Library Consortium
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The author declares that there is no conflict of interest arising from this work.
Additional information
Communicated by Kolja Knauer.
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
MacLean, S. Counting Subgraphs of Coloring Graphs Using Shadow Graphs. Ann. Comb. (2026). https://doi.org/10.1007/s00026-026-00809-x
Received:
Accepted:
Published:
Version of record:
DOI: https://doi.org/10.1007/s00026-026-00809-x


