Parameterised and Fine-grained Subgraph Counting, modulo $2$

Given a class of graphs $\mathcal{H}$, the problem $\oplus\mathsf{Sub}(\mathcal{H})$ is defined as follows. The input is a graph $H\in \mathcal{H}$ together with an arbitrary graph $G$. The problem is to compute, modulo $2$, the number of subgraphs of $G$ that are isomorphic to $H$. The goal of this research is to determine for which classes $\mathcal{H}$ the problem $\oplus\mathsf{Sub}(\mathcal{H})$ is fixed-parameter tractable (FPT), i.e., solvable in time $f(|H|)\cdot |G|^{O(1)}$. Curticapean, Dell, and Husfeldt (ESA 2021) conjectured that $\oplus\mathsf{Sub}(\mathcal{H})$ is FPT if and only if the class of allowed patterns $\mathcal{H}$ is"matching splittable", which means that for some fixed $B$, every $H \in \mathcal{H}$ can be turned into a matching (a graph in which every vertex has degree at most $1$) by removing at most $B$ vertices. Assuming the randomised Exponential Time Hypothesis, we prove their conjecture for (I) all hereditary pattern classes $\mathcal{H}$, and (II) all tree pattern classes, i.e., all classes $\mathcal{H}$ such that every $H\in \mathcal{H}$ is a tree. We also establish almost tight fine-grained upper and lower bounds for the case of hereditary patterns (I).


Introduction
The last two decades have seen remarkable progress in the classification of subgraph counting problems: Given a small pattern graph H and a large host graph G, how often does H occur as a subgraph if G? Since it was discovered that subgraph counts from small patterns reveal global properties of complex networks [26,27], subgraph counting has also found several applications in fields such as biology [2,33] genetics [35], phylogeny [25], and data mining [36]. Moreover, the theoretical study of subgraph counting and related problems has led to many deep structural insights, establishing both new algorithmic techniques and tight lower bounds under the lenses of fine-grained and parameterised complexity theory [19,16,10,14,13,6,4]. Without any additional restrictions, the subgraph counting problem is infeasible. The complexity class #W [1] is the parameterised complexity class analogous to NP (see Section 2 for more detail). Under standard assumptions, problems that are #W [1]-hard are not fixed-parameter tractable (FPT). The canonical complete problem for #W [1], the problem of counting k-cliques, corresponds to the special case of the subgraph counting problem where H is a clique of size k. This problem cannot be solved in time f (k) · n o(k) for any function f unless the Exponential Time Hypothesis (ETH) fails [8,9]. Due to this hardness result, the research focus in this area shifted to the question: Under which restrictions on the patterns H and the hosts G is algorithmic progress possible? More precisely, under which restrictions can the problem be solved in time f (|H|) · |G| O (1) , for some computable function f ? Instances that can be solved within such a run time bound are called fixed-parameter tractable (FPT); allowing a potential super-polynomial overhead in the size of the pattern |H| formalises the assumption that H is assumed to be (significantly) smaller than G.
If only the patterns are restricted, then the situation is fully understood. Formally, given a class H of patterns, the problem #Sub(H) asks, given as input a graph H ∈ H and an arbitrary graph G, to compute the number of subgraphs of G that are isomorphic to H. Following initial work by Flum and Grohe [19] and by Curticapean [11], Curticapean and Marx [14] proved that, under standard assumptions, #Sub(H) is FPT if and only if H has bounded matching number, that is, if there is a positive integer B such that the size of any matching in any graph in H is at most B. They also proved that all FPT cases are polynomial-time solvable.
In stark contrast, almost nothing is known for the decision version Sub(H). Here, the task is to correctly decide whether there is a copy of H ∈ H in G, rather than to count the copies. It is known that Sub(H) is FPT whenever H has bounded treewidth (see e.g. [20,Chapter 13]), and it is conjectured that those are all FPT cases. However, resolving this conjecture belongs to the "most infamous" open problems in parameterised complexity theory [18,Chapter 33.1].

Counting Modulo 2
To interpolate between the fully understood realm of (exact) counting and the barely understood realm of decision, Curticapean, Dell and Husfeldt proposed the study of counting subgraphs, modulo 2 [12]. Formally, they introduced the problem ⊕Sub(H), which expects as input a graph H ∈ H and an arbitrary graph G, and the goal is to compute modulo 2 the number of subgraphs of G isomorphic to H.
The study of counting modulo 2 received significant attention from the viewpoint of classical, structural, and fine-grained complexity theory. For example, one way to state Toda's Theorem [34] is PH ⊆ P ⊕P , implying that counting satisfying assignments of a CNF, modulo 2, is at least as hard as the polynomial hierarchy. Another example is the quest to classify the complexity of counting modulo 2 the homomorphisms to a fixed graph, which was very recently resolved by Bulatov and Kazeminia [7]. There has also been work by Abboud, Feller, and Weimann [1] on the fine-grained complexity of counting modulo 2 the number of triangles in a graph that satisfy certain weight constraints.
In their work [12], Curticapean, Dell and Husfeldt proved that the problem of counting k-matchings modulo 2, that is, the problem ⊕Sub(H) where H is the class of all 1-regular graphs, is fixed-parameter tractable, where the parameter k is |H|. Since the exact counting version of this problem is #W [1]-hard [11], their result provides an example where counting modulo 2 is strictly easier than exact counting (subject to complexity assumptions). The complexity class ⊕W [1] can be defined via the complete problem of counting k-cliques modulo 2. Crucially, ⊕W [1]-hard problems are not fixed-parameter tractable, unless the randomised ETH (rETH) fails. Curticapean et al. [12] proved that counting k-paths modulo 2 is ⊕W[1]-hard. Since finding a k-path in a graph G is fixed-parameter tractable via colourcoding [3], this hardness result provides an example where counting modulo 2 is strictly harder than decision (subject to complexity assumptions). Combining those observations, it appears that counting subgraphs modulo 2 may lie strictly in between the complexity of decision and the complexity of exact counting.
A matching is a graph whose maximum degree is at most 1. The matching-split number of a graph H is the minimum size of a set S ⊆ V (H) such that H \ S is a matching. A class of graphs H is called matching splittable if there is a positive integer B such that the matchingsplit number of any H ∈ H is at most B. For example, the class of all matchings is matching splittable while the class of all cycles is not. Curticapean, Dell and Husfeldt extended their FTP algorithm for counting k-matchings modulo 2 to obtain an FPT algorithm for ⊕Sub(H) for any matching-splittable class H. On this basis, they then made the following conjecture.

▶ Conjecture 1 ([12]). ⊕Sub(H) is FPT if and only if H is matching splittable.
A class H of graphs is called hereditary if it is closed under vertex removal. Intriguingly, if Conjecture 1 is true, then the FPT criterion for counting subgraphs modulo 2 (⊕Sub(H)) would coincide with the polynomial-time criterion for finding subgraphs (Sub(H)) for hereditary pattern classes H as established by Jansen and Marx.
▶ Theorem 2 ([24]). Let H be a hereditary class of graphs and assume P ̸ = NP. Then

Sub(H) is solvable in polynomial time if and only if H is matching splittable.
Jansen and Marx also conjecture that the condition of H being hereditary can be removed.

Conjectures 1 and 3 have the remarkable consequence that ⊕Sub(H) is FPT if and only
if Sub(H) is solvable in polynomial time. In the current work we establish this consequence for all hereditary pattern classes.

Our Contributions
We resolve Conjecture 1 for all hereditary classes H, as well as for every class H consisting only of trees; note that the upper bounds were shown in [12] and that the lower bounds are the novel part. The requirement that the class of trees T needs to be recursively enumerable is a standard technicality -the reason for it is that the function f in the running time in the standard definition of an FPT algorithm is required to be computable. It turns out that having T recursively enumerable is enough for this.
In order to prove our classifications, we adapt the by-now-standard technique for analysing subgraph counting problems established by Curticapean, Dell and Marx [13]. Let #Sub(H → G) denote the number of subgraphs of a graph G that are isomorphic to a graph H and let #Hom(F → G) denotes the number of homomorphisms (edge-preserving mappings) from a graph F to a graph G. Given a graph H, there is a function a H from graphs to rationals with finite support such that the following holds for any graph G: where the sum is over all (isomorphism types of) graphs. Since a H has finite support, a H (F ) = 0 for all but finitely-many graphs F . Thus, equation (1) allows us to express the solution to the exact counting problem as a finite linear combination of homomorphism counts. In a nutshell, the framework of [13] states that computing the function G → #Sub(H → G) is hard to compute if and only if there is a graph F of high treewidth with a H (F ) ̸ = 0. This translates the complexity of (exact) subgraph counting to the purely combinatorial problem of understanding the coefficients a H . One might hope that this strategy transfers to counting modulo 2 as well. Unfortunately, this is not possible as Equation (1) might not be well-defined if arithmetic is done modulo 2. The reason for this is the fact that the coefficients a H (F ) are of the form µ(F, H) × |Aut(H)| −1 , where µ(F, H) is an integer, and Aut(H) is the automorphism group of the graph H [13]. Thus there is, a priori, no hope to extend the framework to counting modulo 2 for pattern graphs with an even number of automorphisms. In fact, according to Curticapean, Dell and Husfeldt [12], the absence of a comparable framework for counting modulo 2 is one of the main challenges for establishing the hardness part of Conjecture 1, and it is the main reason why the reductions in [12] use more classical, gadget-based reductions.
In this work, we solve the problem of patterns with an even number of automorphisms by considering a colourful intermediate problem. More concretely, we will equip each edge of the pattern H with a distinct colour and show that it will be sufficient to consider only automorphisms that preserve the colours. If H has no isolated vertices, then this is only the trivial automorphism. Formally, the coloured approach will be based on the notion of so-called fractured graphs introduced by Peyerimhoff et al. [30].

Organisation of the Paper
We start by introducing some basic terminology in Section 2. The formal definitions of our graph colourings, as well as colour-preserving homomorphisms and embeddings can be found in Section 2.1, and the majority of the paper will consider the coloured setting as it allows us to get rid of automorphism groups of even size. This is formalised in Section 2.2 using the framework of fractured graphs originally introduced in [30]. An introduction to parameterised and fine-grained complexity theory, including the definition of our computational problems and the statement of the randomised Exponential Time Hypothesis, can be found in Section 2.3; moreover, this section contains a self-contained and formal exposition of the complexity monotonicty principle for coloured graphs in the modular setting, stating intuitively that the computation, modulo 2, of a finite linear combination of homomorphism counts between coloured graphs is precisely as hard as computing, modulo 2, the hardest term with an odd coefficient. Additionally, Section 2.3 contains the formal statement of the reduction from the coloured setting to the uncoloured setting via the principle of inclusion and exclusion. Note that this reduction is necessary for obtaining our main results (Theorems 4 and 5), which classify the complexity of the uncoloured problem ⊕Sub(H).
Having completed the set-up, we continue in Section 3 with the treatment of ⊕Sub(H) for hereditary H, i.e., with the proof of Theorem 4. We note that, on a technical level, understanding the hereditary case is much easier than the case of trees. However, almost all of the key techniques and ideas that become necessary to classify the case of trees are already used in Section 3, although in a much simpler way. For this reason, we consider Section 3 also as a warm-up for getting used to the framework of fractured graphs. Concretely, we can outline our treatment of hereditary classes as follows: Using a result of Jansen and Marx [24], each hereditary class of graphs H is either matching splittable, or it fully contains one of the following four subclasses: (I) The class of all cliques, (II) the class of all bicliques, (III) the class of all triangle packings (disjoint unions of triangles), or (IV) the class of all P 2 -packings (disjoint unions of paths with two edges). For proving the classification of ⊕Sub(H) for hereditary H (Theorem 4), it thus suffices to show that each of the four cases (I) -(IV) is hard. Since the problems of deciding whether a graph contains a k-clique or whether a graph contains a k-by-k-biclique are already hard, the problem of counting their respective occurences modulo 2 (cases (I) and (II)) can easily shown to be hard using a variation of the Isolation Lemma due to Williams et al. [37]. The majority of Section 3 is thus dedicated to establishing hardness for triangle packings (III) in Section 3.1 and for P 2 -packings (IV) in Section 3.2.
The classification of ⊕Sub(T ) for classes of trees T (Theorem 5) can be found in Section 4. In the first step, we establish a graph-theoretical classification of classes of trees that are not matching splittable. To this end, we first introduce three structural invariants of trees (the definitions are rather technical and can be found right at the beginning of Section 4): The fork number, the star number, and the C-number. We then show that each class T of trees is either matching splittable, or it satisfies at least one of the following properties: (1) T has unbounded C-number, (2) T has unbounded star number, or (3) T has unbounded fork number.
The central steps of the proof of Theorem 5 are then hardness proofs for the previous three cases: Case (1) is treated in Section 4.1, Case (2) is treated in Section 4.2, and Case (3) is treated in Section 4.3. Finally, we collect the intractabilty results for all cases in Section 4.4 to prove Theorem 5.

Preliminaries
Let f : A 1 × A 2 → B be a function. For each a 1 ∈ A 1 we write f (a 1 , ⋆) : A 2 → B for the function that maps a 2 ∈ A 2 to f (a 1 , a 2 ). Graphs in this work are undirected and without self loops. A homomorphism from a graph H to a graph G is a mapping φ from the vertices V (H) of H to the vertices V (G) of G such that for each edge and Emb(H → G) for the sets of homomorphisms and embeddings, respectively, from H to G. An embedding φ ∈ Emb(H → G) is called an isomorphism if it is bijective and We say that H and G are isomorphic, denoted by H ∼ = G, if an isomorphism from H to G exists. A graph invariant ι is a function from graphs to rationals such that ι(H) = ι(G) for each pair of isomorphic graphs H and G.
. We write Sub(H → G) for the set of all subgraphs of G that are isomorphic to H. Given a subset of vertices S ⊆ V (G) of a graph G, we write G[S] for the graph induced by S, that is, G[S] has vertices S and edges {{u, v} ⊆ S | {u, v} ∈ E(G)}.
We denote by tw(G) the treewidth of the graph G. Since we will rely on treewidth purely in a black-box manner, we omit the technical definition and refer the reader to [15,Chapter 7].
Given any graph invariant ι (such as treewidth) and a class of graphs G, we say that ι is bounded in G if there is a non-negative integer B such that, for all G ∈ G, ι(G) ≤ B. Otherwise we say that ι is unbounded in G.
Given a graph H = (V, E), a splitting set of H is a subset of vertices S such that every vertex in H[V \ S] has degree at most 1. The matching-split number of H is the minimum size of a splitting set of H. A class of graphs H is called matching splittable if the matching-split number of H is bounded.

Colour-Preserving Homomorphisms and Embeddings
A homomorphism c from a graph G to a graph Q is sometimes called a "Q-colouring" of G. A Q-coloured graph is a pair consisting of a graph G and a homomorphism c from G to Q. Note that the identity function id Q on V (Q) is a Q-colouring of Q. If a homomorphism c from G to Q is vertex surjective, then we call (G, c) a surjectively Q-coloured graph.
Notation: Given a Q-coloured graph (G, c) and a vertex u ∈ V (Q), we will use the capitalised letter U to denote the subset of vertices of G that are coloured by c with u, that is, We note the special case in which Q = H and c H is the identity id Q ; then the condition simplifies to c G (φ(v)) = v. A colour-preserving embedding of (H, c H ) in (G, c G ) is a vertex injective colourpreserving homomorphism from (H, c H ) to (G, c G ). We write Hom((H, c H ) → (G, c G )) and Emb((H, c H ) → (G, c G )) for the sets of all colour-preserving homomorphisms and embeddings, respectively, from (H, c H ) to (G, c G ).
Let k be a positive integer, let H be a graph with k edges, and let (G, γ) be a pair consisting of a graph G and a function that maps each edge of G to one of k distinct colours. We refer to γ as a "k-edge colouring" of G. For example, in most of our applications we will fix a graph Q with k edges and a Q-colouring c of G and we will take γ to be the edge-colouring c E from Definition 6. We write ColSub(H → (G, γ)) for the set of all subgraphs of G that are isomorphic to H and that contain each of the k edge colours precisely once.

Fractures and Fractured Graphs
In this work, we will crucially rely on and extend the framework of fractured graphs as introduced in [30].
Note that a fracture describes how to split (or how to fracture) each vertex of a given graph: for each vertex v, create a vertex v B for each block B in the partition ρ v ; edges originally incident to v are made incident to v B if and only if they are contained in B. We call the resulting graph the fractured graph H ♯ ρ; a formal definition is given in Definition 8, a visualisation is given in Figure 1. ▶ Definition 9 (Canonical Q-colouring c ρ ). Let Q be a graph and let ρ be a fracture of Q.
Observe that c ρ is the identity in V (Q) if ρ is the coarsest fracture (that is, each partition ρ v only contains one block, in which case Q ♯ ρ = Q).
A parameterised Turing-reduction from (P, κ) to (P ′ , κ ′ ) is an FPT algorithm for (P, κ) that is equipped with oracle access to P ′ and for which there is a computable function g such that, on input x, each oracle query y satisfies κ ′ (y) ≤ g(κ(x)). We write (P, κ) ≤ fpt T (P ′ , κ ′ ) if a parameterised Turing-reduction from (P, κ) to (P ′ , κ ′ ) exists. This guarantees that fixed-parameter tractability of (P ′ , κ ′ ) implies fixed-parameter tractability of (P, κ). For a more comprehensive introduction, we refer the reader the standard textbooks [15] and [20].

Counting modulo 2 and the rETH
The lower bounds in this work will rely on the hardness of the parameterised complexity class ⊕W [1], which can be considered a parameterised equivalent of ⊕P. Following [12], we define ⊕W [1] via the complete problem ⊕Clique: Given as input a graph G and a positive integer k, the goal is to compute the number of k-cliques in G modulo 2, i.e., to compute ⊕Sub(K k → G). The problem is parameterised by k. A parameterised problem (P, κ) is called ⊕W[1]-hard if ⊕Clique ≤ fpt T (P, κ), and it is called ⊕W[1]-complete if, additionally, (P, κ) ≤ fpt T ⊕Clique.
Modifications of the classical Isolation Lemma (see e.g. [5] and [37]) yield a randomised parameterised Turing reduction from finding a k-clique to computing the parity of the number of k-cliques. In combination with existing fine-grained lower bounds for finding a k-clique [8,9], it can then be shown that ⊕Clique cannot be solved in time f (k) · |G| o(k) for any function f , unless the randomised Exponential Time Hypothesis fails: ▶ Definition 10 (rETH, [23]). The randomised Exponential Time Hypothesis (rETH) asserts that 3-SAT cannot be solved by a randomised algorithm in time exp o(n), where n is the number of variables of the input formula.
As an immediate consequence, the rETH implies that ⊕W[1]-hard problems are not fixedparameter tractable.
For the lower bounds in this work, we won't reduce from ⊕Clique directly, but instead from the following, more general problem: ▶ Definition 11 (⊕cp-Hom). Let H be a class of graphs. The problem ⊕cp-Hom(H) has as input a graph H ∈ H and a surjectively H-coloured graph (G, c). The goal is to compute ⊕Hom((H, id H ) → (G, c)). The problem is parameterised by |H|.
The following lower bound was proved independently in [28,30] and [12]. For example, writing K for the set of all complete graphs, the problem ⊕Sub(K) is equivalent to ⊕Clique.

Complexity Monotonicity and Inclusion-Exclusion
Throughout this work, we will rely on two important tools introduced in [30]. For the sake of being self-contained, we encapsulate them below in individual lemmas.
The first tool is an adaptation of the so-called Complexity Monotonicity principle to the realm of fractured graphs and modular counting (see [30,Sections 4.1 and 6.3] for a detailed treatment and for a proof). Intuitively, the subsequent lemma states that evaluating, modulo 2, a linear combination of colour-prescribed homomorphism counts from fractured graphs, is as hard as evaluating its hardest term with an odd coefficient.
▶ Lemma 14 ([30]). There is a deterministic algorithm A and a computable function f such that the following conditions are satisfied: 1. A expects as input a graph Q and a Q-coloured graph (G, c).

A is equipped with oracle access to a function
where the sum is over all fractures of Q and a is a function from fractures of Q to integers. 3. Each oracle query (G ′ , c ′ ) is of size at most f (|Q|) · |G|.

The running time of A is bounded by
The second tool is a standard application of the inclusion-exclusion principle (see e.g. [30,Sections 4.2 and 6.3]). It will be used in the final steps of our reductions to remove the colourings.
▶ Lemma 15 ([30]). There is a deterministic algorithm A that satisfies the following conditions: 1. A expects as input a graph H with k edges, a graph G and a k-edge colouring γ of G.

Classification for Hereditary Graph Classes
In this section, we will completely classify the complexity of ⊕Sub(H) for hereditary classes. Let us start by restating the classification theorem. for any function f .
The proof of Theorem 4 is split in four cases, which stem from a structural property of non matching splittable hereditary graph classes H due to Jansen and Marx [24]. For the statement, we need to consider the following classes: F ω is the class of all complete graphs. F β is the class of all complete bipartite graphs. F P2 is the class of all P 2 -packings, that is, disjoint unions of paths with two edges. 1 F K3 is the class of all triangle packings, that is, disjoint unions of the complete graph of size 3.
▶ Theorem 16 (Theorem 3.5 in [24]). Let H be a hereditary class of graphs. If H is not matching splittable then at least one of the following are true: Thus, it suffices to consider cases 1. -4. to prove Theorem 4. We start with the easy cases of cliques and bicliques; they follow implicitly from previous works [12,17,28] and we only include a proof for completeness. Note that a tight bound under rETH is known for those cases:  [12]. For the rETH lower bound, we can reduce from the problem of deciding the existence of a k-clique via a (randomised) reduction using a version of the Isolation Lemma due to Williams et al. [37,Lemma 2.1]. This reduction does not increase k or the size of the host graph and is thus tight with respect to the well-known lower bound for the clique problem due to Chen et al. [8,9]: Deciding the existence of a k-clique in an n-vertex graph cannot be done in time f (k) · n o(k) for any function f , unless ETH fails. Our lower bound under rETH follows since the reduction is randomised.
If F β ⊆ H, then the claim holds by [17,Theorem 5], which established the problem of counting, modulo 2, the induced copies of a k-by-k-biclique in an n-vertex bipartite graph to be ⊕W[1]-hard and not solvable in time f (k) · n o(k) for any function f , unless rETH fails. Since a copy of a biclique (with at least one edge) in a bipartite graph must always be induced, the claim follows. This concludes the proof of Lemma 17. ◀ The more interesting cases are F P2 ⊆ H and F K3 ⊆ H. One reason for this is that, in contrast to cliques and bicliques, the decision version of those instances are fixed-parameter tractable. Hence a reduction from the decision version via e.g. an isolation lemma does not help. In other words, establishing hardness for those cases requires us to rely on the full power of counting modulo 2. More precisely, we will rely on the framework of fractures graphs (see Section 2). Both cases can be considered simpler applications of the machinery used in the later sections, so we will present all steps in great detail. While this might seem unnecessary given the simplicity of the constructions, we hope that it enables the reader to make themselves familiar with the general reduction strategies which will be used throughout the later sections of this work.

Triangle Packings
The goal of this subsection is to establish hardness of ⊕Sub(F K3 ). To this end, let ∆ be an  Next, we use that tw(L(H)) = Ω(tw(H)) (see e.g. [22]). Moreover, tw(L(H)) ≤ |V (L(H))| since the treewidth of a graph is always bounded by the number of its vertices. Additionally, |V (L(H))| = |E(H)| by construction. Since the graphs in ∆ are cubic, we further have that |E(H)| = Θ(|V (H)|) for H ∈ ∆. We combine those bounds with the fact that expander graphs have treewidth linear in the number of vertices (see e.g. [21]); therefore ∆ and thus Q have unbounded treewidth. Putting these facts together, we obtain the following. We are now able to establish hardness of ⊕Sub(F K3 ). The proof will heavily rely on the transformation from edge-coloured subgraphs to homomorphisms established in [30]. Let L and (G, c) be an input instance to ⊕cp-Hom(Q). Recall that ∆ is computablethat is, there is an algorithm that takes a graph H and determines whether it is in ∆. Thus, there is an algorithm that takes input L ∈ Q and finds a graph H ∈ ∆ with L = L(H). The run time of this algorithm depends on |L| but clearly not on (G, c). Let k = |V (H)| and note that |E(L(H))| = 3k, since, by construction, each vertex v of H becomes a triangle of L(H). We consider the graph G as a 3k-edge-coloured graph, coloured by c E . That is, each edge e = {x, y} of G is assigned the colour c E (e) = {c(x), c(y)} which is an edge of L (see Figure 2 for an illustration). Now, for any L-coloured graph (G ′ , c ′ ) recall that ColSub(kK 3 → (G ′ , c ′ E )) is the set of subgraphs of G ′ that are isomorphic to kK 3 and that include each edge colour (each edge of L) precisely once. We will see later that ⊕ColSub(kK 3 → (G ′ , c ′ E )) can be computed using our oracle for ⊕Sub(F K3 ) using the principle of inclusion and exclusion.
It was shown in [30, Lemma 4.1] that there is a unique function a such that for every where the sum is over all fractures of L. Additionally, it was shown in [30,Corollary 4.3] that where ⊤ is the fracture in which each partition consists only of one block (that is, L ♯ ⊤ = L), and F(kK 3 , L) is the set of all fractures ρ of L such that L ♯ ρ ∼ = kK 3 . However, note that, by Observation 18, there is only way to fracture L into k disjoint triangles, and this fracture is given by τ (H). Thus, (3) simplifies to Additionally we depict an element S ∈ ColSub(kK3 → (G, cE)), that is, a subgraph of G isomorphic to kK3 that contains each edge colour of G precisely once.
which is odd since each partition of τ (H) consists of precisely two blocks (so in fact the expression in (4) Note that the algorithm for ⊕cp-Hom(Q) is supposed to compute ⊕Hom((L, id L ) → (G, c)) which is equal to ⊕Hom(L ♯ ⊤ → (G, c ⊤ )). Since a(⊤) is odd, we can invoke Lemma 14 to recover this term by evaluating the entire linear combination (2), that is, by evaluating the function ⊕ColSub(kK 3 → ⋆). More concretely, this means that we need to compute ⊕ColSub(kK 3 → (G ′ , c ′ E )) for some L-coloured graphs (G ′ , c ′ ) of size at most f (|L|) · |G| for some computable function f (see 3. in Lemma 14). This can easily be done using Lemma 15 since we have oracle access to the function ⊕Sub(kK 3 → ⋆). We emphasise that, by condition 2. of Lemma 15, each oracle queryĜ satisfies Since, by Fact 20, k = Θ(|kK 3 |) = Θ(|V (L)|) = Θ(tw(L)), our reduction yields ⊕W[1]hardness and transfers the conditional lower bound under rETH as desired. ◀

P 2 -packings
Next we establish hardness for the case of P 2 -packings. The strategy will be similar in spirit to the construction for triangle packings; however, rather then identifying a unique fracture for which the technique applies, we will encounter an odd number of possible fractures in the current section. Let ∆ be a computable infinite class of 4-regular expander graphs, and let Q be the class of all subdivisions of graphs in ∆, that is We start by establishing an easy but convenient fact on the treewidth of the graphs in Q. for H ∈ ∆. Note that this also implies that Q has unbounded treewidth (as ∆ is infinite). ◀ For what follows, given a subdivision H 2 of a graph H, it will be convenient to assume  The following two lemmas are crucial for our construction.  Proof. First observe that |E(H 2 )| = 2|E(H)| = 4|V (H)| = 2k. Thus the number of edges of H 2 ♯ τ is equal to 2k (for each fracture τ of H 2 ), which is also equal to the number of edges of kP 2 .
Thus, H 2 ♯ τ is isomorphic to kP 2 if and only if each connected component of H 2 ♯ τ is a path of length 2. It follows immediately by Definition 23 that τ being odd implies that H 2 ♯ τ consists only of disjoint P 2 . It thus remains to show the other direction.
Assume for contradiction that there is a subdivision vertex s ∈ S E of H 2 such that τ s consists of only one block (recall that s has degree 2, thus τ s either consists of two singleton blocks, or of one block of size 2). Let e = {u, v} ∈ E(H) be the edge corresponding to s, that is, s was created by subdividing e. Since H 2 ♯ τ is a union of P 2 , we can infer that τ v and τ u contain a singleton block (otherwise we would have created a connected component which is not isomorphic to P 2 ). Now recall that both u and v have degree 4, since H is 4-regular. We obtain a contradiction as follows: By assumption of the lemma, we know that τ v and τ u can have at most two blocks. Since we have just shown that both contain a singleton block, it follows that both τ v and τ u contain one further block of size 3. However, a block of size 3 yields a vertex of degree 3 in the fractured graph H 2 ♯ τ , contradicting the fact that H 2 ♯ τ consists only of disjoint P 2 .
Thus we have established that, for each s ∈ S E , the partition τ s consists of two singleton blocks. Given this fact, the only way for H 2 ♯ τ being a disjoint union of P 2 is that each We are now able to prove our hardness result. Let H ′ and (G, c) be an input instance to ⊕cp-Hom(Q). There is an algorithm that takes as input a graph H ′ ∈ Q and finds a graph H ∈ ∆ with H ′ = H 2 -this is basically 2-colouring. The run time of this algorithm depends on |H ′ | but clearly not on (G, c). Let k = 2|V (H)| and note that |E(H 2 )| = 2|E(H)| = 4|V (H)| = 2k. We consider the graph G as a 2k-edge-coloured graph, coloured by c E . That is, ) is the set of subgraphs of G ′ that are isomorphic to kP 2 and that include each edge colour (each edge of H 2 ) precisely once. We will see later that ⊕ColSub(kP 2 → (G ′ , c ′ E )) can be computed using our oracle for ⊕Sub(F P2 ) using the principle of inclusion and exclusion.
It was shown in [30, Lemma 4.1] that there is a unique function a such that, for every where the sum is over all fractures of H 2 . As in Section 3.1 from [30, Corollary 4.3] we know that where ⊤ is the fracture in which each partition consists only of one block and F(kP 2 , H 2 ) is the set of all fractures ρ of H 2 such that H 2 ♯ ρ ∼ = kP 2 . Our next goal is to show that a(⊤) = 1 mod 2. First, suppose that a fracture ρ contains a partition ρ w with at least three blocks. Then (|ρ w | − 1)! = 0 mod 2. Thus such fractures do not contribute to a(⊤) if arithmetic is done modulo 2. Next, note that if, for each w, the partition ρ w contains at most 2 blocks, then Let Odd(kP 2 , H 2 ) be the set of all fractures ρ of H 2 such that H 2 ♯ ρ ∼ = kP 2 and each partition of ρ consists of at most 2 blocks. Our analysis then yields a(⊤) = |Odd(kP 2 , H 2 )| mod 2. Finally, Lemma 25 states that Odd(kP 2 , H 2 ) is precisely the set of odd fractures, and Lemma 24 thus implies that |Odd(kP 2 , H 2 )| = 1 mod 2. Consequently, a(⊤) = 1 mod 2 as well, and we have achieved the goal.
Next we can proceed similarly to the case of triangle packings. As in that case, the goal is to compute ⊕Hom(( Since a(⊤) is odd, we can invoke Lemma 14 to recover this term by evaluating the entire linear combination (5), that is, if we can evaluate the function ⊕ColSub(kP 2 → ⋆). This can be done by using Lemma 15. Each call to the oracle is of the form ⊕Sub( Now recall that k ∈ Θ(|V (H)|). By Lemma 22, we thus have k = Θ(tw(H 2 )). Hence our reduction yields ⊕W[1]-hardness and transfers the conditional lower bound under rETH as desired. ◀ We can now conclude the treatment of hereditary pattern classes by proving Theorem 4, which we restate for convenience. Proof. The fixed-parameter tractability result was shown in [12]. For the hardness result, using the fact that H is not matching splittable and Theorem 16 we obtain four cases.
If H contains all cliques or all bicliques, then hardness follows from Lemma 17.
If H contains all triangle packings, then hardness follows from Lemma 21.
If H contains all P 2 -packings, then hardness follows from Lemma 26. Since the case distinction is exhaustive, the proof is concluded. ◀

Classification for Trees
Our overall goal is to prove Theorem 5, which we restate for convenience:

Outline of Section 4
We begin our analysis by investigating the structural properties of classes of trees that are not matching splittable. In Lemma 32 we prove that for each such class T (at least) one of the following parameters are unbounded: The fork number (Definition 29), the star number (Definition 30), or the C-number (Definition 31). The remainder of this section is then split into three, largely independent, parts: Section 4.1 establishes hardness of ⊕Sub(T ) for classes of trees T of unbounded C-number, Section 4.2 shows hardness for unbounded star number, and Section 4.3 shows hardness for unbounded fork number.
We start by introducing some terminology for trees which will be used in the remainder of this section.
Next we introduce rays, which are restricted 2-paths that will be crucial in our analysis.
We call x 0 the source of the ray. Given a vertex s of degree at least 3, we write deg L,a (s) for the number of rays of length a with source s. We set Next, we introduce parameters F a,b , S c and C d . Our goal is then to show that, for every non-matching-splittable class of trees, at least one of those two parameters is unbounded. ▶ Definition 31 (C-gadgets and C d ). A C-gadget 4 of order d and length k in a tree T is a path x 0 , . . . , x k such that one of the following is true for each inner vertex The C d -number of a tree T , denoted by C d (T ) is the length of the longest C-gadget of order d. Finally, we say that a class of trees T has unbounded C-number if there exists d > 0 such that for every positive integer B, and a tree T ∈ T such that C d (T ) ≥ B.
Note that the ordering of the quantifiers in the definition of the C d -number is different from the ordering in the definition of the c-star-number. This is due to technical reasons which are important for the proof of Lemma 32.
▶ Lemma 32. Let T be a class of trees. If T is not matching splittable, then T has either unbounded fork number, unbounded star number, or unbounded C-number.
Proof. We can assume that there is an overall bound d on the length of 2-paths in trees in T : Otherwise, T already has unbounded C-number (see (i) in Definition 31)). Hence the length of every ray in any tree in T is bounded by d as well. Thus T has unbounded star number if and only if for every positive integer s there is a c ∈ {3, . . . , d} and a tree T ∈ T such that S c (T ) ≥ s. We split the proof into two cases. Case 1. T has unbounded diameter.
In Case 1, we show that T has unbounded fork number or unbounded C-number. If C d is unbounded in T then T has unbounded C-number and we are done so assume that there To this end, we use the premise that T has unbounded diameter. Let k > (h + 2)(Bd 2 + 1) be a positive integer, and let T ∈ T be such that there is a path P = s, p 0 , . . . , p k , t in T . Observe that the deletion of all edges in P decomposes T into a family of disjoint subtrees. We write T i for the subtree that contains p i . Now decompose P into segments P 1 , P 2 , . . . of length h + 2. Note that a segment P j = p j0 , . . . , p j h+2 yields a C-gadget of order d and length > h if and only if T ji is either a star or an isolated vertex for each i ∈ {1, . . . , h + 1}.
Since no such C-gadgets exist by assumption, we obtain that each segment P j of the path P contains a vertex p ij such that T ij is neither a star nor an isolated vertex.
Assume that T ij is rooted at p ij . Since T ij is neither an isolated vertex nor a star, there must be a (proper) descendant v ij of p ij (in T ij ) such that v ij is an (a ij , b ij )-fork for some a ij , b ij ∈ {1, . . . , d}. Now note that there are at most d 2 pairs of integers in {1, . . . , d}. Since we have at least one fork for every segment and since there are at least ⌊k/(h + 2)⌋ > Bd 2 + 1 segments, we thus obtain by the pigeon-hole principle that there is a pair a, b ∈ {1, . . . , d} such that, for at least B segments P ij , the node v ij is an (a, b)-fork in T ij and thus also in T . Since those forks are pairwise non-adjacent, we obtain, as desired, that the (a, b)-fork number of T is at least B, concluding Case 1.

Case 2. T has bounded diameter.
Let D be the assumed upper bound on the diameter of trees in T . If T has unbounded star number then we are finished. Assume instead that T has bounded star number. Then there is a positive integer s such that for all c ∈ {3, . . . , d} and every tree T ∈ T , S c (T ) < s. We will show that T has unbounded fork number. Consider any positive integer B. We will show that there are a, b ∈ {1, . . . , d} and T ∈ T with F a,b (T ) ≥ B.
Let k > (D + 1)(Bd 2 + 1)(d 2 s + 1) be a positive integer. Since T is not matching splittable, there is a tree T ∈ T whose matching-split number is at least k. Note that T is not a path since every path with matching-split number at least k has length greater than k > D, contradicting the bound on the diameter. Now fix any vertex r of T as the root. Given a vertex v of T , we write T v for the subtree rooted at v (assuming that r is the overall root). We call v a rooted fork if T v is a starobserve that each rooted fork must indeed be a fork. Let f be the number of rooted forks. Similar to the argument in Case 1, if f > Bd 2 + 1, then by the pigeon-hole principle there Hence assume for contradiction that f ≤ Bd 2 + 1. Let R be the set of all rays of T and recall that each ray in R is, by definition, a 2-path of the form Note that the source of every ray must either be a rooted fork, or it must lie on a path from the root r to one of the rooted forks.
Let T ′ be the subtree of T induced by all vertices that lie on paths between r and a rooted fork (including r and all rooted forks). Since there are f rooted forks and the depth of T is bounded by D, Consider a vertex v of T ′ . Assume for contradiction that v is the source of > ds long rays (in T ). Recall that for all c ∈ {3, . . . , d} we have that S c (T ) < s. Recall further that each long ray has length d ′ for some 3 ≤ d ′ ≤ d. Thus we obtain a contradiction by the pigeon-hole principle. Now let S be the set containing all vertices of T ′ and all vertices of long rays. Noting that each long ray has length at most d, and that the source of each long ray must be a vertex of T ′ by construction, we can use the observation that each vertex of T ′ is the source of at most ds long rays to (generously) bound Note further that T [V (T ) \ S] consists only of isolated edges and vertices: The only vertices in V (T ) \ S are non-source vertices of rays of length < 3, the sources of which are in T ′ . Thus, S is a splitting set. Finally, recalling that |V (T ′ )| ≤ (D + 1)f ≤ (D + 1)(Bd 2 + 1), we have contradicting the fact that the matching-split number of T is strictly larger than (D + 1)(Bd 2 + 1)(d 2 s + 1). This concludes Case 2, and hence the proof. ◀ In the next three subsections, we will prove hardness of ⊕Sub(T ) for non-matchingsplittable T in each of the three cases given by Lemma 32.

Unbounded C-number
For our hardness proof, it will be useful to find a proper sub-gadget of a C-gadget in a tree. Finally, a strong C-gadget is called closed if neither x i1 nor x i k are forks. 5 Consider the bottom part of Figure 4 for a visualisation. We start with the following lemma which establishes the existence of a strong C-gadget with many junctions inside a long enough C-gadget.
▶ Lemma 34. Let T be a tree such that the longest 2-path in T has length d ≥ 1, and let k be a positive integer. Then there exists L > 0 (only depending on k and d) such that the following is true: If T contains an C-gadget of order d and length L, then there exists 1 ≤ d ′ ≤ d such that T contains a strong C-gadget of order d ′ with at least k junctions.
. If we ever do (1) we are finished. If from d ′ = 1 we do (2) then we find a 2-path of length at least f d (L) > d, which is a contradiction.
Here is how we proceed from H d ′ = y 0 , . . . , y ℓ . We set i 0 = 0. Then iteratively, for each j ∈ {1, . . . , k} we will either construct H d ′ −1 as in (2) or we find i j ∈ {i j−1 + 2d + 1, . . . , ℓ} such that y ij is the source of a length-d ′ ray that does not contain y ij − 1 or y ij + 1. If we succeed in defining i 1 , . . . , i k , i k+1 in this way then y 0 , . . . , y i k+1 is a strong C-gadget with k junctions of order d ′ so (1) is satisfied.
Let us now make this argument rigorous; again, assume that H d ′ = y 0 , . . . , y ℓ is a Cgadget of order d ′ and length ℓ ≥ f d−d ′ (L). Set i 0 = 0 and, starting with j = 0, proceed iteratively as follows: 1. Let S j be the set of all indices i ∈ {i j−1 + 2d + 1, . . . , ℓ} such that y i is the source of a length-d ′ ray that does not contain y i−1 and y i+1 . 2. If S j = ∅ then set stop = j and terminate. Otherwise, set i j = min S j and j ← j + 1, and go back to 1.
We now distinguish two cases: If stop ≥ k + 1, then we found indices i 0 , . . . , i k+1 such thatĤ d ′ := y 0 , . . . , y i k+1 is a strong hardness gadget of order d ′ with k junctions; hence we achieved (1) and we are done. Otherwise we have stop < k + 1. Let I j := {i j , . . . , i j+1 − 1} for all 0 ≤ j < stop, and let I stop = {i stop , . . . , ℓ}. By the pigeon-hole principle, at least one of those intervals, say I j ′ , has size at least ℓ/(stop + 1) ≥ ℓ/(k + 1). Now, by construction of our iterative procedure above, we find that the sub-interval {i j ′ + 2d + 1, . . . , i j ′ +1 − 1} ⊆ I j ′ contains no index i such that y i is the source of a length-d ′ ray that does not contain y i−1 and y i+1 . Thus, the subsequence Hence we achieved (2) and we can conclude this case as well. ◀ Now, by removing the first and the last junction, we can also ensure the existence of a closed strong C-gadget ▶ Corollary 35. Let T be a tree such that the longest 2-path in T has length d ≥ 1, and let k be a positive integer. Then there exists L > 0 (only depending on k and d) such that the following is true: If T contains an C-gadget of order d and length L, then there exists 1 ≤ d ′ ≤ d such that T contains a closed strong C-gadget of order d ′ with at least k junctions.
Proof. Use Lemma 34 with k + 2 rather than k and observe that every strong C-gadget with k + 2 junctions also yields a closed strong C-gadget with k junctions by removing i 1 and i k+2 from the list of indices. Since x i1 and x i k+2 must have degree at least 3 (they are inner vertices of a C-gadget and they are junctions), we obtain that neither x i2 and x i k+1 can be forks of T . ◀

Constructions of Q andĜ
For the scope of this subsection, to avoid notational clutter, we assume the following are given: Positive integers k and d.
A tree T that contains a closed strong C-gadget H = x 0 , . . . , x ℓ of order d with k junctions x i1 , . . . , x i k . Additionally, for each j ∈ [k], we fix a ray R j = x ij , r 1 j , . . . , r d j of length d, the source of which is x ij and which does not contain one of the neighbours x ij −1 and x ij +1 -note that the R j must exist as the x ij are junctions. A k-vertex cubic graph ∆ containing a Hamiltonian cycle v 1 , . . . , v k , v 1 .
We emphasise that the set of edges of ∆ not contained in the Hamilton cycle must constitute a perfect matching, that is, a set of k/2 pairwise non-incident edges. This must be satisfied since ∆ is cubic.
▶ Definition 36. The core of H, denoted by C(H), contains the subsequence x i1 , x i1+1 , . . . , x i k −1 , x i k and the vertices of the rays R j , that is where the u t j are fresh vertices. 3. Each edge e = {v i , v j } not contained on the Hamilton cycle, i.e., j / ∈ {i − 1, i + 1}, is replaced by a path P i,j of length 2d: where the w t i and w t j are fresh vertices. Since ∆, T and H are fixed in this subsection, to avoid notational clutter, we just write Q and τ , rather than Q(∆, T, H) and τ (∆, T, H).
It turns out that Q is isomorphic to a quotient graph of T [C(H)] obtained by identifying the endpoints of the rays R i and R j for every This induces a homomorphism from T [C(H)] to Q that will be useful in the construction ofĜ; hence we explicitly define this mapping below: ▶ Definition 38 (γ). We define a function γ : C(H) → V (Q) as follows. Now let (G, c) be a Q-coloured graph. We state the following fact explicitly, since it will be crucial in our construction: Our goal is to construct a graphĜ =Ĝ (G, c, T, H) from G, and an edge-colouringγ : E(Ĝ) → E(T ) whose range is E(T ) such that ⊕Emb((Q ♯ τ, c τ ) → (G, c)) = ⊕ColSub(T → (Ĝ,γ)), that is, the number of colour-preserving embeddings from the fractured graph Q ♯ τ to (G, c) is equal, modulo 2, to the number of subgraphs ofĜ that are isomorphic to T and that contain each edge-colour in E(T ) precisely once.
For what follows, let V (R) := ∪ k j=1 V (R j ) be the set of all vertices of the rays R 1 , . . . , R k . We are now able to defineĜ =Ĝ(G, c, T, H); the construction is illustrated in Figure 4. The definition uses the function c E introduced in Definition 6 and the functions γ and γ E introduced in Definitions 38 and 40, respectively. It also uses the mapping ▶ Definition 42 (Ĝ (G, c, T, H),γ(G, c, T, H)). Let (G, c) be a Q-coloured graph. The pair (Ĝ,γ) = (Ĝ (G, c, T, H),γ(G, c, T, H)  Observe that for each element T col ∈ ColSub(T → (Ĝ,γ)) the induced subgraph of T col is an edge-colourful subgraph in G, that is, T col [G] contains precisely one edge per edge-colour of G under the edge colouringγ hence it contains precisely one edge per edgecolour of G under c E . As shown in Section 3 in the full version [31] of [32] Proof. To avoid notational clutter, we set ρ := ρ(T col ) and τ := τ (∆, T, H). Let T 1 and T 2 be the subtrees of T attached to the ends of the C-gadget H as shown in the bottom part of Figure 4.
We first give an overall intuition of the proof; consider Figure 5 for an illustration. Since T col is isomorphic to T , there must be a (unique) path connecting T 1 and T 2 inĜ (recall that, since T col is edge-colourful and since every edge in T 1 and T 2 has a different coloursee (C) in Definition 42 -T col must contain all edges in T 1 and T 2 ). We claim that this path must follow the outer cycle inĜ, in which case the designated rays in R of length d at the junctions must follow the inwards direction and thus induce τ . To see why the path connecting T 1 and T 2 must follow the outer cycle, first recall that V j is the subset of V (G) coloured by c with v j . Then recall that the path between V j and V j+1 along the outer cycle inĜ has length ℓ j ≥ 2d + 1. Hence the designated rays in R cannot be used to cover all edge colours in the path between V j and V j+1 .
We next provide a rigorous argument. Let Note that S is a subset of V (T ) \ V (H) hence it is a subset of V (T ) and of V (Ĝ). We first claim that every fork and every ray of length > d of T must be fully contained in the subgraph of T induced by S. This claim follows from the definition of closed strong C-gadgets. In particular, the condition of being closed implies that neither x i1 nor x i k is a fork.
As a consequence, every fork and every ray of length greater than d of T col must be contained in the subgraph ofĜ induced by S as well. Additionally, this implies that none of the vertices in T col [G] can be a fork or the source of a ray of length > d in T col -otherwise, T col would have either more forks or more rays of length > d than T , contradicting the fact that T col and T are isomorphic.
Recall that V 1 , . . . , V k denote the subsets of vertices of G that are coloured by c with v 1 , . . . , v k . Now let P be the (unique) path P in T col that connects T 1 with T 2 . Then, starting with V 1 and ending with V k , the path P must pass through a sequence of colour classes The following claim formalises the idea that this sequence must correspond to the Hamilton cycle v 1 , . . . , v k in ∆.

Claim:
We have t = k and V ji = V i for each i ∈ [k]. Before proving the claim, we show that it implies the lemma. Since, from the claim, P must follow the outer cycle, the fracture ρ = ρ(T col ) induced by T col must split the inner paths of length 2d (otherwise T col would contain a cycle). However, since there are no sources or rays of length greater than d outside of S in T col , ρ must split all of the inner length-2d paths at the central vertex m(e). Furthermore, it cannot split additional vertices since this would disconnect T col . Thus, ρ is the fracture τ , concluding the proof. ■ To conclude the proof, we now prove the claim. Note first that P cannot pass through any of the colour classes V i more than once as this would cause T col to use an edge-colour multiple times. Next assume for contradiction that P misses some colour class V a for some a ∈ [2, k − 1] (i.e., we assume that t < k). Since T col is a connected tree containing all of the edge colours in Q there must be an index j i ̸ = a and a vertex u ∈ V ji ∩ P such that T col contains a (unique) path P u from u to a vertex w ∈ V a . In order to get the contradiction, root T col at u. Construct a subtree T col (u) of T col as follows: For each neighbour x of u except the ancestor of w on the path from u, we delete x and all of its descendants. Observe that the edge colours of T col (u) are disjoint from the edge-colours of P and that V (T col (u)) is disjoint from S. Now, if T col (u) is a path, then (using that ℓ i > 2d), we obtain that u is the source of a ray in T col of length greater than d, contradicting the fact that every ray of length > d of T col is in the subgraph ofĜ induced by S. Otherwise, T col (u) contains a fork, contradicting the fact that all forks of T col are in the subgraph ofĜ induced by S.
Having established that t = k and that no V i is visited more than once, it remains to show that P visits the colour classes in the correct order, that is V ji = V i for each i ∈ [k]. Assume for contradiction that this is not the case, which allows us to set Note that m ≥ 1 since j 1 = 1. Let z m ∈ V m ∩ P and z m+1 ∈ V m+1 ∩ P and recall that G contains colour classes U 1 m , . . . , U ℓm−1 m corresponding to the path in Q (see Definition 37). Let us now define the subtrees T col (m) and T col (m + 1): For T col (m) we root T col at z m and for each neighbour x of z m in T col , we delete x and all of its descendants unless x ∈ U 1 m . For T col (m + 1) we root T col at z m+1 and for each neighbour x of z m+1 in T col , we delete x and all of its descendants unless x ∈ U ℓm−1 m . Note that at least one of T col (m) and T col (m + 1) must have depth greater than d (if rooted at z m and z m+1 , respectively), since ℓ m > 2d and T col is edge-colourful with respect toγ, that is, we have to make sure that we cover all of the edge colours Finally, regardless of which one of the two subtrees has depth greater than d, we will find either a fork, or the source of a ray of length greater than d outside of the set S, yielding the desired contradiction and concluding the proof of the claim, and hence the proof of the lemma. ◀ We are now able to prove the main lemma of this subsection.
Proof. We start with the following claim from [31]. Claim: A colour-preserving embedding φ ∈ Emb((Q ♯ τ, c τ ) → (G, c)) is uniquely defined by its image (which is a subgraph of (G, c)).
For convenience, we provide a proof of the claim: Recall that Q ♯ τ is Q-coloured by the function c τ that maps w B to w for each w ∈ V (Q) and block B ∈ τ w . Now recall the definition of fractured graphs (Definition 8) and let B 1 and B 2 be the blocks of τ c(u) and τ c(v) that contain c(e). Then, since φ is an embedding, it maps c(u) B1 to u and c(v) B2 to v. Since Q does not have isolated vertices, continuing this process over all edges of G ′ defines φ. This concludes the proof of the claim. ■ By the claim, it is sufficient to construct a bijection b from elements in ColSub(T → (Ĝ,γ)) to subgraphs (G ′ , c ′ ) that are images of embeddings in Emb((Q ♯ τ, c τ ) → (G, c)). Given First, we have to show that for all T col , (T col [G], c(T col )) is the image of an embedding in Emb ((Q ♯ τ, c τ ) → (G, c)). To this end, recall that T col [G] induces a fracture ρ = ρ(T col ) of Q. By the definition of ρ, T col [G] and Q ♯ ρ are isomorphic and this isomorphism preserves the colours so c ρ agrees withγ on the edges of Q ♯ ρ. This implies that c ρ and c(T col ) are the same. So (T col [G], c(T col )) is the image of an embedding in Emb ((Q ♯ ρ, c ρ ) → (G, c)). Finally, Lemma 43 guarantees that ρ = τ .
Second, we will show that b is injective. To this end, let T col1 ̸ = T col2 ∈ ColSub(T → (Ĝ,γ)). Since T col1 and T col2 must both fully contain V (T ) \ C(H), and since both are edge-colourful (see Definition 42), the only possibility for T col1 and T col2 not being equal is that they disagree on G, that is, . This proves b to be injective.
Finally, we will show that b is surjective: Given any (G ′ , c ′ ) that is the image of an

We add all edges between vertices in V (T ) \ C(H) that are present inĜ (see (C) in
Definition 42).

Finally, we connect a vertex in z in V (T ) \ C(H) with a vertex w in G ′ if and only if z
and w are connected inĜ (see (D) in Definition 42). The resulting subgraph T col (G ′ , c ′ ) ofĜ is clearly edge-colourful and isomorphic to T , concluding the proof. ◀ We are now able to establish hardness of ⊕Sub(T ) in case of unbounded C-number. Proof. Assume first that T contains trees with 2-paths of unbounded length. In this case we reduce from the problem of counting k-cycles, modulo 2, which was shown ⊕W[1]-hard in [12]. In the first step, this problem reduces to the problem of counting s-t-paths of length k, modulo 2 as shown in Lemma 5.2 in the full version [29] of [28]. In the second and final step, we can easily reduce from the problem of counting s-t-paths of length k, modulo 2, to ⊕Sub(T ), as shown in Figure 6: Concretely, let (G, s, t, k) be a problem instance. Since T contains trees with 2-paths of unbounded length, we can find, in time only depending on k, a tree T in T containing a 2-path x 0 , x 1 , . . . , x k+1 , x k+2 of length k + 2. Let furthermore T 1 and T 2 be the subtrees of T as depicted in Figure 6. We construct a graph G ′ from G in two steps as follows: First, we add fresh vertices x 0 and x k+2 and edges {x 0 , s} and {t, x k+2 }. Second, we add T 1 and T 2 and identify their roots with x 0 and x k+2 , respectively. The construction is depicted in Figure 6 as well. Now let A be the set of subgraphs of G ′ that are isomorphic to T and that contain all edges of T 1 and T 2 . It is easy to see that the cardinality of A is equal to the number of s-t-paths of length k in G. Thus it suffices to compute |A| mod 2, using an oracle for ⊕Sub(T ). This can be achieved by a simple application of the inclusion-exclusion principle: where G ′ \ J is the graph obtained from G ′ by deleting all edges in J. We can conclude the reduction by observing that the number of terms in (7) only depends on T and thus on k, and that our oracle to ⊕Sub(T ) allows us to evaluate (7) modulo 2.
For the remainder of the proof we can thus assume that the length of any 2-path in any tree in T is bounded by a constant d. Since T has unbounded C-number, we obtain that the trees in T contain C-gadgets of order d of unbounded length. By Corollary 35 we obtain that for any positive integer k, there is a value d ′ in the range 1 ≤ d ′ ≤ d such that there is a tree T k in T which contains a strong C-gadget of order d ′ with k junctions.
Let C be a class of cubic Hamiltonian graphs of unbounded treewidth. Assume w.l.g. that, for each k, the class C contains at most one graph with k vertices; otherwise we just keep one k-vertex graph with the largest treewidth among all k-vertex graphs in C. For each ∆ ∈ C set T ∆ := T |V (∆)| , that is T ∆ is contained in T and contains a strong C-gadget H ∆ with at least |V (∆)| junctions. Recall Definition 37 and set Observe that Q(∆, T ∆ , H ∆ ) contains as minor the graph obtained from ∆ by removing one edge. Since the removal of a single edge can decrease the treewidth only by a constant, and since treewidth is minor-monotone, we have that Q has unbounded treewidth.
By Theorem 12 the problem ⊕cp-Hom(Q) is therefore ⊕W[1]-hard. Thus it suffices to show that ⊕cp-Hom(Q) ≤ fpt T ⊕Sub(T ) . In the first step, we reduce the computation of ⊕Hom((Q, id Q ) → ⋆) to the computation of ⊕Emb((Q ♯ τ, c τ ) → ⋆); here, τ is the fracture defined in Definition 37. To this end, it was shown in [30] that where the relation "≥" and the Möbius function µ are over the lattice of fractures. We omit introducing these objects in detail, since we only require that the coefficient of the term ⊕Hom((Q ♯ ⊤, c ⊤ ) → ⋆) (which is equal to ⊕Hom((Q, id Q ) → ⋆)) in the above linear combination was shown in [30] to be equal to Since each partition τ v has at most two blocks, the above term is odd. Thus, by Lemma 14, we can evaluate the term ⊕Hom((Q ♯ ⊤, c ⊤ ) → ⋆) if we can evaluate the entire linear combination, that is, if we can evaluate ⊕Emb((Q ♯ τ, c τ ) → ⋆). It thus remains to show how we can evaluate ⊕Emb((Q ♯ τ, c τ ) → ⋆) using our oracle for ⊕Sub(T ).
Finally, by Lemma 15 we can compute ⊕ColSub(T ∆ → (Ĝ,γ)) in FPT time using an oracle for ⊕Sub(T ∆ → ⋆). Since the size of T ∆ only depends on Q, and since, with input Q we can find T ∆ (recall that T is recursively enumerable) this yields indeed a parameterised Turing-reduction and the proof is concluded. ◀ Figure 6 Reduction from counting s-t-paths of length k, modulo 2, in a graph G to counting copies of a tree T with a 2-path of length at least k + 2.

Unbounded Star Number
We will use the same strategy as in Subsection 4.1: Given a tree T with large star number, we start with a properly chosen cubic graph ∆, and we construct a graph Q depending on ∆ and T which contains ∆ as a minor. Then we show that for any Q-coloured graph (G, c), we can construct an edge-coloured graph (Ĝ,γ) such that ⊕ColSub(T → (Ĝ,γ)) is equal to ⊕Emb ((Q ♯ τ, c τ ) → (G, c)) for a particular fracture τ .
To this end, let T be a tree with star number (at least) 6k for some positive integer k. By definition of the star number, there is a d ≥ 3 such that T contains a vertex s which is the source of 6k rays R 1 , . . . , R 6k of length precisely d.    The fracture τ of Q that we will be interested in is defined as follows; Figure 9 depicts the fractured graph Q ♯ τ . Analogously to the notion of a core in the case of unbounded C-number, we will identify a specific subgraph of the tree T and we will use it to define the graphĜ later.
▶ Definition 49 (V ′ ). Let V ′ be the vertex subset of T defined as follows: Next, note that the edges of Q can be decomposed into 6k paths, each of length d − 1: There are k vertices of ∆. For each vertex v ∈ V (∆) the graph Q contains, by definition, a gadget corresponding to v, the edges of which can be decomposed into 6 paths P 1 v , . . . , P 6 v of length d − 1 (formally, the fractured graph Q ♯ τ yields precisely this decomposition; see Figure 9). Additionally, for each v ∈ V (∆) and i ∈ [6], the first vertex of P i v is chosen to be v i as depicted in Figure 8.
In particular, we enforce that the first vertices of the paths are mapped onto each other, that is, γ(r 1 j ) := v i . Additionally, we define γ E : E ′ → E(Q) by mapping e to γ(e).

▶ Observation 51. The function γ is an edge-bijective homomorphism from
Now let (G, c) be a Q-coloured graph. We state the following explicitly, since it will be crucial in our reduction.
Let us now construct a graphĜ from a Q-coloured graph G; an illustration is provided in Figure 10.  (9)). Similarly to the case of unbounded C-gadgets, for each element T col ∈ ColSub(T → (Ĝ,γ)) the induced subgraph of T col is an edge-colourful subgraph in G, that is, T col [G] contains precisely one edge per edge-colour of G under the edge colouringγ hence it contains precisely one edge per edgecolour of G under c E . As shown in Section 3 in the full version [31] of [32],  ▶ Lemma 54. For every T col ∈ ColSub(T → (Ĝ,γ)) we have that ρ(T col ) = τ .
Proof. Let T col ∈ ColSub(T →Ĝ,γ). Since T col must include each of the edge colours given byγ (precisely) once, we have that T col must fully contain T s . Note that T s fully contains T except for 6k rays of length d, and the only way to attach those rays inĜ is via the vertex s. Now consider the subgraph T col [G + s] of T col defined as follows: Since T col includes all edge colours given byγ, we have that s must have degree 6k in T col [G + s]: By (C) in Definition 53, the vertex s must be connected (within T col [G + s]) to one vertex in each of the colour classes V i = c −1 (v i ) for v ∈ V (∆) and i ∈ [6]. Additionally, this implies the following: ▶ Observation 55. T col [G + s] is isomorphic to the d-stretch of K 1,6k with s at the centre.
In the remainder of the proof, we will show that the only way for T col to (colourfully) embed the 6k rays of length d is as depicted in Figure 11. Note that this will conclude the proof since the induced fracture of the depicted embedding is τ .
Hence we proceed with proving the claim. We first consider, for each edge {v, x} ∈ E(∆), the vertex v x = (x v ) of Q (see Definition 46 and Figure 8). The vertex v x has two neighbours n v and n x in Q, where n v denotes the neighbour in the gadget of v and n x denotes the neighbour in the gadget of x. Recall that we write V for their colour class within G (and thus withinĜ). Since T col is edgecolourful, it must contain precisely one edge e v between V x and N v and one edge e x between V x and N x (see (A) in Definition 53). Now observe that every vertex in V x has distance (at least) d to s withinĜ. This has two crucial consequences: First, the endpoints of e v and e x inside V x cannot be equal: Otherwise, they could not be part of a ray of length precisely d with source s, and this would contradict the previous observation that T col [G + s] is isomorphic to the d-stretch of K 1,6k with s at the centre (Observation 55). Hence, second, the endpoints of e v and e x inside V x both have degree 1. Consequently, they must be the endpoints of two of the rays of length d. However, the only way for this to be true is them each being connected to s as depicted in Figure 11; in all other cases, T col [G + s] cannot be isomorphic to the d-stretch of K 1,6k with s at the centre. The second consequence implies that the edge colours corresponding to the edges in the paths P 2 v , P 4 v , and P 6 v are covered for each v (recall that T col must include each edge colour precisely once). Thus, the only possibility to include the remaining edge colours corresponding to the paths P 1 v , P 3 v , and P 5 v while keeping T col [G + s] being isomorphic to the d-stretch of K 1,6k , is to embed, for each gadget, the remaining 3 rays of length d as depicted in Figure 11. This concludes the proof. ◀ We are now able to prove the main lemma of this section.
Proof. Thanks to Lemma 54, the proof is similar to the proof of Lemma 44: Colourpreserving embeddings in Emb((Q ♯ τ, c τ ) → (G, c)) are uniquely identified by their image, and a bijection b from ColSub(T → (Ĝ,γ)) to images of colour-preserving embeddings in Emb((Q ♯ τ, c τ ) → (G, c)) is given by b : Similarly to the proof in Section 4.1, Lemma 56 is sufficient for hardness.

Figure 11
Illustration of the unique way to colourfully embed T intoĜ. The induced fracture is τ .

▶ Lemma 57. Let T be a recursively class of trees of unbounded star number. Then ⊕Sub(T ) is ⊕W[1]-hard.
Proof. The proof is almost identical to the proof of Lemma 45, with the exception that we use Q, τ ,Ĝ, andγ as defined in the current section, and that we rely on Lemma 56 for the identity ⊕Emb((Q ♯ τ, c τ ) → (G, c)) = ⊕ColSub(T → (Ĝ,γ)).
The remainder of the proof transfers verbatim. ◀

Unbounded Fork number
We will rely on the same high-level strategy as the one that we used when the C-number or star number was unbounded: Given a tree T with large a-b-fork number, we start with a properly chosen cubic graph ∆, and we construct a graph Q which depends on T and ∆, and which contains ∆ as a minor. Afterwards, we show that for any Q-coloured graph (G, c) we can construct an edge-coloured graph (Ĝ,γ) where the co-domain ofγ is E(T ) such that #ColSub(T → (Ĝ,γ)) is equal (modulo 2) to #Emb((Q ♯ τ, c τ ) → (G, c)) for a particular fracture τ of Q. However, proving this equality will be more involved than it was in the previous cases: In Sections 4.1 and 4.2, we were able to prove, implicitly, that #ColSub(T → (Ĝ,γ)) = #Emb((Q ♯ τ, c τ ) → (G, c)), that is, we were able to establish equality, rather than equality modulo 2. In the current case, we are not able to prove equality and must therefore rely on parity arguments, which makes the case slightly more involved. We start by fixing the following: Positive integers k, a and b with a ≤ b and k ≥ 2. A tree T with F a,b (T ) ≥ 2k. By definition of forks (Definition 29), T contains designated sources s 1 1 , s 2 1 , . . . , s 1 k , s 2 k such that for each (i, j) ∈ [k] × [2], the source s j i is the source of two (distinct) rays F a (i, j) of length a and F b (i, j) of length b. Additionally deg NL (s j i ) = 1. We assume w.l.o.g. that the designated sources are ordered by their leaf-degrees, that is Consider Figure 12 for an illustration of T , its designated sources, and the rays F a (i, j) and F b (i, j). A k-vertex bipartite cubic graph ∆ with vertices V (∆) = {v 1 , . . . , v k }. A proper 3-edge-colouring C : E(∆) → {s, m, ℓ} of ∆. 6 We first note that, since there are at least 2k ≥ 4 sources in T , any pair of distinct sources must not be adjacent: Otherwise, the tree T would either be disconnected, or one of the sources would have deg NL at least 2, both of which is a contradiction.

▶ Observation 58. For any distinct pair
Next, we define the graph Q.
▶ Definition 59 (Q). The graph Q is obtained from ∆ and C via substituting v i by the gadget depicted in Figure 13 for each i ∈

Figure 14
The fractured graph Q ♯ τ . Note that the illustration only depicts the fracturing of a single vertex gadget.
While Definition 59 will be useful in our proofs, we note the following easier equivalent way to define Q. The fracture τ of Q that we will be interested in is defined as follows; Figure 14 depicts the fractured graph Q ♯ τ .  s via a path of length a, to m via a path of length b, and to ℓ via a path of  length a + b. Let e s , e m , and e ℓ be the first edges on those paths. We set For all other vertices u of Q, we let τ u be the partition consisting only of one block.
Next we identify specific substructures of T that will be necessary in the construction ofĜ.
are the designated sources of T . 6 That is, C(e1) ̸ = C(e2) whenever e1 ̸ = e2 share a vertex. Note that every cubic bipartite graph has a 3-edge-colouring by Hall's Theorem.
T ′ is the graph obtained from T by deleting, for each (i, j) ∈ [k] × [2], the designated source s j i as well as all rays with source s j i . For each (i, j) ∈ [k] × [2], p j i is the neighbour of s j i which is not contained in a ray. Note that p j i is unique by definition of forks. Note that p j i ∈ V (T ′ ) and that the p j i are not necessarily pairwise distinct.
). An illustration of these notions is given in Figure 12.
Observe that T [F ] is a disjoint union of 2k paths of length a + b. Specifically, for each It turns out that Q is isomorphic to a quotient graph of T [F ], since for each vertex v i of ∆, the vertex gadget of v i decomposes into two paths of length a + b. In fact, this decomposition is given by the fractured graph Q ♯ τ (see Figure 14). Formally, we have the following: Similarly to the previous two cases, we introduce functions γ and γ E which we will need for defining the edge-colours ofĜ.
▶ Definition 64 (γ, γ E ). We define a function γ : F → V (Q) as follows: Note that the definition of γ E is well-defined since γ is a homomorphism by Observation 63. Concretely, γ can be viewed as the composition of an isomorphism from T [F ] to Q ♯ τ and the Q-colouring c τ of Q ♯ τ (see Definition 9). Furthermore, γ E is clearly a bijection. Hence, similarly to the previous sections, we point out the following: We are now able construct a graphĜ from a Q-coloured graph G; an illustration is provided in Figure 15. (D) The remaining edges ofĜ are defined as follows. For each edge e ∈ E(T ) that connects a vertex z ∈ V (T ) \ F to a vertex y ∈ F there are corresponding edges inĜ. These edges connect z to all vertices g ∈ V (G) such that c(g) = γ(y) For each such edge e ′ inĜ, γ(e ′ ) = e. In (D), the only edges in T connecting z ∈ V (T ) \ F to a vertex y ∈ F satisfy that y is one of the designated sources s j i , and z is either p j i ∈ V (T ′ ) or z is contained in one of the d j i rays with source s j i that are not F a (i, j) or F b (i, j) (see Definition 62). Similarly to the other cases, for each element T col ∈ ColSub(T → (Ĝ,γ)) the induced subgraph T col [G] := T col [V (T col ) ∩ V (G)] of T col is an edge-colourful subgraph in G. Also, T col [G] induces a fracture ρ = ρ(T col ) of Q as follows. First, recall that G is Q-coloured by c, and that G is contained inĜ (see (A) in Definition 66). Next note that T col [G] is a subgraph of G that contains each edge colour in the image of c E • γ −1 E precisely once. Since γ E is a bijection from E ′ to E(Q), we can thus equivalently view T col [G] as a subgraph of G that contains each edge colour in the image of c E precisely once. This fact allows us to define ρ(T ) in terms of the function c E as follows. With (Ĝ,γ) defined, we can finally state formally the goal of this section. Recall that (G, c) is a Q-coloured graph.
The proof requires some additional set-up. In particular, we need the condition that |c −1 (v)| is odd to deal with the case in which what we call "invalid trees" arise. To this end, recall that V j i = c −1 (v j i ) denotes the set of vertices in G that are coloured by c with v j i . Since G is a subgraph ofĜ (see Definition 66), we slightly abuse notation and write V j i also for the subset of vertices inĜ corresponding to V j i in G.
▶ Definition 69. Let T col ∈ ColSub(T → (Ĝ,γ)) and let (i, j) ∈ [k] × [2]. We call T col invalid at (i, j) if the following two conditions are met: (I) T col contains precisely two vertices x and y in V j i . (II) x is adjacent to p j i and not incident in T col to any edge coloured with a colour in E ′ (see Definition 66 (A)). Otherwise T col is called valid at (i, j). We call T col an invalid tree if there exists a pair (i, j) ∈ [k] × [2] such that T col is invalid at (i, j). Otherwise, we call T col a valid tree. We write ColSub val (T → ( G,γ)) for the set of all valid T col in ColSub(T → ( G, γ)).
Consider Figure 16 for an illustration of Definition 69.
Proof. For the proof, given two tuples (i, j) and for the set of all T col ∈ ColSub(T → (Ĝ,γ)) that are invalid at (i, j) but valid on all pairs (i ′ , j ′ ) < (i, j). We will prove that T (i, j) is even for all (i, j) ∈ [k] × [2]; this is sufficient for the lemma to hold.

Figure 16
Illustration of the condition that yields invalid trees at (i, 1) (below) and (i, 2) (above). Edges contained in E ′ are coloured red.
Hence fix (i, j), let T col ∈ T (i, j), and let x and y be as in Definition 69. Since V j i = c −1 (v j i ) and for j ∈ [2], v j i is a vertex of Q, the assumption in the statement of the lemma implies that |V j i | is odd. Since x and y are distinct vertices in V j i , V j i contains additional vertices other than x and y. Fix a vertex x ′ ∈ V j i \ {x, y}. Obtain T ′ col from T col by deleting x (including edges incident to x) and by adding x ′ and the edge {x ′ , u} for every u that was adjacent to x -this is well-defined since x is not incident to any edge coloured with a colour in E ′ , and by construction ofĜ (see Definition 66 (C) and (D)) whenever {x, u} ∈ E(Ĝ) is an edge not coloured with a colour in E ′ , then {x ′ , u} ∈ E(Ĝ) for every x ′ ∈ V j i . Additionally, {x, u} and {x ′ , u} have the same edge-colour. Hence, clearly, T ′ col an edge-colourful subgraph ofĜ that is isomorphic to T col (and thus to T ). For this reason, we obtain that T ′ col ∈ T (i, j). More generally, the observation that T ′ col ∈ T (i, j) allows us to define an equivalence relation on T (i, j): Let T col and T ′ col be elements of T (i, j), and let x and x ′ be the vertices in T col and T ′ col that satisfy (II) in Definition 69. We set T col and T ′ col to be equivalent if and only if one can obtained from the other by switching x with x ′ as defined above. The size of one equivalence class is precisely |V j i | − 1 = |c −1 (v j i )| − 1, which is even by the premise of the lemma. ◀ For the proof of Lemma 68, we need to establish some facts about rays and 2-paths of elements T col ∈ ColSub val (T → (Ĝ,γ)), which are those T col ∈ ColSub(T → (Ĝ,γ)) that are valid. We encapsulate these facts in the next section.
This requires some preparation. We first fix the following objects (recall the definitions of 2-path, Definition 27 and ray, Definition 28).
T col is an element of ColSub val (T → (Ĝ,γ)) T col [G] is the graph obtained from T col [V (T col ) ∩ V (G)] with isolated vertices removed. (In fact, our proof will show that, for valid trees T col ∈ ColSub val (T → (Ĝ,γ)), the induced subgraph T col [V (T col ) ∩ V (G)] cannot have isolated vertices. However, at the current point of the proof, it is easiest to just remove them.) For any positive integer t, R t is the set of length-t rays in T . P t is the set of length-t 2-paths in T that are not rays. For any positive integer t, R t col is the set of length-t rays in T col and P t col is the set of 2-paths in T col that are not rays. Note that |R t | = |R t col | and |P t | = |P t col | for all t since T and T col are isomorphic.
We will also rely on the following notion of external rays and 2-paths.
▶ Definition 71. A 2-path P of T col is called external if the following two conditions are satisfied.
Except for the endpoints, none of the vertices of P is contained in V (G). P does not contain an edge of G.
Definition 71 applies whether or not P is a ray. The following lemmas establish that all 2-paths of T col of length greater than b must be external.

▶ Lemma 72. Suppose that t is an integer that is greater than
Proof. We first construct a bijection f from R t to R t col . We will use this bijection to argue that every ray in R t col is external. In order to define the bijection, consider a ray R = r 0 , r 1 , . . . , r t in R t . Since t > b ≥ a, R is not one of the designated rays F a (i, j) and F b (i, j). If r 0 is not among the designated sources s j i , then, by the construction ofĜ, R is contained in T ′ and thus R ∈ R t col . In this case R is external and we set f (R) := R. Alternatively, suppose that r 0 = s j i for some i and j. Then R must be one of the d j i black rays in Figure 12 (see Definition 62). By the construction ofĜ and the fact that T col is edge-colourful, there is a vertex x ∈ V j i such that T col contains the path x, r 1 , . . . , r t . In T col , as in T , the vertices r 1 , . . . , r t−1 have degree 2 and the vertex r t has degree 1. Vertex x cannot have degree 1 in T col since this would disconnect T col . Also, vertex x x cannot have degree 2: To see this, assume for contradiction that x has degree 2. Then there is an integer t ′ > t and a ray R ′ ∈ R t ′ col the last vertices of which are x, r 1 , . . . , r t . Since x is not an endpoint of the ray and since x ∈ V (G), the ray R ′ is not external, contradicting the premise of the lemma. Hence x has degree at least 3 and therefore f (R) := x, r 1 , . . . , r t is an external ray of T col . The function f is injective by construction. Since T col and T are isomorphic, |R t | = |R t col | and thus f is a bijection. Since the image of f only contains external rays, we have shown that every element of R t col is external. Every ray in the image of f has the property that its degree-1 endpoint is not contained in V (G). Since the image of f is R t col , we obtain ( * ) Every ray in R t col has the property that its degree-1 endpoint is not contained in V (G). To complete the proof, we show that every 2-path in P t col is external. Following the same strategy that we used before, we construct a bijection g from P t to P t col . Every 2-path in the range of g is external, so we will conclude that every element of P t is external. In order to define the bijection, consider a 2-path P = p 0 , . . . , p t in P t . If neither of the endpoints of P is among the designated sources s j i , then P is contained in T ′ and thus P ∈ P t . In this case, P is external and we set g(P ) := P . If exactly one endpoint of P is among the designated sources, say p 0 = s j i , then there is a vertex x ∈ V j i such that x, p 1 , . . . , p t is a path in T col . The vertices p 1 , . . . , p t−1 have degree 2 in T col (as in T ) and the vertex p t has degree at least 3.
If x has degree 1 in T col , the ray R = p t , . . . , p 1 , x is in T col , and its degree-1 endpoint x is in V (G), contradicting ( * ). Hence x cannot have degree 1 in T col . Similarly, x cannot have degree 2, since this would create a 2-path longer than t in T col that is not external, which contradicts the premise of the lemma. Hence x has degree at least 3, and thus g(P ) := x, p 1 , . . . , p t is an external 2-path in P t col . For the last case, suppose that both endpoints of P are among the designated sources, say p 0 = s j i and p t = s j ′ i ′ . Then there are x and y in, respectively, V j i and V j ′ i ′ such that x, p 1 , . . . , p t−1 , y is a path in T col . Again, p 1 , . . . , p t−1 must all have degree 2 in T col as well. We show that both x and y have degree at least 3 in T col : If both have degree 1, then T col is disconnected. If one of them has degree 1 and the other one has degree at least 3, then we created a ray of length t whose degree-1 endpoint in in V (G), contradicting ( * ). If one has degree 1 and the other one has degree 2, then we found a ray longer than t which is not external, contradicting the premise of the lemma. If one has degree 2 and the other has degree at least 2, then there is a non-external 2-path longer than t, again contradicting the premise of the lemma. Thus, as desired, both must have degree at least 3. Therefore, g(P ) := x, p 1 , . . . , p t−1 , y is an external 2-path in P t col . The function g is injective by construction. Since T col and T are isomorphic, |P t | = |P t col | and thus g is a bijection. Since the image of g only contains external 2-paths, we have shown that every element of P t col is external, concluding the proof. ◀ ▶ Lemma 73. Suppose that t is an integer that is greater than b. Then every 2-path in R t col ∪ P t col is external.
Proof. Let t max be the maximum integer for which R tmax ∪ P tmax is nonempty. Let Φ t be the proposition "t ≤ b or every 2-path in R t col ∪ P t col is external". We will show by induction on t max −t that Φ t holds. The base case arises when t max −t = 0, so t = t max . If t max ≤ b then Φ t is satisfied. Otherwise, for each t ′ > t, the set R t ′ col ∪ P t ′ col is empty and we can invoke Lemma 72 to conclude that Φ t holds.
For the induction step, consider t such that t max − t ≥ 1. By the induction hypothesis, Φ t ′ holds for all t ′ ∈ {t + 1, . . . , t max }. If t ≤ b then Φ t holds. Otherwise, for all t ′ > t > b, we know from Φ t ′ that every 2-path in R t ′ col ∪ P t ′ col is external. We can then apply Lemma 72 to conclude that every 2-path in R t col ∪ P t col is external. ◀ Before proceeding with the proof of Lemma 68, we provide an overview of the central steps of the proof. Recall that it suffices to prove that #ColSub val (T → (Ĝ,γ)) = #Emb((Q ♯ τ, c τ ) → (G, c)) and that we have a fixed an element T col of ColSub val (T → (Ĝ,γ)) and proved various properties about it.
(1) Our goal is to show that T col is embedded inĜ in the following manner (see Figure 17).
For each (i, j) ∈ [k] × [2], T col contains a ray R a (i, j) of length a and a ray R b (i, j) of length b; those rays correspond to the designated rays F a (i, j) and F b (i, j) in T (recall that T and T col are isomorphic.) a. T ′ is part of T col . b. For every i ∈ [k] and j ∈ [2], the vertices p j i in T ′ is connected to a vertex w j i of G with c(w j i ) = v j i = γ(s j i ). In T col , the vertex w j i is the source of d j i rays other than R a (i, j) and R b (i, j). The vertices of these d j i rays are not in T ′ and are not in G. The edge colours of the edges in these rays inγ are the same as the edge-names in T (see Definition 66 (C)). c. The length-a ray R a (i, 1) is a path in T col from w 1 i to the vertex u a (i, 1) of G with some colour c(u a (i, 1)) (a vertex of Q). This colour c(u a (i, 1)) corresponds to the vertex "s" in the gadget of the vertex v i of ∆ (see Definition 59 and Figure 13). d. The length-b ray R b (i, 1) is a path in T col from w 1 i to the vertex u b (i, 1) of G with some colour c(u b (i, 1)) (a vertex of Q). This colour c(u b (i, 1)) corresponds to the vertex "m" in the gadget of the vertex v i of ∆ (see Definition 59 and Figure 13). e. The length-b ray R b (i, 2) is a path in T col from w 2 i to the vertex u b (i, 2) of G with some colour c(u b (i, 2)) (a vertex of Q). This colour c(u b (i, 2)) corresponds to the vertex "ℓ" in the gadget of the vertex v i of ∆ (see Definition 59 and Figure 13). f. The length-a ray R a (i, 2) is a path in T col from w 2 i to the vertex u a (i, 2) ̸ = w 1 i of G with some colour c(u a (i, 2)) = γ( We now make some observations about the fracture ρ = ρ(T col ) from Definition 67, given that T col is embedded inĜ as described in Item (1).
The definition of Q (Definition 59) tells us that, for every edge there is a degree-2 vertex y of Q that connects the gadgets of v i and v i ′ . Vertex y corresponds to the vertex C(e) ∈ {s, m, ℓ} in the two gadgets. Suppose without loss of generality that C(e) = s. The other cases are similar. From (1c) the colour C(e) = s is the same as c(u a (i, 1)) and c(u a (i ′ , 1)). From (1b) c(w 1 i ) = v 1 i and c(w 1 i ′ ) = v 1 i ′ . Since T col is colourful and the embedding is as in (1), the edges of the ray from w 1 i to u a (i, 1) have different edge colours to the ray from w 1 i ′ to u a (i ′ , 1). Thus, the edge in G in the first ray that is adjacent to u a (i, 1) (call it e i ) has a different colour from the edge n G in the second ray that is adjacent to u a (i ′ , 1) (call it e i ′ ). Concretely, we have c E (e i ) = {s, x} and c E (e i ′ ) = {s, x ′ } where x and x ′ are the neighbours of s (in Q) in the gadgets of v i and v i ′ , respectively. By (1g) we have u a (i, 1) ̸ = u a (i ′ , 1) and thus, by definition of ρ (Definition 67), ρ y consists of two singleton blocks. Similar arguments show that ρ coincides with τ (see Definition 61) at every vertex of Q that corresponds to vertex "s", "ℓ" or "m" in any gadget corresponding to any vertex v i of ∆. We now continue with the vertices v 1 i for i ∈ [k] of Q. See Figure 13 for the gadget containing v 1 i in Q and Figure 17 for the graphĜ. We will use "s", "ℓ" and "m" as the names of these vertices in the gadget containing v 1 i . The vertex v 1 i has degree 3 and is connected to s via a path of length a, to m via a path of length b and to ℓ via a path of length a + b. Let y s , y m , and y ℓ be the successors of v 1 i on those paths, that is, the edges incident to where r a and r b are the successors of w 1 i on the rays R a (i, 1) and R b (i, 1), respectively. Furthermore, by (1f), the edge of T col that is coloured (by c E ) with e ℓ is {u a (i, 2),r} wherer is the vertex in the ray R a (i, 2) that is adjacent to u a (i, 2). Since u a (i, 2) ̸ = w 1 i (by (1f)), the edge {u a (i, 2),r} is not  Figure 13). This case is easy. If T col is embedded as described in (1) (see Figure 17), then, for each i ∈ [k], there is only one vertex of T col which is coloured by c with colour v 2 i . This vertex is w 2 i . Thus every edge of T col whose edge colour includes v 2 i is incident to w 2 i . Hence ρ v 2 i only consists of one block, which coincides with τ v 2 i by Definition 61. Finally, every remaining vertex of Q (see Figure 13) has degree 2. Let y be such a vertex and let y 1 and y 2 be the neighbours of y. Then the edges of T col coloured by c E with {y, y 1 } and {y, y 2 } must be successive edges on one of the rays R a (i, 1), R b (i, 1), R a (i, 2), or R b (i, 2). So these successive edges are both incident to the vertex of the ray that is coloured y by c. Thus ρ y only consists of one block, which coincides with τ y .
Since we have shown that the fractures ρ and τ coincide at every vertex of Q, we conclude that ρ = τ .
(3) We next explain why it is useful to have ρ = τ . Recall that our goal is to prove that #ColSub val (T → (Ĝ,γ)) = #Emb((Q ♯ τ, c τ ) → (G, c)) and that T col is an element of ColSub val (T → (Ĝ,γ)). Our method will be to show that the function β defined by c)).
It will turn out that this implies that the embedding ρ coincides with τ . (4) In order to prove Item (1) we will proceed as follows.
(i) We show that all 2-paths (including rays) of T col are external, except for 2k rays of length b and 2k rays of length a. Note that we already established this claim for 2-paths of lengths greater than b in Lemma 73. (ii) Then we show that T col contains two degree-1 vertices in each of the vertex sets L and M of G (withinĜ) -see Figure 17, recalling that, for each vertex gadget, the sets L and M denote the vertex subsets of G that are coloured by c with ℓ and m.
The point of this is that we will also prove that T col has two degree-1 vertices in S (Item 4iv) -this will split off the part of T col corresponding to a single gadget, so we will only have to study the embedding of T col within each gadget. We prove the claim about L and M by using the fact that T col is isomorphic to T and that all 2-paths longer than b are external. This implies that if v i and v i ′ are the two vertices of ∆ sharing this gadget then the 2-paths between V 2 i and V 2 i ′ are covered by two rays in T col , both of which end in L. (iii) We next show that the degree-1 vertices in (4ii) are the endpoints of 2k rays of length b. We have already seen that for each of the k gadgets the endpoints of these rays are in L and M . For the i'th gadget, the sources are in V 1 i and V 2 i If b > a then we show that all remaining 2-paths of length b and also all 2-paths with lengths in a + 1, . . . , b − 1 are external. The proof of this claim relies on the same arguments as the proof of Lemma 73. (iv) Next, we show that for each gadget, T col contains two degree-1 vertices in S -see Figure 17. The proof uses the fact that all 2-paths longer than a that are not covered by (4iii) are external. (v) We next show that the degree-1 vertices in (4iv) are the endpoints of 2k rays of length a. We have already seen that for each of the k gadgets the endpoints of these rays are in S. For the i'th gadget, the source is in V 1 i .

(vi)
The remaining details of the proof rely on the fact that the tree T col is valid.
We now provide the proof in detail; for convenience, we also restate the lemma.
Using this fact and the argument from Item (2) of the proof overview, we conclude that for any T col ∈ ColSub val (T → (Ĝ,γ)), ρ(T col ) = τ .
Recall that every edge-colourful subgraph of G induces a fracture of Q. Let G ′ be an element of Emb((Q ♯ τ, c τ ) → (G, c)). This means that G ′ is an edgecolourful subgraph of G that induces τ . We wish to see how G ′ can be extended to some T col ′ ∈ ColSub val (T → (Ĝ,γ)). We know from Item (1) that any T col ′′ ∈ ColSub val (T → (Ĝ,γ)) can only be embedded inĜ in one way, so G ′ can only be extended in one way. The details are as follows. We claim that there is only one possible extension because T ′ has to be included and item (b) of (1) ensures that, for each j ∈ [2], the vertex p j i is connected to w j i . The rest of (1) shows the unique way to include the rays, so the extension is unique.
To finish the proof, we will fix T col ∈ ColSub val (T → (Ĝ,γ)) and we will show that Item (1) of the proof overview holds. Part (a) of (1) is trivial since T col is edge-colourful so it contains T ′ . The first sentence of (b) is also trivial. We will next focus on (c)-(g), noting along the way when the rest of (b) is proved.
Recall from Definition 59 that, for each i ∈ [k], the graph Q contains for each vertex v j such that ∆ has an edge e = {v i , v j } with C(e) = m, a path P i,j of length 2b from v 1 i to v 1 j , and for each vertex v j such that ∆ has an edge e = {v i , v j } with C(e) = ℓ, a path P i,j of length 2b from v 2 i to v 2 j .
Recall from Definition 6 that c E maps edges of G to edges of Q. Furthermore, G is a subgraph ofĜ, see Definition 66 (A). Let T col (i, j) be the subgraph of T col [G] induced by edges e of G such that c E (e) is in the path P i,j By construction, T col (i, j) is the union of some number of paths. We will next argue that it is the union of exactly two disjoint length-b paths: If T col (i, j) has more than two components then at least one component is disconnected from T ′ in T col , contradicting the fact that T col is a tree. If T col (i, j) is a single path then it is contained in a 2-path of length at least 2b. Since this 2-path contains an edge in G, it is not external (Definition 71). This contradicts Lemma 73. If T col (i, j) is the union of exactly two disjoint paths, one of which has length larger than b then this larger 2-path is contained in a 2-path that is not external contradicting Lemma 73 Figure 17 An embedding T col of T inĜ that yields the fracture τ . We will show that this is the only way to embed T inĜ in such a way that each edge-colour is used precisely once. Note that dashed lines depict paths in T col , and solid lines depict edges in T col .

Figure 18
Illustration of the embedding of T col after the rays of length b are analysed. Solid lines depict edges, dashed lines depict paths, and dash-dotted lines depict sequences of edges (the identification of the endpoints of which we have not yet been determined). Note that both R b (i, 1) and R b (i, 2) must be of length b. Except for those two rays, the identification of endpoints of the remaining edges that are incident to G (withinĜ) has not been determined yet either; this is depicted by the dotted circles inside the colour classes. The fracture ρ induced by T col will depend on the identification of the edges of T col , both endpoints of which lie in G. The goal is to show that the endpoints have to be identified precisely as depicted in Figure 17.

Figure 19
Depiction of the embedding of T col as established after Claim 2 (in the proof of Lemma 68). Solid lines depict edges, dashed lines depict paths, and dash-dotted lines depict sequences of edges (the identification of the endpoints of which has not yet been determined). Note that we have not yet determined how the endpoints inside of the colour classes V 1 i and V 2 i are identified either; this is depicted by the dotted circles inside these colour classes. Proving that the embedding of T col is as depicted in Figure 17 requires us to show that all endpoints in V 2 i are identified, and that all endpoints in V 1 i , except for x 1 i , are identified.
Consider z 1 i , and recall that is has degree at least 3 by Claim 5, and assume for contradiction that it is not a source of T col . Then z 1 i = x 1 i , and T col [E a i ] is a path, and x 2 i is source (since it is the only vertex in V (T col ) ∩ V 2 i that might have degree at least 3, except for z 2 i ). Note that this also implies that z 2 i is a source. Thus {ẑ 1 i ,ẑ 2 i } = {x 2 i , z 2 i }. In this case, we have . Consequently, using (11) and (12), we have Φ col < Φ, which is a contradiction. Thus z 1 i is a source of T col , and a similar argument shows that z 2 i is a source of T col as well. We now prove the remaining items. In what follows, using the previous bulleted item, we can assume that w.l.o.g.ẑ 1 i = z 1 i andẑ 2 i = z 2 i for all i ∈ [k]. First, recall that we ordered the s j i by their leaf-degrees, that is deg L (s 1 1 ) ≥ deg L (s 2 1 ) ≥ · · · ≥ deg L (s 2 k ) ≥ 2 . If x 1 1 were equal to z 1 1 , then T col can only be connected if there is only one vertex in V 1 1 , that is, all edges incident to V 1 1 are in fact incident to z 1 1 . However, in that case, we have deg L (z 1 1 ) = deg L (s 1 1 ) + 1 (by construction ofĜ), and thus the multi-sets cannot be equal anymore. Hence x 1 1 ̸ = z 1 1 . If x 1 1 had degree 2, then there would have been a ray of length at least a + 1 that originates in V 2 1 (otherwise T col would have been disconnected). However, this ray would neither be external, nor among the rays inR, contradicting either Lemma 73 or the previous sequence of claims. Finally, if x 1 1 had degree at least 3, then T col would have contained more sources than T , which also yields a contradiction. This shows that x 1 1 has degree 1. However, this implies that T col can only contain one vertex in V 2 i ; otherwise T col would be disconnected. Note that we have just proved the remaining items of Claim 7 for i = 1. Additionally, we have shown that deg L (z 1 1 ) = deg L (s 1 1 ) and deg L (z 2 1 ) = deg L (s 2 1 ) Hence we can remove those two numbers from the multi-sets and continue recursively with i = 2. This concludes the proof of Claim 7, and thus the proof of the overall lemma.

◀
We are now ready to conclude the case for trees of unbounded fork number. Proof. We proceed similarly to Lemma 44. However, we have to take care of some subtleties. First, we start with a class C of cubic bipartite graphs of unbounded treewidth. Next, we wish to rely on Lemma 68 to obtain the identity ⊕Emb((Q ♯ τ, c τ ) → (G, c)) = ⊕ColSub(T → (Ĝ,γ)), where τ is the fracture defined in Definition 61. Unfortunately, Lemma 68 only yields the above identity if, for each v ∈ V (Q), |c −1 (v)| is odd, that is, each colour class of vertices of G has odd cardinality. However, this property can easily be achieved. Let (G ′ , c ′ ) be the Q-coloured graph obtained from (G, c) by adding to each even colour class one fresh isolated vertex. Since Q ♯ τ does not have isolated vertices, this operation does not change the number of colour-preserving embeddings. In combination with Lemma 68 we thus obtain ⊕Emb((Q ♯ τ, c τ ) → (G, c)) = ⊕Emb((Q ♯ τ, c τ ) → (G ′ , c ′ )) = ⊕ColSub(T → (Ĝ ′ ,γ)).
From here on, we can proceed analogously to the proof of Lemma 44. ◀

The Dichotomy Theorem for Trees
We are now able to prove Theorem 5, i.e., an exhaustive and explicit parameterised complexity classification for counting trees modulo 2: ▶ Theorem 5. Let T be a recursively enumerable class of trees. If T is matching splittable, then ⊕Sub(T ) is fixed-parameter tractable. Otherwise ⊕Sub(T ) is ⊕W[1]-complete.
Proof. The fixed-parameter tractability result, as well as the fact that ⊕Sub(T ) is always contained in ⊕W [1] were both shown in [12]. Hence, it remains to prove ⊕W[1]-hardness if T is not matching splittable. By Lemma 32 each class T of trees that is not matching splittable has unbounded C-number, unbounded star number, or unbounded fork number. Finally, each of these three cases yields ⊕W[1]-hardness as established by Lemmas 44, 56, and 74. ◀

Conclusion and Open Questions
Given a class H of patterns, the problem ⊕Sub(H) asks, given as input a graph H ∈ H and an arbitrary graph G, to count the subgraphs of G that are isomorphic to H. This work is motivated by the conjecture of Curticapean, Dell and Husfeldt (Conjecture 1) that ⊕Sub(H) is FPT if and only if H is matching splittable.
Recall that the matching-split number of H is the minimum size of a set S ⊆ V (H) such that H \ S is a matching. The class H is matching splittable if there is a positive integer B such that the matching-split number of any H ∈ H is at most B.
In this work, Theorem 4 proves the conjecture for every hereditary class of graphs. Theorem 5 proofs the conjecture for every class H of trees.
Clearly, the most important task for related future work is to fully resolve the conjecture. Our work has shown that the use of edge-colours, formalised by the framework of fractured graphs, makes it possible to bypass the problem caused by automorphism groups that have even cardinality. We think that this approach will be useful for future work.