# Transducing paths in graph classes with unbounded shrubdepth

Patrice Ossona de Mendez, Michal Pilipczuk, Sebastian Siebertz

<figure><img src="image_1.png" /></figure>

► To cite this version:

Patrice Ossona de Mendez, Michal Pilipczuk, Sebastian Siebertz. Transducing paths in graph classes with unbounded shrubdepth. European Journal of Combinatorics, 2022, 123, pp.103660. 10.1016/j.ejc.2022.103660. hal-05495110

HAL Id: hal-05495110

https://hal.science/hal-05495110v1

Submitted on 5 Feb 2026

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
Transducing paths in graph classes with unbounded shrubdepth

Patrice Ossona de Mendez

Centre d'Analyse et de Mathématiques Sociales (CNRS, UMR 8557), Paris, France and Computer Science Institute of
Charles University, Praha, Czech Republic

Michał Pilipczuk

University of Warsaw, Poland

Sebastian Siebertz

University of Bremen, Germany

**Abstract**

Transductions are a general formalism for expressing transformations of graphs (and more generally, of relational structures) in logic. We prove that a graph class $\mathcal{C}$ can be FO-transduced from a class of bounded-height trees (that is, has *bounded shrubdepth*) if, and only if, from $\mathcal{C}$ one cannot FO-transduce the class of all paths. This establishes one of the three remaining open questions posed by Blumensath and Courcelle about the MSO-transduction quasi-order, even in the stronger form that concerns FO-transductions instead of MSO-transductions.

The backbone of our proof is a graph-theoretic statement that says the following: If a graph $G$ excludes a path, the bipartite complement of a path, and a half-graph as semi-induced subgraphs, then the vertex set of $G$ can be partitioned into a bounded number of parts so that every part induces a cograph of bounded height, and every pair of parts semi-induce a bi-cograph of bounded height. This statement may be of independent interest; for instance, it implies that the graphs in question form a class that is linearly $\chi$-bounded.

**Keywords:** shrubdepth, first-order transduction, $\chi$-boundedness

<figure><img src="image_3.png" /></figure>

<figure><img src="image_4.png" /></figure>

DFG
Deutsche
Forschungsgemeinschaft

Email addresses: pom@ehess.fr (Patrice Ossona de Mendez), michal.pilipczuk@mimuw.edu.pl (Michał Pilipczuk), siebertz@uni-bremen.de (Sebastian Siebertz)

<footnote>*This paper is part of projects that have received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreements No 810115 – DYNASNET and 948057 – BOBR) and from the German Research Foundation (DFG) with grant agreement No 444419611.</footnote>
# 1. Introduction

## 1.1. Background and the main result

**Transductions.** Transductions provide a model theoretical framework for transformations of relational structures definable in logic. In this work we consider only graphs; these will be sometimes *colored*, by which we mean that there can be some unary predicates distinguishing subsets of vertices (not necessarily disjoint).

To define transductions in this setting, we first introduce interpretations. For a logic $\mathcal{L}$, an $\mathcal{L}$-interpretation $I$ consists of two $\mathcal{L}$-formulas $\varphi(x, y)$ and $\psi(x)$. Applying $I$ to a colored graph $G$ yields a new graph $I(G)$, whose vertex set consists of all vertices of $G$ satisfying $\psi$ and whose edge set consists of all pairs of vertices of $G$ satisfying $\varphi$. An $\mathcal{L}$-transduction $T$ is a mechanism of transforming graphs that consists of an $\mathcal{L}$-interpretation $I$. The semantic is as follows: for a (colored) graph $G$, $T(G)$ consists of all graphs that can be obtained from $G$ by first *coloring* $G$ — extending $G$ by the unary predicates used by $I$ and not present in $G$ — in an arbitrary way and then applying $I$. Note that due to the coloring step, $T(G)$ is a set of graphs rather than a single graph: it contains one output per each possible coloring of the input. (See Section 2 for a formal definition. In particular, one usually allows also the operation of copying vertices, which is immaterial here.)

For a graph class $\mathcal{C}$, we define $T(\mathcal{C}) = \bigcup_{G \in \mathcal{C}} T(G)$. We say that a class $\mathcal{C}$ is $\mathcal{L}$-transducible from $\mathcal{D}$ if there is an $\mathcal{L}$-transduction $T$ such that $\mathcal{C} \subseteq T(\mathcal{D})$; we denote this by $\mathcal{C} \sqsubseteq_{\mathcal{L}} \mathcal{D}$. For the standard logics, $\mathcal{L}$-transductions are closed under composition. Hence in this case $\sqsubseteq_{\mathcal{L}}$ is a quasi-order on graph classes; we call it the $\mathcal{L}$-transduction quasi-order. If classes $\mathcal{C}$ and $\mathcal{D}$ are such that $\mathcal{C} \sqsubseteq_{\mathcal{L}} \mathcal{D}$ and $\mathcal{D} \sqsubseteq_{\mathcal{L}} \mathcal{C}$, then we say that $\mathcal{C}$ and $\mathcal{D}$ are $\mathcal{L}$-equivalent.

Depending on the expressive power of $\mathcal{L}$, $\mathcal{L}$-transductions provide containment notions of varying strength for graphs and for graph classes. In this work we consider $\mathcal{L} \in \{\text{FO, MSO, CMSO}\}$, where FO is the standard first-order logic on graphs, MSO is the *monadic second order logic* that extends FO by the possibility of quantifying over vertex subsets, and CMSO is an extension of MSO by allowing counting modular predicates that can be applied to the cardinalities of sets.

**Shrubdepth.** To make the notion of a transduction more concrete, let us consider the following example. A tree model of a graph $G$ is a labelled rooted tree $T$ such that:

* the vertices of $T$ are labelled with a finite set of labels;

* the leaf set of $T$ is equal to the vertex set of $G$; and

* for every pair of vertices $u, v$ of $G$, whether $u$ and $v$ are adjacent in $G$ depends only on the triple of labels: of $u$, of $v$, and of the lowest common ancestor of $u$ and $v$ in $T$.

(See Section 2 for a formal definition.) Observe that if $T$ is a tree model of $G$ of height $h$ and using a label set of size $k$, then $G$ can be transduced from $T$ using a fixed FO-transduction (that depends on $h$ and $k$). The transduction first introduces a coloring of $T$ that distinguishes vertices with different labels, as well as the leaves and the root. Then, the edge relation of $G$ can be recovered by an FO formula that for given two leaves $u, v$, finds the lowest common ancestor of $u$ and $v$ and compares the relevant triple of labels. Finally, the vertex set is restricted to the leaves of $T$.

Tree models were introduced by Ganian et al. [11, 10] to define a class parameter called *shrubdepth*. Precisely, the *shrubdepth* of a graph class $\mathcal{C}$ is the least $h \in \mathbb{N}$ for which the following holds: there is $k \in \mathbb{N}$ such that every graph of $\mathcal{C}$ admits a tree model of height at most $h$ that uses a set of at most $k$ labels. The argument from the previous paragraph shows that if $\mathcal{C}$ has bounded
shrubdepth, then $\mathcal{C}$ can be FO-transduced from a class of trees of bounded height. As proved in [10], the converse is also true in a very strong sense: every class FO-transducible from a class of bounded-height trees in fact has bounded shrubdepth, and this holds even for the stronger notions of MSO- and CMSO-transductions. Thus, the tree models presented above provide a “canonical form” for FO-, MSO-, and even CMSO-transductions from classes of bounded height trees.

Classes of bounded shrubdepth appear to be an interesting concept on its own. As argued in [10], shrubdepth is an analogue of treedepth suited for the treatment of dense graphs. Classes of bounded treedepth have bounded shrubdepth, classes of bounded shrubdepth that are additionally sparse (say, exclude some fixed biclique as a subgraph) have bounded treedepth and, just as graphs with bounded treedepth are building blocks of graphs in bounded expansion classes [19], graphs with bounded shrubdepth are building blocks of graphs in FO-transductions of bounded expansion classes [8]. Also, shrubdepth is functionally equivalent to several other parameters such as *rankdepth* and *SC-depth*, in the sense that the boundedness of one is equivalent to the boundedness of the others. It is noteworthy that any hereditary class with bounded shrubdepth can be defined by the exclusion of a finite number of induced subgraphs [10].

**MSO-transductions.** The MSO-transduction quasi-order has been studied by Blumensath and Courcelle in [1], who described the following structure. For $n \in \mathbb{N}$, let $\mathcal{F}_n$ be the class of rooted forests of height $n$; here, the height of a forest is the length of the longest root-to-leaf path, hence $\mathcal{F}_0$ is the class of edgeless graphs. Further, let $\mathcal{P}$ be the class of all paths, $\mathcal{T}$ be the class of all trees, and $\mathcal{G}$ be the class of all graphs. Clearly, we have

$$ \emptyset \sqsubseteq_{\text{MSO}} \mathcal{F}_0 \sqsubseteq_{\text{MSO}} \mathcal{F}_1 \sqsubseteq_{\text{MSO}} \dots \sqsubseteq_{\text{MSO}} \mathcal{F}_n \sqsubseteq_{\text{MSO}} \dots \sqsubseteq_{\text{MSO}} \mathcal{P} \sqsubseteq_{\text{MSO}} \mathcal{T} \sqsubseteq_{\text{MSO}} \mathcal{G}. $$

Up to MSO-transduction equivalence, these classes correspond to the classes with bounded shrubdepth (transducible from $\mathcal{F}_n$ for any $n \in \mathbb{N}$), classes with bounded linear cliquewidth (transducible from $\mathcal{P}$), and classes with bounded cliquewidth (transducible from $\mathcal{T}$). In [1], Blumensath and Courcelle proved that this hierarchy is strict. They conjectured that it is also complete in the following sense: every graph class is MSO-equivalent to one of the classes in the hierarchy; see [1, Open Problem 9.3].

This conjecture was confirmed for the initial prefix of the hierarchy by Ganian et al. [10] in the following sense: if $\mathcal{C} \sqsubseteq_{\text{MSO}} \mathcal{F}_m$ for some $m \in \mathbb{N}$ (equivalently, $\mathcal{C}$ has bounded shrubdepth), then in fact $\mathcal{C}$ is MSO-equivalent to $\mathcal{F}_n$ for some $n \in \mathbb{N}$. Therefore, to resolve the open problem of Blumensath and Courcelle it remains to prove the following three conjectures.

**Conjecture 1.** A class $\mathcal{C}$ of graphs has bounded shrubdepth if, and only if, the class of all paths is not MSO-transducible from $\mathcal{C}$.

**Conjecture 2.** A class $\mathcal{C}$ of graphs has bounded linear cliquewidth if, and only if, the class of all trees is not MSO-transducible from $\mathcal{C}$.

**Conjecture 3.** A class $\mathcal{C}$ of graphs has bounded cliquewidth if, and only if, the class of all grids is not MSO-transducible from $\mathcal{C}$.

We note that a positive resolution of Conjecture 3 would establish another long-standing open problem, *Seese's Conjecture*.

Conjectures 1 and 3 have been established in weaker forms, where one replaces MSO-transductions with CMSO-transductions. More precisely, Kwon et al. [17] proved that every graph class of unbounded shrubdepth contains all paths as vertex-minors, and Courcelle and Oum [6] proved that every graph class of unbounded cliquewidth contains all grids as vertex-minors. Since the vertex-minor relation can be expressed by a CMSO-transduction [6], this
yields right-to-left implications of the CMSO-variants of Conjectures 1 and 3. The left-to-right implications are well-known to hold.

**FO-transductions.** Compared to the above, much less is known about FO-transductions and the picture appears to be much more complicated; see [22]. However, in recent years there has been an attempt of constructing a sound structural theory for well-structured dense graphs based on this notion; see e.g. [2, 3, 7, 8, 9, 20, 21]. In particular, the following conjectures have been formulated about characterizations of shrubdepth, linear cliquewidth, and cliquewidth in terms of FO-transductions. These are strengthenings of Conjectures 1 to 3, respectively.

*Conjecture 4* ([22], repeated in [9]). A class $\mathcal{C}$ of graphs has bounded shrubdepth if, and only if, the class of all paths is not FO-transducible from $\mathcal{C}$.

*Conjecture 5* ([9]). A class $\mathcal{C}$ of graphs has bounded linear cliquewidth if, and only if, no class containing some subdivision of every binary tree is FO-transducible from $\mathcal{C}$.

*Conjecture 6* ([9]). A class $\mathcal{C}$ of graphs has bounded cliquewidth if, and only if, no class containing some subdivision of every wall is FO-transducible from $\mathcal{C}$.

In this work we prove Conjecture 4. As shown in [10], the class of all paths does not have bounded shrubdepth, hence it is not FO-transducible (equivalently, MSO- or CMSO-transducible) from any class with bounded shrubdepth (equivalently, from any class of bounded height trees). Therefore, Conjecture 4 follows from the next theorem, which is the main result of our paper.

**Theorem 1.1.** If the class of all paths is not FO-transducible from a class of graphs $\mathcal{C}$, then $\mathcal{C}$ has bounded shrubdepth.

Since every FO-transduction is also an MSO-transduction, this also confirms Conjecture 1. More generally, together with the results of [10], Theorem 1.1 proves that the property of having bounded shrubdepth is the largest property of graph classes that is closed under taking FO-transductions (is a so-called FO-transduction ideal) and whose restriction to classes that exclude a fixed biclique as a subgraph is the property of having bounded treedepth.

## 1.2. *Graph-theoretic statements*

The main idea behind the proof of Theorem 1.1 is to analyze graphs that exclude some simple substructures from which long paths can easily be transduced. These are: paths, complements of paths, and half-graphs. We prove two purely graph-theoretic statements which explain that graphs excluding the substructures mentioned above can be nicely decomposed into cographs. We need a few definitions to state the decomposition theorems formally.

For a graph $G$ and disjoint subsets of vertices $A, B \subseteq V(G)$, by $G[A]$ we denote the subgraph induced by $A$ in $G$, and by $G[A, B]$ we denote the bipartite graph *semi-induced* by $A$ and $B$ in $G$. The latter is the graph with vertex set $A \cup B$ and edge set comprising of all edges of $G$ with one endpoint in $A$ and second in $B$. By $P_t$, $\bar{P}_t$, and $\tilde{P}_t$ we respectively denote the path on $t$ vertices, its complement, and its *bipartite complement*: the graph obtained from $P_t$ by taking its unique bipartition $A, B$ and complementing the edge relation on the set $A \times B$. We also use the order-$k$ *half-graph* $H_k$, and the order-$k$ *universal threshold graph* $R_k$; see Figure 1.

For decompositions we rely on the well-known class of *cographs* (that is, $P_4$-free graphs) and on their bipartite counterparts, *bi-cographs* (see Section 2 for a definition). For a graph $G$, a *cosplit* of $G$ is a partition $\mathcal{P}$ of the vertex set of $G$ such that for every part $A \in \mathcal{P}$, the induced subgraph $G[A]$ is a cograph. A cosplit $\mathcal{P}$ is moreover a 2-cosplit if for every pair of distinct parts
<figure><img src="image_5.png" /><figcaption>Figure 1: Left: the half-graph $H_k$. Right: the universal threshold graph $R_k$.</figcaption></figure>

A, B ∈ P, the semi-induced bipartite graph G[A, B] is a bi-cograph. The height of a cosplit P is the maximum height of the cographs in {G[A] : A ∈ P}, where the height of a cograph is the height of its cotree. We define the height of a 2-cosplit analogously, but we also take into account the heights of bi-cographs in {G[A, B] : A, B ∈ P, A ≠ B}. Note that the height of a 2-cosplit P may be larger than the height of P treated as a (standard) cosplit; this distinction will be always clear from the context. The size of a cosplit P is simply |P|. The minimum size of a cosplit of a graph G is its c-chromatic number (also called P₄-chromatic number) [13].

Our main decomposition results can be now stated as follows.

**Theorem 1.2.** For every pair of integers $t, k \in \mathbb{N}$ there exists $N \in \mathbb{N}$ such that the following holds: Every graph that excludes $P_t, \bar{P}_t$, and $R_k$ as induced subgraphs admits a cosplit of size at most *N* and height at most 4k.

**Theorem 1.3.** For every pair of integers $t, k \in \mathbb{N}$ there exists $N \in \mathbb{N}$ such that the following holds: Every graph that excludes $P_t, \bar{P}_t$, and $H_k$ as semi-induced subgraphs admits a 2-cosplit of size at most *N* and height at most 4k.

Thus, Theorem 1.3 provides a much stronger form of a decomposition — a 2-cosplit instead of a cosplit — at the expense of a stronger assumption about the excluded substructures. We note that our proofs yield bounds $N \le 4 \cdot (2t - 5)^{k-1}$ in case of Theorem 1.2 (for $t \ge 4$) and $N \le 3^{2^k \cdot t^{3k-2}}$ in case of Theorem 1.3 (for $t \ge 5$). In the proof of Theorem 1.1 we use only Theorem 1.3, but Theorem 1.2 is actually a stepping stone in the proof of Theorem 1.3 and provides some interesting corollaries on its own; we will discuss these later.

The proofs of Theorems 1.2 and 1.3 rely on the influential Gyárfás' path method [15]. Through a suitable understanding, this method provides a convenient decomposition notion for $P_t$-free graphs, which we call a *Gyárfás decomposition*. We sometimes consider a Gyárfás decomposition of the graph itself and sometimes of its complement; this is why we assume that the graph excludes both $P_t$ and its (bipartite) complement. The main idea is to apply induction where the measure of progress is (roughly) the largest *k* such that $R_k$ or $H_k$ can be found as a (semi-)induced subgraph. This choice was inspired by the work of Gajarský et al. [9].

The proof of Theorem 1.1 proceeds roughly as follows. The left-to-right implication is known [10], hence it remains to show that if from a class of graphs $\mathcal{C}$ one cannot transduce
the class of all paths, then $\mathcal{C}$ has bounded shrubdepth. The assumption implies that there are some $t, k \in \mathbb{N}$ such that all graphs in $\mathcal{C}$ exclude $P_t$, $\bar{P}_t$, and $H_k$ as semi-induced subgraphs. By Theorem 1.3, every graph $G \in \mathcal{C}$ admits a 2-cosplit of bounded size and height. This allows us to sparsify $G$, that is, find a sparse graph $G'$ that encodes $G$ in the following sense: both $G'$ can be transduced from $G$ and $G$ can be transduced back from $G'$. Letting $\mathcal{D}$ be the class comprised of all graphs $G'$ as above, we still have that from $\mathcal{D}$ one cannot transduce the class of all paths, but now moreover we have that $\mathcal{D}$ is sparse (formally, it is degenerate). Using known connections between treedepth and the existence of long paths one can now argue that $\mathcal{D}$ actually has bounded treedepth. So $\mathcal{C}$, being transducible from $\mathcal{D}$, has bounded shrubdepth.

### 1.3. Other corollaries

Finally, we discuss several other statements that can be inferred from Theorems 1.2 and 1.3. The first one concerns $\chi$-boundedness of the considered graph classes. Recall that a class of graphs $\mathcal{C}$ is $\chi$-bounded if there is a function $f: \mathbb{N} \to \mathbb{N}$ such that $\chi(G) \le f(\omega(G))$ for every graph $G \in \mathcal{C}$, where $\chi(G)$ and $\omega(G)$ respectively denote the chromatic number and the clique number of $G$. If $f$ can be additionally chosen to be a linear function, then $\mathcal{C}$ is linearly $\chi$-bounded. It is known that for every $t \in \mathbb{N}$, graphs excluding $P_t$ as an induced subgraph are $\chi$-bounded [15]. We show that if one additionally excludes the complement of a path and a universal threshold graph, then the resulting class is even linearly $\chi$-bounded.

**Corollary 1.1.** For every pair of integers $t, k \in \mathbb{N}$, the class of graphs that exclude $P_t$, $\bar{P}_t$, and $R_k$ as induced subgraphs is linearly $\chi$-bounded.

*Proof.* By Theorem 1.2, there exists an integer $N$ such that every graph $G$ that excludes $P_t$, $\bar{P}_t$, and $R_k$ as induced subgraphs has a cosplit $\mathcal{P}$ of size at most $N$. As cographs are perfect we have

$$ \chi(G) \le \sum_{X \in \mathcal{P}} \chi(G[X]) = \sum_{X \in \mathcal{P}} \omega(G[X]) \le N\omega(G). \quad \square $$

We remark that in Corollary 1.1, excluding a path and an antipath is not sufficient to guarantee linear $\chi$-boundedness, for the following reason. The lexicographic product of two $P_t$-free graphs is $P_t$-free and, as the complement of the lexicographic product of two graphs is (isomorphic to) the product of their complements, the same holds for $\bar{P}_t$-free graphs. So, consider a triangle-free graph $G_t$ with $t$ vertices and fractional chromatic number $\chi_f(G_t) \ge \frac{1}{9}\sqrt{t/\log t}$ (see [16]). Obviously, $G_t$ is $P_{t+1}$-free. The lexicographic powers of $G_t$ are $P_{t+1}$ and $\bar{P}_{t+1}$-free and have chromatic number $\chi(G) \ge \omega(G)^{\log_2 \chi_f(G_t)}$ (see, for example, [20]). Hence, the exponent of $\omega(G)$ has to grow at least as $(1-o(1)) \log_2 t$. For instance, the lexicographic powers of $C_5$ exclude both $P_5$ and $\bar{P}_5$ as induced subgraph and satisfy $\chi(G) \ge \omega(G)^c$, where $c = \log_2 \chi_f(C_5) = \log_2 5 - 1 \approx 1.32$.

The next corollary concerns the Erdős-Hajnal property of graphs excluding a universal threshold graph. Recall that a graph class $\mathcal{C}$ has the Erdős-Hajnal property if there exists $\delta > 0$ such that every $n$-vertex graph $G \in \mathcal{C}$ contains a homogeneous set — a clique or an independent set — of size at least $n^\delta$. It can be derived from the stable regularity lemma of Malliaris and Shelah [18] that for every $k \in \mathbb{N}$, graphs excluding $R_k$ as an induced subgraph have the Erdős-Hajnal property.
See also [4], and [23, Theorem 2.8 in Chapter 5] for a streamlined presentation<fnref n="1" /> yielding $\delta = \frac{1}{2k+2}$.
We now show that from Theorem 1.2 one can infer essentially the same result.

**Corollary 1.2.** Every graph $G$ on $n$ vertices that does not contain $R_k$ as an induced subgraph contains a homogeneous set of size at least $n^{1/2k}/4$.

*Proof*. As shown in the proof, for $t \ge 4$, the value of $N$ in Theorem 1.2 can be upper bounded by $4 \cdot (2t - 5)^{2k-2}$. Let $h$ be the maximum size of a homogeneous subset in $G$; we may assume that $h \ge 2$. Obviously, $G$ excludes $P_{2h+1}$ and $\overline{P}_{2h+1}$ as induced subgraphs, for taking every second vertex of such an induced subgraph would yield a homogeneous set of size $h+1$. Thus, by Theorem 1.2, $G$ admits a cosplit of size at most $p = 4 \cdot (4h-3)^{2k-2}$. Hence, $G$ contains an induced cograph with at least $n/p$ vertices. It is well-known that every cograph on $m$ vertices contains a homogeneous set of size at least $\sqrt{m}$, hence $G$ contains a homogeneous set of size at least $\sqrt{n/p}$. It follows that $n/p \le h^2$, that is, $n \le 4(4h-3)^{2k-2}h^2 < (4h)^{2k}$. Hence, $h > n^{1/2k}/4$. $\square$

Here is another corollary, this time of Theorem 1.3. It is easy to see that for every fixed $h \in \mathbb{N}$, cographs of height at most $h$ and bi-cographs of height at most $h$ form classes that are set-defined. Here, a class is *set-defined* if it comprises of induced subgraphs of a single infinite graph that is FO-interpretable in the countable pure set (a set with no relations); see [14] for a wider discussion. From Theorem 1.3 it then follows that for every fixed $t, k \in \mathbb{N}$, graphs excluding $P_t, \tilde{P}_t$ and $H_k$ as semi-induced subgraphs are also set-defined. Applying the results of [14], we conclude that these graphs have *bounded discrepancy* in the following sense.

**Corollary 1.3.** For every pair of integers $t, k \in \mathbb{N}$ there exists a constant $C$ such that every graph $G$ that excludes $P_t, \tilde{P}_t$ and $H_k$ as semi-induced subgraphs can be 2-colored in such a way that for every vertex $u$ of $G$, the difference between the numbers of neighbors of $u$ in each of the colors is at most $C$.

## 2. Preliminaries

*Graph notation.* We use standard notation for graphs. Whenever speaking about bipartite graphs, we always assume that the graph is given together with a fixed *bipartition*: a partition of the vertex set into two independent sets, called *sides*. Note that the bipartition is unique if the bipartite graph is connected.

The *complement* of a graph $G$, denoted $\overline{G}$, is the graph on the same vertex set where two vertices are adjacent if and only if they are non-adjacent in $G$. The *bipartite complement* of a bipartite graph $G$, denoted $\tilde{G}$, the bipartite graph on the same vertex set as $G$ and with the same bipartition, where two vertices from different sides of the bipartition are adjacent if and only if they were non-adjacent in $G$. Note that the bipartite complement of a bipartite graph may differ from its (standard) complement when treated as a (non-bipartite) graph. This distinction will be always clear from the context.

By $P_t$ we denote the path on $t$ vertices. Consequently, $\overline{P_t}$ and $\tilde{P_t}$ are respectively the complement and the bipartite complement of $P_t$ (taken with respect to the unique bipartition). We also consider

<footnote n="1">¹The statement presented in [23] assumes excluding a half-graph as a semi-induced subgraph, but the proof actually works also for excluding a universal threshold graph as an induced subgraph.</footnote>
the half-graph of order k, denoted $H_k$, and the universal threshold graph of order k, denoted $R_k$. These are depicted in Figure 1 and defined as follows. In both cases, the vertex set consists of vertices $a_1, ..., a_k, b_1, ..., b_k$, there are edges $a_ib_j$ for all $1 \le i \le j \le k$, and the vertices $b_1, ..., b_k$ form an independent set. The difference is that in $H_k$ the vertices $a_1, ..., a_k$ also form an independent set, while in $R_k$ they form a clique. We shall treat $H_k$ as a bipartite graph; the bipartition is $\{\{a_1, ..., a_k\}, \{b_1, ..., b_k\}\}$.

The name of $R_k$ — the universal threshold graph of order k — is motivated by the following easy fact. Here, a threshold graph is a graph that can be obtained from the empty graph by iteratively adding a universal vertex or an isolated vertex.

**Fact 2.1.** Every threshold graph with at most k vertices is an induced subgraph of $R_k$.

For a graph $G$ and a subset of vertices $A$, by $G[A]$ we denote the subgraph of $G$ induced by $A$. For disjoint $A, B \subseteq V(G)$, by $G[A, B]$ we denote the bipartite subgraph semi-induced by $A$ and $B$: it is the bipartite graph with bipartition $\{A, B\}$ where $u \in A$ and $v \in B$ are adjacent if and only if $u$ and $v$ are adjacent in $G$. Note that thus, $A$ and $B$ are independent sets in $G[A, B]$.

**Shrubdepth, cographs and bi-cographs.** A rooted tree is a tree with a distinguished vertex, its root. The height of a rooted tree is the maximum number of edges in a root-to-leaf path. Every rooted tree $T$ defines a partial order $\le_T$ on its vertex set: $u \le_T v$ if $u$ and $v$ the (unique) path from the root to $v$ contains $u$. If $u \le_T v$ we say that $u$ is an ancestor of $v$ in $T$. The least common ancestor $u \wedge_T v$ of two vertices is the maximum vertex $w$ (with respect to $\le_T$) with $w \le_T u$ and $w \le_T v$. For a rooted tree $T$, we denote by $L(T)$ the set of leaves of $T$ which are the vertices of $T$ that are maximal in $\le_T$, and by $I(T)$ the set of internal vertices of $T$, which is defined by $I(T) = V(T) \setminus L(T)$.

The following notion of a tree model generalizes the notion of a cotree of a cograph and will allow a unified approach to cographs, bi-cographs, and shrub-depth. Let $k, h$ be positive integers. A k-colored height-h tree model is a triple $(T, c, f)$, where $T$ is a rooted tree with height at most $h$, $c: L(T) \to [k]$ is a coloring of the leaves of $T$, and $f: I(T) \times [k] \times [k] \to \{0, 1\}$ is a function that is symmetric on its two last arguments: $f(x, y, z) = f(x, z, y)$. A k-colored height-h tree $(T, c, f)$ defines a graph $G$ with vertex set $L(T)$ and edge set

$$E(G) = \{(u, v) \in V(G) \times V(G) : u \neq v \text{ and } f(u \wedge_T v, c(u), c(v)) = 1\}.$$

In this setting, we have:

* A class $\mathcal{C}$ has *bounded shrub-depth* if there exist integers $k, h$ such that every graph in $\mathcal{C}$ is defined by a k-colored height-h tree model.

* A graph is a *cograph* [5] (with *height* at most $h$) if it is defined by a 1-colored (height-h) tree model. In this case, the tree model is called a *cotree*.

* A bipartite graph is a *bi-cograph* [12] (with *height* at most $h$) if it is defined by a 2-colored (height-h tree) model in which the coloring $c$ is the coloring defined by the bipartition of the vertex set. (Thus, $f(x, 1, 1) = f(x, 2, 2) = 0$ for every internal vertex $x$ of the tree model.) In this case, the tree model is called a *bi-cotree*.

It is instructive to take a closer look at the combinatorics of cotrees and bi-cotrees. Suppose $T$ is a cotree of a cograph $G$ and $x$ is an internal vertex of $T$. Then the subtree of $T$ rooted at $x$
defines the subgraph of G induced by the leaves of T that are descendants of x. Further, depending on whether $f(x, 1, 1) = 0$ or $f(x, 1, 1) = 1$, this subgraph is either the disjoint union or the join of subgraphs defined by the subtrees rooted at the children of x. Here, the join of a collection of graphs is obtained by taking their disjoint union and making every pair of vertices originating from different graphs adjacent. For bi-cotrees we have a similar characterization, except that the cases $f(x, 1, 2) = f(x, 2, 1) = 0$ and $f(x, 1, 2) = f(x, 2, 1) = 1$ correspond to taking the bipartite disjoint union or the bipartite join of bipartite graphs, defined analogously.

We also have the following.

**Fact 2.2.** A graph G is a bi-cograph with height h if and only if it is a semi-induced subgraph of a cograph with height h.

*Proof.* Assume G is a semi-induced subgraph of a cograph H with height h. By considering an induced subgraph if necessary, we may assume $V(G) = V(H)$. Let $(T, c, f)$ be a 1-colored height-h tree model of H and let A and B be the sides of G. Let $c' : V(G) \to [2]$ be defined by $c'(v) = 1$ if $v \in A$ and $c'(v) = 2$, otherwise. Let $f' : I(T) \times [2] \times [2] \to \{0, 1\}$ be defined by setting $f'(x, 1, 1) = f'(x, 2, 2) = 0$ and $f'(x, 1, 2) = f'(x, 2, 1) = f(x, 1, 1)$, for every internal vertex x of T. Then $(T, c', f')$ is a 2-colored height-h tree model of $H[A, B]$, that is, of G.

Conversely, assume G is a bi-cograph with sides A and B and a 2-colored height-h tree model $(T, c', f')$. Let $c : L(T) \to [1]$ be the constant function, and let $f : I(T) \times [1] \times [1] \to \{0, 1\}$ be defined by setting $f(x, 1, 1) = f'(x, 1, 2)$ for every internal vertex x of T. Then $(T, c, f)$ is a 1-colored height-h tree model of a cograph H with $H[A, B] = G$. □

*Transductions.* We start by recalling some general definitions on relational structures. Then, we will focus on (uncolored or colored) graphs.

Recall that a (relational) signature is a set $\sigma$ of relation symbols, each with a prescribed arity. To a signature $\sigma$ we associate the signature $\sigma^+$ obtained by adding to $\sigma$ a countable set of unary predicates $\{P_i : i \in \mathbb{N}\}$. In this paper we consider only the signature $\sigma_0$ of (uncolored) graphs, which consists of a single relation symbol E with arity 2, and the signature $\sigma_0^+$, where the added predicates distinguish subsets of vertices. We often call those subsets *colors*, but mind that we do not assume that they are disjoint: a vertex can be assigned any subset of colors. Thus, uncolored graphs are $\sigma_0$-structures and colored graphs are $\sigma^+$-structures.

Let $\sigma$ be a signature of relational structures. A *coloring* of a $\sigma$-structure $\mathbf{A}$ is any $\sigma^+$-structure obtained from $\mathbf{A}$ by interpreting the predicates $\{P_i : i \in \mathbb{N}\}$ in any way<fnref n="2" />.

Let $\sigma, \tau$ be two signatures. For a $\sigma$-structure $\mathbf{A}$ and a formula $\varphi$ with $k$ free variables, we define

$$ \varphi(\mathbf{A}) = \{(v_1, \dots, v_k) \in A^k : \mathbf{A} \models \varphi(v_1, \dots, v_k)\}. $$

A simple interpretation of $\tau$-structures in $\sigma$-structures is a tuple $I = (\rho_R)_{R \in \tau \cup \{0\}}$ of first-order formulas such that $\rho_0$ has a single variable and $\rho_R$ has $k$ free variables if $k$ is the arity of $R$. For a $\sigma$-structure $\mathbf{A}$, the $\tau$-structure $I(\mathbf{A})$ has domain $\rho_0(\mathbf{A})$ and is such that for each $R \in \tau$ with arity $k_R$ we have $R(\mathbf{B}) = \rho_R(\mathbf{A}) \cap \rho_0(\mathbf{A})^{k_R}$.

<footnote n="2">²This mapping can be arbitrary. In particular, the predicates do not need to be defined by any formula.</footnote>
A (non copying) transduction<fnref n="3" /> T is defined by an interpretation I in colored graphs. The semantic is as follows: for an uncolored graph G, we set

$$T(G) = \{I \circ \Lambda(G) : \Lambda \text{ is a coloring of } G\}.$$

In other words, one can think of a transduction as of a non-deterministic mechanism that inputs a graph, colors it arbitrarily, and applies a fixed interpretation at the end. Then $T(G)$ is the set of all graphs that can be obtained in this manner. Note that even though there exist infinitely many colorings of G, only a finite numbers of predicates appear in the formulas defining the interpretation I. Hence, for a graph G, the set $T(G)$ is always finite.

For a class of graphs $\mathcal{C}$ we define $T(\mathcal{C}) = \bigcup_{G \in \mathcal{C}} T(G)$. The terminology above can be lifted to colored graphs (and in fact, to relational structures) in the expected manner; we assume here that all unary predicates introduced in the coloring step are distinct from all unary predicates already used in the graph.

We note that the composition of two transductions is a transduction. A class of graphs $\mathcal{D}$ can be transduced from a class of graphs $\mathcal{C}$ if there exists a transduction $T$ such that $\mathcal{D} \subseteq T(\mathcal{C})$. Two classes $\mathcal{C}$ and $\mathcal{D}$ are called transduction-equivalent if $\mathcal{D}$ can be transduced from $\mathcal{C}$ and $\mathcal{C}$ can be transduced from $\mathcal{D}$.

We shall consider a very restricted type of interpretations.

* A formula $\eta(x, y)$ in the signature of (colored) graphs naturally defines a simple interpretation $I_\eta$ of (colored) graphs in (colored) graphs, where $\rho_0$ is a tautology (i.e. a formula that is always satisfied), $\rho_E(x, y) := (x \neq y) \wedge (\eta(x, y) \vee \eta(y, x))$, and (if the target structure is colored) $\rho_{P_i}(x) := P_i(x)$. (Note that the formula $\eta$ can make use of the predicates $P_i$ if the source graphs are colored.)

* A simple equivalence of two classes $\mathcal{C}$ and $\mathcal{D}$ of (colored) graphs is a pair $(\phi, \psi)$ of first-order formulas such that $I_\phi$ is a bijection from $\mathcal{C}$ to $\mathcal{D}$ with the inverse mapping being $I_\psi$. That is, $I_\psi \circ I_\phi$ is the identity on $\mathcal{C}$.

Note that the existence of a simple equivalence between two classes $\mathcal{C}$ and $\mathcal{D}$ is a very strong form of transduction equivalence.

### 3. Gyárfás decomposition

As explained in Section 1, our main tool will be the Gyárfás’ path argument [15]. For convenience, we encapsulate it in an abstract notion of a *Gyárfás decomposition*. We shall see that this decomposition is very close to the one used to define treedepth and, more generally, to the property of Trémaux trees (a.k.a. Depth-First Search trees).

*Definition 3.1.* A *Gyárfás decomposition* of a connected graph *G* is a rooted tree *Y* satisfying the following properties:

1. The nodes of *Y* are pairwise disjoint and non-empty subsets of *V*(*G*), called *bags*, whose union is equal to *V*(*G*). In other words, the node set of *Y* is a partition of *V*(*G*).

<footnote n="3">³A more general notion of a transduction allows the so-called copying operation: blowing up every vertex into a bounded size clique. In this paper we prove that the class of all paths can be obtained from any class with unbounded shrubdepth using a non-copying transduction, hence there is no need for this extension.</footnote>
2. The root bag of $Y$ consists of a single vertex, called the *initial vertex* of the Gyárfás decomposition $Y$.

3. If vertices $u, u' \in V(G)$ are adjacent in $G$ and $B, B'$ are bags of $Y$ such that $u \in B$ and $u' \in B'$, then one of the bags $B, B'$ is an ancestor of the other in $Y$. (Note that possibly $B = B'$, as every node is an ancestor of itself.)

4. For every bag $B$ of $Y$, the subgraph of $G$ induced by the union of $B$ and all its descendants in $Y$ is connected.

5. For every non-root bag $B$ of $Y$, there exists a vertex $h(B)$, called the *hook of $B$*, which belongs to the parent of $B$ in $Y$ and satisfies the following property: $h(B)$ is adjacent to all the vertices of $B$ and non-adjacent to all the vertices contained in strict descendants of $B$.

A Gyárfás decomposition of a disconnected graph $G$ is the union of Gyárfás decompositions of the connected components of $G$.

We first note that every graph has a Gyárfás decomposition and that such a decomposition can be efficiently computed. The proof closely follows the construction of Gyárfás' presented in [15].

**Lemma 3.1.** For every connected graph $G$ and vertex $r$ of $G$, there exists a Gyárfás decomposition of $G$ whose initial vertex is $r$. Moreover, given $G$ and $r$, such a Gyárfás decomposition can be computed in polynomial time.

*Proof.* Consider the following recursive procedure that given a connected graph $G$ and a non-empty subset of vertices $A$, constructs a decomposition of $G$ into a tree of bags with $A$ being the root bag as follows. Consider the connected components $C_1, \dots, C_\ell$ of $G-A$. For each $1 \le i \le \ell$ choose an arbitrary vertex $v_i \in A$ with a neighbor in $C_i$. Such a vertex must exist as $G$ is connected. For each $1 \le i \le \ell$, apply the procedure recursively to $C_i$ (which is connected by definition) and the subset $A_i = N(v_i) \cap V(C_i) \subseteq V(C_i)$. Finally, combine the obtained decompositions by attaching their root bags $A_i$ as children of a new root bag $A$. It is easily checked that if we apply the procedure to $G$ and $A = \{r\}$, then the obtained decomposition is a Gyárfás decomposition of $G$; the vertices $v_i$ serve as hooks. Also, the procedure clearly runs in polynomial time. $\square$

Let $Y$ be a Gyárfás decomposition of a graph $G$. The *level* of a bag $B$ in $Y$ is the length of the path in $Y$ linking $B$ to a root bag. In particular, every root bag has level 0. The *height* of a Gyárfás decomposition $Y$ is just the height of $Y$ treated as a rooted forest; equivalently, it is the maximum level among the bags of $Y$. The key observation of Gyárfás is that excluding a path as an induced subgraph gives an upper bound on the height of a Gyárfás decomposition.

**Lemma 3.2.** Let $Y$ be a Gyárfás decomposition of a $P_t$-free graph $G$. Then the height of $Y$ is at most $t-2$.

*Proof.* Let $B_0 - B_1 - \dots - B_\ell$ be the longest root-to-leaf path in $Y$, where $B_0$ is a root bag. Let $v_\ell$ be any vertex of $B_\ell$, and for $0 \le i < \ell$, let $v_i = h(B_{i+1})$. By item 5 of Definition 3.1, vertices $v_0, v_1, \dots, v_\ell$ induce a path in $G$. Thus $\ell+1 < t$, implying that the height of $Y$ is at most $t-2$. $\square$

Gyárfás decompositions of bipartite graphs will be of prime importance in this paper. In this setting, it is worth noticing the next property (see Figure 2).
**Lemma 3.3.** Let $G$ be a connected bipartite graph, and let $Y$ be a Gyárfás decomposition of $G$. Then every bag of $Y$ is an independent set in $G$. Moreover, vertices in bags of odd levels belong to one side of the bipartition, and vertices in bags of even levels belong to the other side of the bipartition.

*Proof*. The root bag consists of one vertex, hence it is obviously an independent set contained in one side of the bipartition. Further, every other bag is included in the neighborhood of its hook, hence it is an independent set contained in the other side than the hook. The claim follows. □

<figure><img src="image_6.png" /><figcaption>Figure 2: Example of a Gyárfás decomposition of a connected bipartite graph. All bags are independent sets.</figcaption></figure>

**4. Constructing a cosplit: proof of Theorem 1.2**

In this section we prove Theorem 1.2. The main idea is to apply induction on the maximum $k$ such that $R_k$ is an induced subgraph of the considered graph. As in the induction we will often complement the considered graph, it would be convenient if this parameter would not change under complementation. This is not exactly the case, as $R_k$ is not invariant under complementation. For this technical reason, our induction will use the complementation-invariant notion of a *strong index* defined below.

*Definition 4.1.* The strong index of a graph $G$, denoted $sindex(G)$, is the maximum integer $k$ such that $G$ contains distinct vertices $a_1, \dots, a_k, b_1, \dots, b_k$ such that for all $1 \le i < j \le k$, the vertex $a_i$ is adjacent to the vertex $b_j$, the vertex $b_i$ is not adjacent to the vertex $a_j$, the vertices $a_1, \dots, a_k$ form a clique, and the vertices $b_1, \dots, b_k$ form an independent set (see Figure 3).

Note that in the above definition, we do not impose any condition on the adjacency between vertices $a_i$ and $b_i$, for $1 \le i \le k$. For this reason, we have the following simple observation.
<figure><img src="image_7.png" /><figcaption>Figure 3: A configuration witnessing sindex(G) ≥ k.</figcaption></figure>

**Fact 4.1.** For every graph $G$ we have sindex($\bar{G}$) = sindex(G).

*Proof.* As $G \mapsto \bar{G}$ is an involution, it suffices to prove sindex($\bar{G}$) ≥ sindex(G). Let $a_1, \dots, a_k, b_1, \dots, b_k$ witness sindex(G) = k. Then $b_1, \dots, b_k, a_1, \dots, a_k$ witness sindex($\bar{G}$) ≥ k = sindex(G). $\square$

Next, we note that the strong index is functionally equivalent to the largest order of a universal threshold graph that can be found as an induced subgraph.

**Fact 4.2.** Let $G$ be a graph. The maximum integer $k$ such that $G$ contains an induced $R_k$ is between $\lfloor \text{sindex}(G)/2 \rfloor$ or sindex(G). Consequently, if a graph excludes a threshold graph with $k$ vertices as an induced subgraph, then its strong index is smaller than $2k$.

*Proof.* If $G$ contains an induced $R_k$, then sindex(G) ≥ sindex(R_k) = k. Conversely, assume $a_1, \dots, a_k, b_1, \dots, b_k$ witness sindex(G) = k. Then, $a_1, a_3, \dots, a_{2\lfloor k/2 \rfloor-1}, b_2, \dots, b_{2\lfloor k/2 \rfloor}$ induce a graph isomorphic to $R_{\lfloor k/2 \rfloor}$. The last claim follows immediately from Fact 2.1. $\square$

With the notion of strong index understood, we state and prove two lemmas that shall provide the main combinatorial leverage in the induction. Roughly speaking, the idea is that a Gyárfás decomposition of a graph and its complement can be used to decompose the graph into pieces that are simpler in terms of the strong index.

**Lemma 4.1.** Let $G$ be a connected graph and let $Y$ be a Gyárfás decomposition of $G$. Let $B$ be a bag of $Y$ with level $i > 1$. Then sindex($G[B]$) < sindex(G).

*Proof.* By item 5 of Definition 3.1, the hook $h(B)$ is adjacent to all the vertices of $B$. Let $B'$ be the parent bag of $B$ in $Y$. Note that since $i > 1$, $B'$ is not the root bag. By item 5 of Definition 3.1 again, the hook $h(B')$ is non-adjacent to all the vertices of $B$. Let $a_1, \dots, a_k, b_1, \dots, b_k$ witness sindex($G[B]$) = k. Then $h(B), a_1, \dots, a_k, h(B'), b_1, \dots, b_k$ witness sindex(G) > k. $\square$
Lemma 4.2. Let $G$ be a connected graph, $Y$ be a Gyárfás decomposition of $G$, and $B$ be a bag of $Y$ with level 1. Let $C$ be a connected component of $\overline{G[B]}$, $Y_C$ be a Gyárfás decomposition of $C$, and $B'$ be a bag of $Y_C$ with level $j \ge 1$. Then $\text{sindex}(G[B']) < \text{sindex}(G)$.

*Proof.* For bags $B'$ of $Y_C$ with level $j > 1$, the result follows from Lemma 4.1 and Fact 4.1. So assume $j = 1$, that is, $B'$ is a bag of $Y_C$ with level 1.

Let $r$ be the initial vertex of $Y_C$ and $r'$ be the initial vertex of $Y_C$. Note that in $G$, $r$ is adjacent to all the vertices in $B$ and $B' \subseteq B$, while $r'$ is non-adjacent to all the vertices of $B'$. Therefore, if $a_1, \dots, a_k, b_1, \dots, b_k$ witness $\text{sindex}(G[B']) = k$, then $r, a_1, \dots, a_k, r', b_1, \dots, b_k$ witness $\text{sindex}(G) > k = \text{sindex}(G[B'])$. $\square$

With all the tools prepared, we can proceed to the main argument. In essence, it boils down to combining Lemmas 4.1 and 4.2 in an induction on the strong index.

*Proof of Theorem 1.2.* Fix $t$ for the remainder of the proof; we may assume that $t \ge 4$. We shall prove that if a graph $G$ excludes $P_t$ and $\overline{P}_t$ as induced subgraphs and has strong index at most $k$, then $G$ has a cosplit of size at most

$$N_k := \left(3 + \frac{1}{t-3}\right) \cdot (2t-5)^{k-1} - \left(\frac{1}{t-3}\right) \le 4 \cdot (2t-5)^{k-1}.$$

and height at most $2k$. By Fact 4.2, this suffices to infer Theorem 1.2. We apply induction on $k$.

For the base case $k = 1$, consider any vertex $u \in V(G)$, let $X$ be the set of neighbors of $u$, and let $Y = V(G) \setminus X \setminus \{u\}$ be the set of non-neighbors of $u$. As $G$ has strong index 1, it follows that the maximum degree in $G[Y]$ is at most 1, that is, $G[Y]$ is a disjoint union of isolated vertices and isolated edges. Similarly, the maximum degree in $\overline{G}[X]$ is at most 1, hence $\overline{G}[X]$ is a disjoint union of isolated vertices and isolated edges. It follows that $\{X, Y, \{u\}\}$ is a cosplit of $G$ of size at most $N_1 = 3$ and height at most 2.

We proceed to the induction step. Let $Y$ be a Gyárfás decomposition of $G$. (Note that $G$ may be disconnected, so $Y$ may be a rooted forest.) By Lemma 4.1, for every bag $B$ of $Y$ with level $i > 1$, we have $\text{sindex}(G[B]) < \text{sindex}(G)$. Hence, by induction there is a cosplit $\mathcal{P}^B$ of $G[B]$ of size at most $N_{k-1}$ and height at most $2k-2$. Next, for every bag $B$ of $Y$ with level 1 and every connected component $C$ of $\overline{G}[B]$, we fix any Gyárfás decomposition $Y_C$ of $C$. By Lemma 4.2, for every bag $B'$ of $Y_C$ of level $j \ge 1$ we have $\text{sindex}(G[B']) < \text{sindex}(G)$. Therefore, by induction we again find a cosplit $\mathcal{P}^{B'}$ of $G[B']$ of size at most $N_{k-1}$ and height at most $2k-2$.

For convenience, let $\mathcal{E}$ be the set of all connected components $C$ of all graphs $\overline{G}[B]$, where $B$ ranges over bags of $Y$ with level 1. Note that by Lemma 3.2, each of the Gyárfás decompositions $Y$ and $\{Y_C : C \in \mathcal{P}\}$ considered above has height at most $t-2$.

Every cosplit $\mathcal{P}^X$ defined in the paragraph above has size at most $N_{k-1}$, hence let us arbitrarily enumerate it as

$$\mathcal{P}^X = \{P_1^X, \dots, P_{N_{k-1}}^X\},$$

where by abuse of notation some of the sets $P_\ell^X$ for $1 \le \ell \le N_{k-1}$ may be empty. We define a partition $\mathcal{P}$ of $V(G)$ as follows:

* For every $2 \le i \le t-2$ and $1 \le \ell \le N_{k-1}$, add to $\mathcal{P}$ the set

$$P_{i,\ell} := \bigcup \{P_\ell^B : B \text{ is a bag of level } i \text{ in } Y\}.$$
* For every $1 \le j \le t-2$ and $1 \le l \le N_{k-1}$, add to $\mathcal{P}$ the set

$$P_{1,j,l} := \bigcup \{ P_{\ell}^{B'} : C \in \mathcal{E} \text{ and } B' \text{ is a bag with level } j \text{ in } Y_C \}.$$

* Finally, add to $\mathcal{P}$ the sets

$$P_0 := \bigcup \{ B : B \text{ is a bag of } Y \text{ with level } 0 \},$$

$$P_{1,0} := \bigcup \{ B' : C \in \mathcal{E} \text{ and } B' \text{ is a bag of } Y_C \text{ with level } 0 \}.$$

Clearly, we have

$$|\mathcal{P}| \le (t-3) \cdot N_{k-1} + (t-2) \cdot N_{k-1} + 2 = N_k.$$

It remains to verify that every part of $\mathcal{P}$ induces a cograph of height at most $2k$. For parts of the form $P_{i,l}$, $G[P_{i,l}]$ is the disjoint union of cographs $G[P_{\ell}^B]$ for $B$ ranging as in the definition. For parts of the form $P_{1,j,l}$, $G[P_{1,j,l}]$ can be obtained from cographs $G[P_{\ell}^{B'}]$ for $B'$ ranging as in the definition as follows: first, for every bag $B$ of $Y$ with level 1 construct the join of the graphs $G[P_{\ell}^B]$ for all $B'$ satisfying $B' \subseteq B$, and then take the disjoint union of the obtained graphs for all $B$ as above. Finally, $G[P_0]$ is edgeless and $G[P_{1,0}]$ is a disjoint union of cliques. $\square$

## 5. Constructing a 2-cosplit: proof of Theorem 1.3

Our first step towards the proof of Theorem 1.3 is to reduce the problem to the case of bipartite graphs. For this, we adjust the notion of a 2-cosplit to bipartite graphs as follows: if $G$ is a bipartite graph and $\mathcal{P}$ is a 2-cosplit of $G$, then we require that $\mathcal{P}$ refines the bipartition; that is, every part of $\mathcal{P}$ is entirely contained in one of the sides. Note that thus, the only (semi-)induced subgraphs considered in the definition that may not be edgeless are the graphs $G[A, B]$ where $A, B$ are parts contained in the opposite sides. Further, when talking about induced subgraphs of bipartite graphs, we also treat them as bipartite graphs with the inherited bipartition.

The statement for bipartite graphs is provided below.

**Theorem 5.1.** For every pair of integers $t, k \in \mathbb{N}$ there exists $N \in \mathbb{N}$ such that the following holds: Every bipartite graph that excludes $P_t, \tilde{P}_t$, and $H_k$ as induced subgraphs admits a depth-2 cosplit of size at most $N$ and height at most $4k$.

We remark that our proof of the above gives $N = 3^{t2k-2}$. Before we give a proof of Theorem 5.1, let us see how Theorem 1.3 can be derived by combining it with Theorem 1.2.

**Proof of Theorem 1.3 assuming Theorem 5.1.** Since $G$ excludes $P_t, \tilde{P}_t$, and $H_k$ as semi-induced subgraphs, it follows that $G$ excludes $P_t, \tilde{P}_t$, and $R_k$ as induced subgraphs. So by Theorem 1.2 there is a cosplit $\mathcal{P}_0$ of $G$ of size at most $N_0$ and depth at most $4k$, where $N_0$ depends only on $t$ and $k$. Next, for every pair of distinct parts $X, Y \in \mathcal{P}_0$ consider the semi-induced subgraph $G[X, Y]$. This is a bipartite graph that excludes $P_t, \tilde{P}_t$, and $H_k$ as induced subgraphs, hence by Theorem 5.1, $G[X, Y]$ admits a 2-cosplit $\mathcal{P}_{X,Y}$ of size at most $N_1$ and height at most $4k$, where $N_1$ depends only on $t$ and $k$. Let $\mathcal{P}$ be the coarsest partition of the vertex set of $G$ that refines all the partitions $\mathcal{P}_0$ and $\mathcal{P}_{X,Y}$ for distinct $X, Y \in \mathcal{P}_0$ in the following sense: for every $A \in \mathcal{P}$ and $B$ belonging to any of the partitions above, we have $A \cap B = \emptyset$ or $A \subseteq B$. Then $|\mathcal{P}| \le N_0 \cdot N_1^{N_0-1} =: N$ and it is easy to argue, using Fact 2.2, that $\mathcal{P}$ is a 2-cosplit of $G$ of height at most $4k$. $\square$
Therefore, we are left with proving Theorem 5.1. As we deal with bipartite graphs, it will be convenient to introduce a variant of the strong index invariant that is suited for this setting.

**Definition 5.1.** The bipartite index of a bipartite graph $G$, denoted $b\text{-index}(G)$, is the maximum integer $k$ such that $G$ contains vertices $a_1, \dots, a_k, b_1, \dots, b_k$ satisfying the following: all the $a_i$'s belong to one side of $G$, all the $b_j$'s belong to the other side of $G$, and for all $1 \le i < j \le k$ the vertex $a_i$ is adjacent to the vertex $b_j$ and the vertex $b_i$ is not adjacent to the vertex $a_j$.

We remark that the same concept was used under the name quasi-index in [9]. We prefer to use the term bipartite index here, as it is more descriptive. Note the following analogue of Fact 4.1.

**Fact 5.2.** For every bipartite graph $G$ we have $b\text{-index}(G) = b\text{-index}(\tilde{G})$.

Next, let us characterize connected bipartite graphs of bipartite index 1.

**Fact 5.3.** If $G$ is bipartite, connected, and $b\text{-index}(G) = 1$, then $G$ is a complete bipartite graph.

*Proof.* Let $L, R$ be the sides of $G$. By contradiction, suppose there exist $u \in L$ and $v \in R$ that are not adjacent. Observe that every vertex $u' \in L \setminus \{u\}$ must be non-adjacent to every vertex $v' \in R \setminus \{v\}$, for otherwise $u', u, v, v'$ would witness $b\text{-index}(G) \ge 2$. So there is no edge with one endpoint in $L \setminus \{u\} \cup \{v\}$ and second in $R \setminus \{v\} \cup \{u\}$; this contradicts the assumption that $G$ is connected. $\square$

Also, we have the following counterpart of Fact 4.2.

**Fact 5.4.** If a bipartite graph has bipartite index at least $2k+1$, then it contains an induced $H_k$.

*Proof.* Suppose $a_1, \dots, a_{2k+1}, b_1, \dots, b_{2k+1}$ witness $b\text{-index}(G) \ge 2k+1$. Color every integer $i \in \{1, \dots, 2k+1\}$ black or white depending on whether $a_i$ is adjacent to $b_i$ or not. Then there exists a monochromatic subset of indices of size $k+1$. The vertices with those indices induce either $H_{k+1}$ or $\tilde{H}_{k+1}$ in $G$. We conclude by observing that both $H_{k+1}$ and $\tilde{H}_{k+1}$ contain $H_k$ as an induced subgraph. $\square$

Finally, the following three simple lemmas will be useful for merging 2-cosplits.

**Lemma 5.1.** Let $G$ be a graph. If every connected component of $G$ has a 2-cosplit of size at most $N$ and height at most $h$, then $G$ has a 2-cosplit of size at most $N$ and height at most $h+1$.

*Proof.* For a connected component $C$ of $G$, let $\mathcal{P}^C$ be a 2-cosplit of $C$ of size at most $N$ and height at most $h$. Arbitrarily enumerate $\mathcal{P}^C$ as $\{P_1^C, \dots, P_N^C\}$, where by abuse of notation some of the parts may be empty. Then, for $j \in \{1, \dots, N\}$, define

$$P_j := \bigcup \{P_j^C : C \text{ is a connected component of } G\}.$$

It is straightforward to verify that $\{P_1, \dots, P_N\}$ is a 2-cosplit of $G$ of height at most $h+1$. $\square$
**Lemma 5.2.** Let $G$ be a bipartite graph and let $\mathcal{R}$ be a partition of $V(G)$ such that every part of $\mathcal{R}$ is entirely contained in one side of $G$. Suppose for every pair of parts $A, B \in \mathcal{R}$ belonging to opposite sides of $G$, the graph $G[A, B]$ admits a 2-cosplit of size at most $N$ and height at most $h$. Then $G$ admits a 2-cosplit of size at most $|\mathcal{R}| \cdot N^{\mathcal{R}}$ and height at most $h$.

*Proof.* For each pair of parts $A, B \in \mathcal{R}$ belonging to opposite sides of $G$, let $\mathcal{P}_{A,B}$ be the assumed 2-cosplit of $G[A, B]$ of size at most $N$ and height at most $h$. Let $\mathcal{P}$ be the coarsest partition of $V(G)$ that refines $\mathcal{R}$ and all the 2-cosplits $\mathcal{P}_{A,B}$ in the following sense: for all pairs $A, B \in \mathcal{R}$ as above and all parts $D \in \mathcal{P}_{A,B}$, every part of $\mathcal{P}$ is either contained in or disjoint with $D$. Then $|\mathcal{P}| \le |\mathcal{R}| \cdot N^{\mathcal{R}}$, because every part of $\mathcal{R}$ contains at most $N^{\mathcal{R}}$ different parts of $\mathcal{P}$, and it is straightforward to verify that $\mathcal{P}$ is a 2-cosplit of $G$ of height at most $h$. $\square$

**Lemma 5.3.** Every 2-cosplit of a bipartite graph $G$ is also a 2-cosplit of $\tilde{G}$ of the same height.

*Proof.* Follows from the fact that bi-cographs are closed under bipartite complementation. Note that this operation preserves the height. $\square$

Next, we prove the analogues of Lemmas 4.1 and 4.2. In both cases the reasoning follows the same path, but one needs to be careful about the bipartiteness.

**Lemma 5.4.** Let $G$ be a connected bipartite graph and let $Y$ be a Gyárfás decomposition of $G$. Let $B$ be a bag of $Y$ with level $i > 1$ and let $G_B$ be the subgraph of $G$ induced by $B$ and the union of all the descendants of $B$ at levels $i' \not\equiv i \bmod 2$. Then $b\text{-index}(G_B) < b\text{-index}(G)$.

*Proof.* Let $D$ be the union of all the descendants of $B$ at levels $i' \not\equiv i \bmod 2$. By Lemma 3.3, each of $B$ and $D$ is entirely contained in a single side of $G$, and these are different sides.

By item 5 of Definition 3.1, the hook $h(B)$ is adjacent to all the vertices of $B$. Let $B'$ be the parent of $B$ in $Y$. Note that since $i > 1$, $B'$ is not the root of $Y$. By item 5 of Definition 3.1 again, the hook $h(B')$ is non-adjacent to all the vertices of $G_B$. Moreover, by Lemma 3.3, $h(B')$ belongs to the same side as $B$ and $h(B)$ belongs to the same side as $D$. Let $a_1, \dots, a_p, b_1, \dots, b_p$ witness index$(G_B) = p$. By exchanging $a_\ell$ with $b_{p+1-\ell}$ (for every $\ell \in \{1, \dots, p\}$) if necessary we may assume that $a_1, \dots, a_p \in D$ and $b_1, \dots, b_p \in B$. Then $h(B)$, $a_1, \dots, a_p$, $h(B')$, $b_1, \dots, b_p$ witness $b$-index$(G) \ge p + 1$. It follows that $b$-index$(G_B) < b$-index$(G)$. $\square$

**Lemma 5.5.** Let $G$ be a connected bipartite graph and let $Y$ be a Gyárfás decomposition of $G$. Let $B$ be a bag of $Y$ with level 1 and let $G_B$ be the subgraph of $G$ induced by $B$ and the union of all the bags that are descendants of $B$ in $Y$ at levels $i' \not\equiv 1 \bmod 2$. Let $C$ be a connected component of $\tilde{G}_B$ and $Y_C$ be a Gyárfás decomposition of $H$ rooted at a vertex $r_C \in V(C) \cap B$. Let $B'$ be a bag of $Y_C$ with level $j \ge 1$ and let $G_{B'}$ be the subgraph of $G$ induced by $B'$ and the union of all the bags of $Y_C$ that are descendants of $B'$ in $Y_C$ at levels $j' \not\equiv j \bmod 2$. Then $b$-index$(G_{B'}) < b$-index$(G)$.

*Proof.* For bags $B'$ with level $j > 1$ the result follows from Lemma 5.4. So let $B'$ be a bag of $Y_C$ with level 1. Let $L, R$ be the sides of $G$, where the initial vertex $r$ of $Y$ belongs to $L$. Then $B \subseteq R$, so in particular $r_C \in R$. Letting $D' = V(G_{B'}) \setminus B'$ be the union of descendants of $B'$ in $Y_C$ at levels $j' \not\equiv 1 \bmod 2$, we have $B' \subseteq L$ and $D' \subseteq R$.

Let $a_1, \dots, a_p, b_1, \dots, b_p$ witness $b$-index$(G_{B'}) = p$. By exchanging $a_\ell$ with $b_{p+1-\ell}$ (for every $\ell \in \{1, \dots, p\}$) if necessary we may assume that $a_1, \dots, a_p \in B'$ and $b_1, \dots, b_p \in D'$. Note that
$D' = V(G_{B'}) \cap R \subseteq V(G_B) \cap R = B$, so $b_1, \dots, b_p \in B$. As $r$ adjacent in $G$ to all the vertices in $B$ and as $r_C$ is non-adjacent in $G$ to all the vertices in $B'$, the vertices $r, a_1, \dots, a_p, r', b_1, \dots, b_p$ witness b-index($G$) $\ge p+1$. It follows that b-index($G$) > b-index($G_{B'}$). $\square$

With all the tools prepared, we are ready to complete the argument.

*Proof of Theorem 5.1.* Fix $t$ for the remainder of the proof; we may assume without loss of generality that $t \ge 5$. For $k \ge 1$, let

$$N_k = \frac{(2t^{1/(t-1)})^{t2k-2}}{t^{1/(t-1)}}.$$

Note that $N_1 = 2$ and that the sequence satisfies the recurrence

$$N_k = t^{t+1} \cdot N_{k-1}^{t^2} \quad (\text{for } k \ge 2).$$

For a given $k$, let $Q(k)$ be the statement that every bipartite graph that excludes $P_t$ and $\tilde{P}_t$ as induced subgraphs and has bipartite index at most $k$, admits a cosplit of size at most $N_k$ and height at most $2k$. We shall prove $Q(k)$ by induction on $k$. Provided we achieve this, Theorem 5.1 will immediately follow by Fact 5.4.

For the base case $k=1$, Fact 5.3 implies that a bipartite graph of bipartite index 1 is a disjoint union of bicliques. Hence it admits a trivial 2-cosplit of size at most $N_1 = 2$ and height at most 2.

We proceed to the induction step; that is, we need to prove $Q(k)$ assuming $Q(k-1)$ for $k \ge 2$. Let $L, R$ be the bipartition of $G$. By performing the reasoning in $\tilde{G}$ instead of in $G$ and using Lemma 5.3 if necessary, we may assume that at least one of the sides $L$ and $R$ has no isolated vertices. Further, by switching the sides if necessary, we may assume that there are no isolated vertices in $R$. Hence, we may choose a Gyárfás decomposition $Y$ of $G$ so that every root bag of $Y$ is contained in $L$. By Lemma 3.2, $Y$ has height at most $t-2$.

For each $i \in \{0, 1, \dots, t-2\}$, let $U_i$ be the union of bags of $Y$ with level $i$. Thus $U_i \subseteq L$ when $i$ is even and $U_i \subseteq R$ when $i$ odd. Further, let

$$G_i := G[U_i, U_{i+1} \cup U_{i+3} \cup \dots \cup U_{t'-2} \cup U_{t'}],$$

where $t' \in \{t-3, t-2\}$ is of different parity than $i$. We argue the following claim:

For each $i \in \{0, 1, \dots, t-2\}$, the graph $G_i$ admits a 2-cosplit of size at most $t \cdot N_{k-1}^t$ (♣) and height at most $2k$. (♣)

Observe that $Q(k)$ follows from (♣) combined with Lemma 5.2; here we use the partition $\mathcal{R} = \{U_0, U_1, \dots, U_{t-2}\}$. Hence, we are left with proving (♣).

For every bag $B$ of $Y$, let $G_B$ be the subgraph of $G$ induced by $B$ and the union of all descendants of $B$ at levels of parity different from that of the level of $B$. Observe that for each $i \in \{0, 1, \dots, t-2\}$, $G_i$ is the disjoint union of graphs $G_B$ for $B$ ranging over bags with level $i$. Therefore, from Lemma 5.1 we conclude that in order to prove (♣) for $i$, it suffices to prove the following claim:

For each bag $B$ of $Y$ with level $i$, the graph $G_B$ admits a 2-cosplit of size at most $t \cdot N_{k-1}^t$ (♦) and height at most $2k-1$. (♦)

Hence, from now on we focus on proving (♦).
First, consider the case $i = 0$. Then $B = \{u\}$ for some vertex $u$, and all other vertices of $G_B$ are on the opposite side of $u$. Therefore, $G_B$ is the disjoint union of a star and a collection of isolated vertices, so $G_B$ admits a trivial 2-cosplit of size 2 and depth 2. This settles (◇) for $i = 0$.

Next, consider the case $i > 1$. By Lemma 5.4, b-index($G_B$) < b-index($G$) for each $B$ as above, hence by induction $G_B$ admits a cosplit of size at most $N_{k-1}$ and height at most $2k - 2$. This settles (◇) for $i > 1$.

We are left with the case $i = 1$. Let $G'_B$ be the graph obtained from $G_B$ by removing all vertices of $V(G_B) \cap L$ that are isolated in $\tilde{G}_B$. Further, let $Y'$ be a Gyárfás decomposition of $\tilde{G}'_B$. Since no vertex contained $L$ is isolated in $\tilde{G}'_B$, we can choose $Y'$ so that all root bags of $Y'$ are contained in $R$ (and thus also in $B$, because $R \cap V(G_B) = B$). By Lemma 3.2, $Y'$ has height at most $t - 2$.

For $j \in \{0, 1, \dots, t-2\}$, let $W_j$ be the union of bags of $Y'$ with level $j$, where in $W_1$ we additionally include all vertices of $V(G_B) \setminus V(G'_B)$. Note that thus $\{W_0, \dots, W_{t-2}\}$ is a partition of $V(G_B)$, $W_j \subseteq R$ for even $j$ and $W_j \subseteq L$ for odd $j$. Denote

$$G'_j := G[W_j, W_{j+1} \cup W_{j+3} \cup \dots \cup W_{t'-2} \cup W_{t'}],$$

where $t' \in \{t-3, t-2\}$ is of different parity than $j$. By Lemma 5.2, to prove (◇) it suffices to prove the following.

For every $j \in \{0, 1, \dots, t-2\}$, the graph $G'_j$ admits a 2-cosplit of size at most $N_{k-1}$ () and height at most $2k-1$.

Hence, from now on we focus on proving (♥).

For every bag $B'$ of $Y'$, let $G'_{B'}$ be the subgraph of $G$ induced by $B'$ and all descendants of $B'$ in $Y'$ with levels of parity different from the level of $B'$. Observe that for every $j \in \{0, 1, \dots, t-2\}$, the graph $G'_j$ is the bipartite join of graphs $G'_{B'}$ for $B'$ ranging over bags of $Y'$ with level $j$. (In the case $j = 1$ we also need to include in the join the single-vertex graph on $u$ for every $u \in V(G_B) \setminus V(G'_B)$.) Therefore, by Lemmas 5.1 and 5.3, to prove (♥) it suffices to prove the following.

For every bag $B'$ of $Y'$ with level $j$, the graph $G'_{B'}$ admits a 2-cosplit of size at most $N_{k-1}$ (♣) and height at most $2k-2$.

In the case $j = 0$, we again have that $B' = \{u\}$ for some vertex $u$ and all other vertices of $G'_{B'}$ belong to the opposite side of this bipartite graph. It follows that $G'_{B'}$ is the disjoint union of a star and a collection of isolated vertices, so $G'_{B'}$ admits a trivial 2-cosplit of size 2 and height 2. This settles (♣) for $j = 0$.

We are left with the final case $j \ge 1$. By Lemma 5.5, we have b-index($G'_{B'}$) < b-index($G$). So by induction we infer that $G'_{B'}$ admits a 2-cosplit of size at most $N_{k-1}$ and height at most $2k - 2$. This settles (♣) for $j \ge 1$ and concludes the proof. □

## 6. Sparsification: proof of Theorem 1.1

In this section we use the results gathered so far to prove our main result, Theorem 1.1. As mentioned, the strategy is to show that for fixed $t, k \in \mathbb{N}$, graphs excluding semi-induced $P_t$, $\tilde{P}_t$, and $H_k$ can be sparsified using an FO transduction. Then we exploit the known connections between treedepth and the existence of long paths as subgraphs.
We first show that cographs with bounded height can be efficiently sparsified. Here, by a *coloring procedure* we mean an algorithm that inputs a graph and outputs some coloring of it$^4$.

**Lemma 6.1.** For every positive integer $h$ there exist a polynomial-time coloring procedure $\mathcal{A}$, a class $\mathcal{D}_1$ of colored graphs with treedepth at most $h$, and two first-order formulas $\varphi_1, \psi_1$, such that $(\varphi_1, \psi_1)$ is a simple equivalence of the classes $\mathcal{A}(\mathcal{C})$ and $\mathcal{D}_1$, where $\mathcal{C}$ is the class of all cographs with height at most $h$.

*Proof.* We first define a sequence of partitions $\mathcal{P}_0, \dots, \mathcal{P}_h$ of the vertex set of $G$ as follows:

* $\mathcal{P}_0 = \{V(G)\}$.

* For odd $i \ge 1$, $\mathcal{P}_i$ is obtained from $\mathcal{P}_{i-1}$ by splitting every part $A \in \mathcal{P}_{i-1}$ into the vertex sets of the connected components of $G[A]$.

* For even $i \ge 1$, $\mathcal{P}_i$ is obtained from $\mathcal{P}_{i-1}$ by splitting every part $A \in \mathcal{P}_{i-1}$ into the vertex sets of the connected components of $\bar{G}[A]$.

It is straightforward to see that provided $G$ is a cograph of height at most $h$, $\mathcal{P}_h$ will be the discrete partition with every vertex in its own part. Clearly, partitions $\mathcal{P}_0, \dots, \mathcal{P}_h$ can be computed in polynomial time.

Next, for $0 \le i \le h$ we inductively define formulas $\varpi_i(x, y)$ expressing that $x$ and $y$ are in the same part of $\mathcal{P}_i$. For $i = 0$ this is trivial. For odd $i \ge 1$, $\varpi_i(x, y)$ can be obtained from $\varpi_{i-1}(x, y)$ by checking that $\varpi_{i-1}(x, y)$ holds and $x$ and $y$ are in the same connected component of the subgraph of $G$ induced by the part of $\mathcal{P}_{i-1}$ to which $x$ and $y$ belong. Note here that in the setting of cographs, belonging to the same connected component is equivalent to being at distance at most 3, hence it can be expressed in FO. The construction for even $i \ge 1$ is the same, except we complement the subgraph induced by the part of $x$ and $y$.

The coloring procedure $\mathcal{A}$ first computes the partitions $\mathcal{P}_0, \dots, \mathcal{P}_h$. Then, for each $i \in \{0, 1, \dots, h\}$, it marks one arbitrary vertex in each part of $\mathcal{P}_i$ with predicate $P_i$. The coloring of $G$ obtained in this way is the output of $\mathcal{A}$ on $G$.

The formula $\varphi_1(x, y)$ expresses that for some $0 \le i \le h$, $\varpi_i(x, y)$ holds and one of $x$ and $y$ is marked with $P_i$. It is straightforward to see that then $\mathrm{I}_{\varphi_1}(\mathcal{A}(G))$ is a colored graph with treedepth at most $h$.

Denote by $N[v]$ the closed neighborhood of a vertex $v$ (i.e. the set formed by $v$ and all its neighbors). It is easily checked that two vertices $u$ and $v$ of $G$ are adjacent if and only if, in $\mathrm{I}_{\varphi_1}(\mathcal{A}(G))$, the maximum integer $i$ such that $N[u] \cap N[v]$ contains a vertex marked with $P_i$ is odd. As $0 \le i \le h$, this property is first-order definable by a formula $\psi_1$. $\square$

We now give an analogous result for bi-cographs with bounded height. As the proof is very similar (considering bi-complement instead of complements), we omit it.

**Lemma 6.2.** For every positive integer $h$ there exist a polynomial time coloring procedure $\mathcal{B}$, a class $\mathcal{D}_2$ of colored graphs with treedepth at most $h$, and two first-order formulas $\varphi, \psi$, such that $(\varphi_2, \psi_2)$ is a simple equivalence of the classes $\mathcal{B}(\mathcal{B})$ and $\mathcal{D}_2$, where $\mathcal{B}$ is the class of all bi-cographs with height at most $h$.

<footnote n="4">⁴Formally, we defined colorings to use an infinite number of colors, but in what follows, coloring procedures always output colorings using a finite number of colors. One may imagine that the remaining colors are set to be empty sets and are thus omitted in the description of the output. They are also never used by any formula that we are about to construct.</footnote>
The next theorem is an easy consequence of the two preceding lemmas.

**Theorem 6.1.** Let $N, k$ be integers, and let $\mathcal{C}$ be the class of all graphs that admit a 2-cosplit of size at most $N$ and height at most $k$. Then there exist a coloring procedure $C$, a class $\mathcal{D}$ of $dN$-degenerate graphs, and two first-order formulas $\varphi, \psi$, such that the following hold:

* Given a graph $G$ and a 2-cosplit of $G$ of size at most $N$ and height at most $k$, the procedure $C$ computes the coloring $C(G)$ in polynomial time.

* The pair $(\varphi, \psi)$ is a simple equivalence of the classes $C(\mathcal{C})$ and $\mathcal{D}$.

*Proof.* The coloring procedure $C$ first colors the vertices according to the 2-cosplit. Then, it calls the procedure $A$ of Lemma 6.1 on the graph induced by each part, and the procedure $B$ of Lemma 6.2 on the bipartite subgraph induced by each pair of distinct parts. Here, all unary predicates used by all invocation of procedures $A$ and $B$ are kept distinct. Then, one can easily construct the formulas $\varphi$ and $\psi$ using a disjunction on the possible parts of the 2-cosplit to which $x$ and $y$ belong. $\square$

By combining Theorem 6.1 with Theorem 1.3 we derive the following statement.

**Corollary 6.1.** Every class of graphs that excludes a path, the bipartite complement of a path, and a half-graph as semi-induced subgraphs is transduction equivalent to a class of degenerate graphs.

We are now ready to prove our main result.

*Proof of Theorem 1.1.* Let $\mathcal{C}$ be a class of graphs such that the class of all paths cannot be FO-transduced from $\mathcal{C}$. Then there are integers $t, k \in \mathbb{N}$ such that no graph in $\mathcal{C}$ contains $P_t, \tilde{P}_t$, or $H_k$ as a semi-induced subgraph. Therefore, by Corollary 6.1, $\mathcal{C}$ is transduction equivalent to a class $\mathcal{D}$ of degenerate graphs. Clearly, it is still the case that the class of all paths cannot be FO-transduced from $\mathcal{D}$, hence graphs in $\mathcal{D}$ do not contain all paths as induced subgraphs. Since $\mathcal{D}$ is in addition degenerate, by [19, Proposition 6.4] it follows that $\mathcal{D}$ has bounded treedepth, hence also bounded shrubdepth. So by the results of [10], $\mathcal{C}$ has bounded shrubdepth as well. $\square$

*Acknowledgements.* The research leading to the results presented in this work was initiated during Dagstuhl Seminar 21391 *Sparsity in Algorithms, Combinatorics, and Logic*. We are grateful to the Dagstuhl staff for creating such a stimulating work atmosphere. We also thank multiple other participants of the workshop for inspiring discussions that greatly helped in the shaping of this work.

## References

[1] A. Blumensath and B. Courcelle, *On the monadic second-order transduction hierarchy*, Logical Methods in Computer Science **6** (2010), no. 2.

[2] É. Bonnet, U. Giocanti, P. Ossona de Mendez, P. Simon, S. Thomassé, and Sz. Toruńczyk, *Twin-width IV: low complexity matrices*, arXiv:2102.03117v3 [math.CO], 2021.

[3] É. Bonnet, E. J. Kim, S. Thomassé, and R. Watrigant, *Twin-width I: tractable FO model checking*, J. ACM **69** (2022), no. 1, 3:1–3:46.

[4] A. Chernikov and S. Starchenko, *A note on the Erdős-Hajnal property for stable graphs*, Proceedings of the American Mathematical Society **146** (2018), no. 2, 785–790.
[5] D.G Corneil, H. Lerchs, and L. Stewart Burlingham, *Complement reducible graphs*, Discrete Applied Mathematics **3** (1981), no. 3, 163–174.

[6] B. Courcelle and S. Oum, *Vertex-minors, monadic second-order logic, and a conjecture by Seese*, Journal of Combinatorial Theory, Series B **97** (2007), no. 1, 91–126.

[7] J. Gajarský, P. Hliněný, J. Obdržálek, D. Lokshtanov, and M. S. Ramanujan, *A new perspective on FO model checking of dense graph classes*, ACM Trans. Comput. Log. **21** (2020), no. 4, 28:1–28:23.

[8] J. Gajarský, S. Kreutzer, J. Nešetřil, P. Ossona de Mendez, M. Pilipczuk, S. Siebertz, and Sz. Toruńczyk, *First-order interpretations of bounded expansion classes*, ACM Transactions on Computational Logic **21** (2020), no. 4, Article 29.

[9] J. Gajarský, M. Pilipczuk, and Sz. Toruńczyk, *Stable graphs of bounded twin-width*, arXiv:2107.03711 [cs.LO], 2021.

[10] R. Ganian, P. Hliněný, J. Nešetřil, J. Obdržálek, and P. Ossona de Mendez, *Shrub-depth: Capturing height of dense graphs*, Logical Methods in Computer Science **15** (2019), no. 1, oai:arXiv.org:1707.00359.

[11] R. Ganian, P. Hliněný, J. Nešetřil, J. Obdržálek, P. Ossona de Mendez, and R. Ramadurai, *When trees grow low: Shrubs and fast MSO<sub>1</sub>*, International Symposium on Mathematical Foundations of Computer Science, Lecture Notes in Computer Science, vol. 7464, Springer-Verlag, 2012, pp. 419–430.

[12] V. Giakoumakis and J.-M. Vanherpe, *Bi-complement reducible graphs*, Adv. Appl. Math. **18** (1997), 389–402.

[13] J. Gimbel and J. Nešetřil, *Partitions of graphs into cographs*, Discrete Mathematics **310** (2010), no. 24, 3437–3445.

[14] M. Grobler, Y. Jiang, P. Ossona de Mendez, S. Siebertz, and A. Vigny, *On set systems definable in sparse graph classes, discrepancy, and quantifier elimination*, arXiv:2010.02607v2 [math.CO], 2021.

[15] A. Gyárfás, *Problems from the world surrounding perfect graphs*, Applicationes Mathematicae **19** (1987), no. 3-4, 413–441.

[16] J.H. Kim, *The Ramsey number R(3, t) has order of magnitude t² / log t*, Random Structures & Algorithms **7** (1995), no. 3, 173–207.

[17] O. Kwon, R. McCarty, S. Oum, and P. Wollan, *Obstructions for bounded shrub-depth and rank-depth*, Journal of Combinatorial Theory, Series B **149** (2021), 76–91.

[18] M. Malliaris and S. Shelah, *Regularity lemmas for stable graphs*, Trans. Amer. Math. Soc. **366** (2014), 1551–1585.

[19] J. Nešetřil and P. Ossona de Mendez, *Sparsity (graphs, structures, and algorithms)*, Algorithms and Combinatorics, vol. 28, Springer, 2012, 465 pages.

[20] J. Nešetřil, P. Ossona de Mendez, R. Rabinovich, and S. Siebertz, *Classes of graphs with low complexity: The case of classes with bounded linear rankwidth*, European Journal of Combinatorics **91** (2021), 103223, Special issue dedicated to Xuding Zhu's 60th birthday.

[21] J. Nešetřil, P. Ossona de Mendez, M. Pilipczuk, R. Rabinovich, and S. Siebertz, *Rankwidth meets stability*, Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms, SODA 2021 (Dániel Marx, ed.), SIAM, 2021, pp. 2014–2033.

[22] J. Nešetřil, P. Ossona de Mendez, and S. Siebertz, *Structural Properties of the First-Order Transduction Quasiorder*, 30th EACSL Annual Conference on Computer Science Logic (CSL 2022) (F. Manea and A. Simpson, eds.), Leibniz International Proceedings in Informatics (LIPIcs), vol. 216, Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022, pp. 31:1–31:16.

[23] M. Pilipczuk, M. Pilipczuk, and S. Siebertz, *Lecture notes for the course "Sparsity" given at Faculty of Mathematics, Informatics, and Mechanics of the University of Warsaw*, Winter semesters 2017/18 and 2019/20, Available at https://www.mimuw.edu.pl/~mp248287/sparsity2.