1 Introduction

Treewidth is a measure of how well a graph accommodates a decomposition into a tree-like structure. In the field of parameterized complexity, many NP-hard problems have been shown to have FPT algorithms when parameterized by treewidth; for example, Coloring, Vertex Cover, Feedback Vertex Set, and Steiner Tree (see [8, Section 7] for further examples). In fact, Courcelle [7] established a meta-theorem that says that every problem definable in \(\hbox {MSO}_2\) logic can be solved in linear time on graphs of bounded treewidth. While Courcelle’s Theorem is a very general tool for obtaining algorithmic results, for specific problems dynamic programming techniques usually give algorithms where the running time \(f(w)n^{{\mathcal {O}}(1)}\) has better dependence on treewidth w. There is some evidence that a careful implementation of dynamic programming (plus maybe some additional ideas) gives optimal dependence for some problems (see, e.g., [15]).

For Feedback Vertex Set, standard dynamic programming techniques give \(2^{{\mathcal {O}}(w\log w)}n^{{\mathcal {O}}(1)}\)-time algorithms and it was considered plausible that this could be the best possible running time. Hence, it was a remarkable surprise when it turned out that \(2^{{\mathcal {O}}(w)}n^{{\mathcal {O}}(1)}\)-time algorithms are also possible for this problem by various techniques: Cygan et al. [9] obtained a \(3^w n^{{\mathcal {O}}(1)}\)-time randomized algorithm by using the so-called Cut and Count technique, and Bodlaender et al. [3] showed there is a deterministic \(2^{{\mathcal {O}}(w)} n^{{\mathcal {O}}(1)}\)-time algorithm by using a rank-based approach and the concept of representative sets. This was also later shown in the more general setting of representative sets in matroids by Fomin et al. [13].

Generalized feedback vertex set problems. In this paper, we explore the extent to which these results apply for generalizations of Feedback Vertex Set. The Feedback Vertex Set problem asks for a set S of at most k vertices such that \(G-S\) is acyclic, or in other words, every block of \(G-S\) is a single edge or a vertex. We consider generalizations where we allow the blocks to be some other type of small graph, such as triangles, small cycles, or small cliques; these generalizations were first studied in [6].

Formally, we consider the following problem. Let \({\mathcal {P}}\) be a class of graphs.

figure a

If \(d=1\) or \({\mathcal {P}}=\{K_1\}\), then this problem is equivalent to the Vertex Cover problem. It is well known that Vertex Cover admits a \(2^{{\mathcal {O}}(w)}n^{{\mathcal {O}}(1)}\)-time algorithm; see [8] for instance. Moreover, if either (\(d=2\) and \(\{K_1, K_2\}\subseteq {\mathcal {P}}\)) or (\(d\geqslant 3\) and \({\mathcal {P}}=\{K_1, K_2\}\)), then this problem is equivalent to the Feedback Vertex Set problem. In this case, the result of Bodlaender et al. [3] implies that Bounded\({\mathcal {P}}\)-Block Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(w)} n^{{\mathcal {O}}(1)}\). Our main question is: when we regard d as a fixed constant, for which graph classes \({\mathcal {P}}\) can this problem be solved in time \(2^{{\mathcal {O}}(w)}n^{{\mathcal {O}}(1)}\)?

To obtain a general result, we require some assumptions on the class \({\mathcal {P}}\). First, in order to ensure that the solution can be checked in polynomial time, we assume that \({\mathcal {P}}\) can be recognized in polynomial time. Second, if we define \({\mathcal {C}}_{{\mathcal {P}}}\) to be the class of graphs where every block is in \({\mathcal {P}}\), then we want to consider deletion problems where \({\mathcal {C}}_{{\mathcal {P}}}\) is hereditary; that is, for every graph \(G\in {\mathcal {C}}_{{\mathcal {P}}}\) and every induced subgraph H of G, we have \(H\in {\mathcal {C}}_{{\mathcal {P}}}\). If \({\mathcal {C}}_{{\mathcal {P}}}\) is hereditary, then a superset of a solution S is also a solution; this is usually reasonable to assume for deletion problems. It is easy to see that if \({\mathcal {P}}\) is hereditary, then \({\mathcal {C}}_{{\mathcal {P}}}\) is also hereditary. However, for technical reasons, in our setting it is more natural to consider a slightly weaker notion. Suppose that we want to express the problem “Delete k vertices such that every block is a cycle or an edge.” We can express this problem by letting \({\mathcal {P}}\) be the class containing \(K_1\), \(K_2\), and every cycle. But this class is not hereditary: to make \({\mathcal {P}}\) hereditary, we would need to add every path and disjoint union of paths; but clearly, these (non-biconnected) graphs are irrelevant for our problem. Therefore, it is natural to require \({\mathcal {P}}\) to be block-hereditary only: for every \(G\in {\mathcal {P}}\) and every biconnected induced subgraph H of G, we have \(H\in {\mathcal {P}}\). The class consisting of \(K_1\), \(K_2\), and all cycles is block-hereditary.

However, these two conditions are not sufficient to obtain single-exponential algorithms parameterized by treewidth. A graph is chordal if it has no induced cycles of length at least 4. The main result of this paper is that the existence of single-exponential algorithms is closely linked to whether the graphs in \({\mathcal {P}}\) are all chordal or not. We show that if \({\mathcal {P}}\) consists of all chordal graphs and satisfies the two previously mentioned conditions, then Bounded\({\mathcal {P}}\)-Block Vertex Deletion can be solved in single-exponential time.

Theorem 1

Let \({\mathcal {P}}\) be a class of graphs that is block-hereditary, recognizable in polynomial time, and consists of only chordal graphs. Then Bounded\({\mathcal {P}}\)-Block Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(wd^2)}k^2 n\) on graphs with n vertices and treewidth w.

We complement this result by showing that if \({\mathcal {P}}\) contains a graph that is not chordal, then single-exponential algorithms are not possible (assuming ETH), even for fixed d. Note that if \({\mathcal {P}}\) is block-hereditary and contains a graph that is not chordal, then this graph contains a chordless cycle on \(\ell \geqslant 4\) vertices, and consequently the cycle graph on \(\ell \) vertices is also in \({\mathcal {P}}\).

Theorem 2

Let \({\mathcal {P}}\) be a block-hereditary class of graphs that is polynomial-time recognizable. If \({\mathcal {P}}\) contains the cycle graph on \(\ell \geqslant 4\) vertices, then Bounded\({\mathcal {P}}\)-Block Vertex Deletion is not solvable in time \(2^{o(w\log w)}n^{{\mathcal {O}}(1)}\) on graphs with n vertices and treewidth at most w even for fixed \(d=\ell \), unless the ETH fails.

Baste et al. [1, 2] recently studied the complexity of a similar problem, where the task is to find a set of vertices whose deletion results in a graph with no minor in a given collection of graphs \({\mathcal {F}}\), parameterized by treewidth. When \({\mathcal {F}} = \{C_4\}\), this is equivalent to Bounded\({\mathcal {P}}\)-Block Vertex Deletion where \({\mathcal {P}}= \{K_1, K_2,K_3\}\), and the complexity they obtain in this case is consistent with our result.

Whether this lower bound of Theorem 2 is best possible when \({\mathcal {P}}\) contains a cycle on \(\ell \geqslant 4\) vertices remains open. However, as partial positive evidence towards this, we note that when \({\mathcal {P}}\) contains all graphs, the result by Baste et al. [1] implies that that Bounded\({\mathcal {P}}\)-Block Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(w\log w)}n^{{\mathcal {O}}(1)}\) when d is fixed, as the minor obstruction set \({\mathcal {F}}\) consists of 2-connected graphs with \(d+1\) vertices, and contains a planar graph: the cycle graph of length \(d+1\).

Bounded-size components. Using a similar technique, we can obtain analogous results for a simpler problem, which we call Bounded\({\mathcal {P}}\)-Component Vertex Deletion, where we want to remove at most k vertices such that each connected component of the resulting graph has at most d vertices and belongs to \({\mathcal {P}}\). If we have only the size constraint (i.e., \({\mathcal {P}}\) contains every graph), then this problem is known as Component Order Connectivity [10].

figure b

Drange et al. [10] studied the parameterized complexity of a weighted variant of the Component Order Connectivity problem; their results imply, in particular, that Component Order Connectivity can be solved in time \(2^{{\mathcal {O}}(k\log d)}n\), but is W[1]-hard parameterized by only k or d. The corresponding edge-deletion problem, parameterized by treewidth, was studied by Enright and Meeks [11]. For general classes \({\mathcal {P}}\), we prove results that are analogous to those for Bounded\({\mathcal {P}}\)-Block Vertex Deletion.

Theorem 3

Let \({\mathcal {P}}\) be a class of graphs that is hereditary, recognizable in polynomial time, and consists of only chordal graphs. Then Bounded\({\mathcal {P}}\)-Component Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(wd^2)}k^2 n\) on graphs with n vertices and treewidth w.

Theorem 4

Let \({\mathcal {P}}\) be a hereditary class of graphs that is polynomial-time recognizable. If \({\mathcal {P}}\) contains the cycle graph on \(\ell \geqslant 4\) vertices, then Bounded\({\mathcal {P}}\)-Component Vertex Deletion is not solvable in time \(2^{o(w\log w)}n^{{\mathcal {O}}(1)}\) on graphs with n vertices and treewidth at most w even for fixed \(d=\ell \), unless the ETH fails.

Similar to Bounded\({\mathcal {P}}\)-Block Vertex Deletion, the result of Baste et al. [1] implies that when \({\mathcal {P}}\) contains all graphs, Bounded\({\mathcal {P}}\)-Component Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(w\log w)}n^{{\mathcal {O}}(1)}\) when d is fixed.

When d is not fixed, one might ask whether Bounded\({\mathcal {P}}\)-Component Vertex Deletion admits an \(f(w)n^{{\mathcal {O}}(1)}\)-time algorithm; that is, an FPT algorithm parameterized only by treewidth. We provide a negative answer, showing that the problem is W[1]-hard when \({\mathcal {P}}\) contains all chordal graphs, even parameterized by both treewidth and k. We further prove two stronger lower bound results assuming the ETH holds.

Theorem 5

Let \({\mathcal {P}}\) be a hereditary class containing all chordal graphs. Then Bounded\({\mathcal {P}}\)-Component Vertex Deletion is W[1]-hard parameterized by the combined parameter (wk). Moreover, unless the ETH fails, this problem

  1. 1.

    Has no \(f(w)n^{o(w)}\)-time algorithm; and

  2. 2.

    Has no \(f(k')n^{o(k'/\log k')}\)-time algorithm, where \(k' = w + k\).

Techniques for positive results. We sketch the proof of Theorem 1. Let \({\mathcal {P}}\) be a class of graphs that is block-hereditary and consists of chordal graphs. A pair (GS) consisting of a graph G and a subset S of its vertex set will be called a boundaried graph.

The key lemma can be briefly described as follows. Suppose there are two boundaried graphs (GS) and (HS) with \(G[S]=H[S]\), and we want to know whether

\((*)\) :

the graph obtained from the disjoint union of G and H by identifying vertices of S in G with the same vertices in H satisfies that each block has at most d vertices and is contained in \({\mathcal {P}}\).

In the dynamic programming algorithm, we consider one part (GS) as a partial solution, and (HS) has a role in the hypothetical complementary solution. We will show in Proposition 1 of Sect. 3 that we can guarantee the statement \((*)\) if

  1. (i)

    each of G and H satisfies that each block has at most d vertices and is contained in \({\mathcal {P}}\),

  2. (ii)

    for each non-trivial block B of G[S], the block of G containing B and the block of H containing B have no conflict near B (we explain this below), and

  3. (iii)

    if we make an auxiliary bipartite graph with bipartition \(({\mathcal {A}}, {\mathcal {B}})\) where

    • \({\mathcal {A}}\) is the set of connected components of G[S],

    • \({\mathcal {B}}\) is the union of the set of connected components of G and the set of connected components of H, and

    • \(X\in {\mathcal {A}}\) is adjacent to \(Y\in {\mathcal {B}}\) if X is contained in Y,

    then this bipartite graph has no cycles.

To establish the condition (ii), we guess a graph g(B) for each non-trivial block B of G[S], where g(B) is the block containing B after combining G and H. Note that this target graph g(B) must be a biconnected chordal graph with at most d vertices. So we consider g(B) to be a biconnected chordal graph with distinct labels from \(\{1, \ldots , d\}\). The necessary local information described in (ii) will be the set of labels of neighbors of B (with fixed labels on B) in the block of G containing B. We will store this as h(B). An important point is that for a chordal graph F and a connected vertex set Z, there is an one-to-one correspondence between the connected components of \(F-Z\) and the connected components of the neighborhood of Z in F (see Lemma 1). Therefore, the neighbors of B provide information about which connected components currently exist around B. The meaning of “having no conflict” in (ii) is that the neighbors of B in the block of G and in the block of H have disjoint sets of labels. The pair (gh) will be considered as an index of the table of our dynamic programming algorithm.

Once we have considered (i) and (ii), we need to deal with the auxiliary bipartite graph in (iii). For the (GS) part, it is sufficient to know the auxiliary bipartite graph with components of G. This can be stored as a partition of the set of connected components of G[S]. As the size of S corresponds to the treewidth of the given graph, to obtain a single-exponential algorithm parameterized by treewidth, we need to efficiently deal with these partitions corresponding to partial solutions. This part can be dealt with in a similar manner to the single-exponential time algorithm for Feedback Vertex Set, using representative-set techniques. We recall the representative-set technique in Sect. 4, and prove a variant that is fit for our case.

In the algorithm, for each bag \(B_t\) of the tree decomposition, we guess a deletion set X in \(B_t\), and guess (gh) for blocks in \(B_t{\setminus } X\). Whenever there is a partial solution corresponding to these information, we keep the corresponding partition of the set of connected components on the boundary \(B_t{\setminus } X\). As we take a representative set after partial solutions are updated, we can solve the problem in time \(2^{{\mathcal {O}}(w)}n^{{\mathcal {O}}(1)}\).

Lower bounds. Theorems 2 and 4 are obtained by a reduction from Permutation\(k \times k\)Independent Set, the problem of finding an independent set of size k in a graph with \(k^2\) vertices and \(O(k^4)\) edges. One can think of those vertices as forming a k-by-k grid, where one should select exactly one vertex per row and per column. This problem cannot be solved in time \(2^{o(k \log k)}k^{{\mathcal {O}}(1)}\), unless the ETH fails [16]. The crucial point is that the treewidth of the equivalent instances of Bounded\({\mathcal {P}}\)-Component Vertex Deletion and Bounded\({\mathcal {P}}\)-Block Vertex Deletion should be in \({\varTheta }(k)\). We achieve this by stretching the information into a chain of \(O(k^4)\) almost identical pieces, each encoding one edge of the initial graph. The pieces are linked by small separators of size 2k that propagate the row and column indices of each of the k choices for the independent set.

For Theorem 5, we propose a reduction from Multicolored Clique for the first item, and more or less the same reduction but from Subgraph Isomorphism for the second. Again, the crux of the construction is obtaining an instance with low treewidth. This time, we rely on an injective mapping of edges into integers, which is a folklore trick. Vertices of the initial graph are encoded as a collection of candidate places where the constructed graph can be disconnected, regularly positioned on two paths, one with a small weight and one with a larger weight. The edge gadget is similarly realized with certain vertices that are candidates for removal, as they can disconnect the constructed graph, each corresponding to a specific edge.

Organization. The paper is organized as follows. Sect. 2 introduces the necessary notions including labelings, treewidth, and boundaried graphs. In Sect. 3, we prove structural lemmas about S-blocks, and in Sect. 4, we discuss representative sets for acyclicity. In Sect. 5, we prove Theorems 1 and 3. Section 6 shows that if \({\mathcal {P}}\) contains the cycle graph on d vertices, then both problems are not solvable in time \(2^{o(w\log w)}n^{{\mathcal {O}}(1)}\) on graphs of treewidth at most w, unless the ETH fails. In Sect. 7, we further show that if d is not fixed and \({\mathcal {P}}\) contains all chordal graphs, then Bounded\({\mathcal {P}}\)-Component Vertex Deletion is W[1]-hard when parameterized by both k and w.

2 Preliminaries

Let G be a graph. We denote the vertex set and the edge set of G by V(G) and E(G), respectively. For a vertex v in G, we denote by \(G-v\) the graph obtained by removing v and its incident edges, and for \(X\subseteq V(G)\), we denote by \(G-X\) the graph obtained by removing all vertices in X and their incident edges. For \(X\subseteq V(G)\), we denote by G[X] the subgraph induced by the vertex set X. A subgraph H of G is an induced subgraph of G if \(H=G[X]\) for some vertex subset X of G. For two graphs \(G_1\) and \(G_2\), \(G_1\cup G_2\) is the graph with the vertex set \(V(G_1) \cup V(G_2)\) and the edge set \(E(G_1) \cup E(G_2)\), and \(G_1\cap G_2\) is the graph with the vertex set \(V(G_1) \cap V(G_2)\) and the edge set \(E(G_1) \cap E(G_2)\).

For a vertex v in G, we denote by \(N_G(v)\) the set of neighbors of v in G, and \(N_G[v]:=N_G(v)\cup \{v\}\). For \(X\subseteq V(G)\), we let \(N_G(X):=(\bigcup _{v \in X} N_G(v)) {\setminus } X\).

A vertex v of G is a cut vertex if the deletion of v from G increases the number of connected components. We say G is biconnected if it is connected and has no cut vertices. Note that every connected graph on at most two vertices is biconnected. A block of G is a maximal biconnected subgraph of G. We say G is 2-connected if it is biconnected and \(|V(G)|\geqslant 3\).

The length of a path is the number of edges in the path. Similarly, the length of a cycle is the number of edges in the cycle.

An induced cycle of length at least four is called a chordless cycle. A graph is chordal if it has no chordless cycles. For a class of graphs \({\mathcal {P}}\), a graph is called a \({\mathcal {P}}\)-block graph if each of its blocks is in \({\mathcal {P}}\).

For two integers \(d_1,d_2\) with \(d_1 \leqslant d_2\), let \([d_1,d_2]\) be the set of all integers i with \(d_1\leqslant i\leqslant d_2\), and for a positive integer d, let \([d]:=[1,d]\). For a function \(f:X\rightarrow Y\) and \(X'\subseteq X\), the function \(f':X'\rightarrow Y\) where \(f'(x)=f(x)\) for all \(x\in X'\) is called the restriction of f on \(X'\), and is denoted \(f|_{X'}\). For such a pair of functions f and \(f'\), we also say that fextends\(f'\) to the set X.

2.1 Chordal Graphs

We will use the following property of chordal graphs.

Lemma 1

Let G be a connected chordal graph and X be a vertex subset such that G[X] is connected. Then there is a bijection f from the set of connected components of \(G[N_G(X)]\) to the the set of connected components of \(G-X\) such that a connected component C of \(G[N_G(X)]\) is contained in a connected component H of \(G-X\) if and only if \(H=f(C)\).

Proof

It is sufficient to show that no connected component of \(G-X\) contains two connected components of \(G[N_G(X)]\). Suppose for a contradiction that there is a connected component H of \(G-X\) containing at least two connected components of \(G[N_G(X)]\). Let P be a shortest path between two connected components of \(G[N_G(X)]\) in H, with endpoints \(x_1\) and \(x_2\). Let Q be a shortest path from \(N_G(x_1)\cap X\) to \(N_G(x_2)\cap X\) in G[X], with endpoints \(y_1\in N_G(x_1)\cap X\) and \(y_2\in N_G(x_2)\cap X\). Then \(x_1-y_1-Q-y_2-x_2-P-x_1\) is a chordless cycle, contradicting the fact that G is a chordal graph.

Since G is connected, each connected component of \(G-X\) contains exactly one connected component of \(G[N_G(X)]\). Thus, the required bijection exists. \(\square \)

2.2 Block d-Labeling

For a graph G where every block has at most d vertices, a blockd-labeling of G is a function \(L:V(G) \rightarrow [d]\) such that for each block B of G, \(L|_{V(B)}\) is an injection. If a graph is equipped with a block d-labeling L, then it is called a block d-labeled graph, and we call L(v) the label of v. Two block d-labeled graphs G and H are label-isomorphic if there is a graph isomorphism from G to H that is label preserving. For biconnected block d-labeled graphs G and H, we say H is partially label-isomorphic to G if H is label-isomorphic to the subgraph of G induced by the vertices with labels in H. Where there is no ambiguity, a block d-labeled graph will simply be called a d-labeled graph.

2.3 Treewidth

A tree decomposition of a graph G is a pair \((T,{\mathcal {B}})\) consisting of a tree T and a family \({\mathcal {B}}=\{B_t\}_{t\in V(T)}\) of sets \(B_t\subseteq V(G)\), called bags, satisfying the following three conditions:

  1. 1.

    \(V(G)=\bigcup _{t\in V(T)}B_t\),

  2. 2.

    for every edge uv of G, there exists a node t of T such that \(u,v\in B_t\), and

  3. 3.

    for \(t_1,t_2,t_3\in V(T)\), \(B_{t_1}\cap B_{t_3}\subseteq B_{t_2}\) whenever \(t_2\) is on the path from \(t_1\) to \(t_3\) in T.

The width of a tree decomposition \((T,{\mathcal {B}})\) is \(\max \{ |B_{t}|-1:t\in V(T)\}\). The treewidth of G is the minimum width over all tree decompositions of G. A path decomposition is a tree decomposition \((P,{\mathcal {B}})\) where P is a path. The pathwidth of G is the minimum width over all path decompositions of G. We denote a path decomposition \((P,{\mathcal {B}})\) as \((B_{v_1},\ldots ,B_{v_t})\), where P is a path \(v_1v_2\cdots v_t\).

To design a dynamic programming algorithm, we use a convenient form of a tree decomposition known as a nice tree decomposition. A tree T is said to be rooted if it has a specified node called the root. Let T be a rooted tree with root node r. A node t of T is called a leaf node if it has degree one and it is not the root. For two nodes \(t_1\) and \(t_2\) of T, \(t_1\) is a descendant of \(t_2\) if the unique path from \(t_1\) to r contains \(t_2\). If a node \(t_1\) is a descendant of a node \(t_2\) and \(t_1t_2\in E(T)\), then \(t_1\) is called a child of \(t_2\).

A tree decomposition \((T,{\mathcal {B}}=\{B_t\}_{t\in V(T)})\) is a nice tree decomposition with root node \(r\in V(T)\) if T is a rooted tree with root node r, and every node t of T is one of the following:

  1. 1.

    A leaf node: t is a leaf of T and \(B_t=\emptyset \);

  2. 2.

    An introduce node: t has exactly one child \(t'\) and \(B_t=B_{t'}\cup \{v\}\) for some \(v\in V(G){\setminus } B_{t'}\);

  3. 3.

    A forget node: t has exactly one child \(t'\) and \(B_t=B_{t'}{\setminus } \{v\}\) for some \(v\in B_{t'}\); or

  4. 4.

    A join node: t has exactly two children \(t_1\) and \(t_2\), and \(B_t=B_{t_1}=B_{t_2}\).

Theorem 6

(Bodlaender et al. [4]) Given an n-vertex graph G and a positive integer w, one can either output a tree decomposition of G with width at most \(5w+4\), or correctly answer that the treewidth of G is larger than w, in time \(2^{{\mathcal {O}}(w)} n\).

Lemma 2

(folklore; see Lemma 7.4 in [8]) Given a tree decomposition of an n-vertex graph G of width w, one can construct a nice tree decomposition \((T, {\mathcal {B}})\) of width w with \(|V(T)|={\mathcal {O}}(wn)\) in time \({\mathcal {O}}(w^2\cdot \max (|V(T)|, |V(G)|))\).

2.4 Boundaried Graphs

For a graph G and \(S\subseteq V(G)\), the pair (GS) is called a boundaried graph. When G is a d-labeled graph, we simply say that (GS) is a d-labeled graph. Two d-labeled graphs (GS) and (HS) are said to be compatible if \(V(G-S)\cap V(H-S)=\emptyset \), \(G[S]=H[S]\), and G and H have the same labels on S. For two compatible d-labeled graphs (GS) and (HS), the sum of two graphs is the graph obtained from the disjoint union of G and H by identifying each vertex of S in G with the same vertex in H and removing an edge from multiple edges that appear in S. We denote the resulting graph by \((G,S)\oplus (H,S)\). See Fig. 1 for an example.

Fig. 1
figure 1

An example of the sum \((G,S)\oplus (H,S)\)

Let (GS) and (HS) be d-labeled graphs with block d-labelings \(L_G\) and \(L_H\), respectively. We denote by \(L_G\oplus L_H\) the function from \(V(G)\cup V(H)\) to [d] where for \(v\in V(G)\cup V(H)\), \((L_G\oplus L_H)(v)=L_G(v)\) if \(v\in V(G)\) and \((L_G\oplus L_H)(v)=L_H(v)\) otherwise. Notice that \(L_G\oplus L_H\) is not necessarily a block d-labeling of \(G\oplus H\). For two unlabeled boundaried graphs, we define the sum in the same way, but ignoring the label condition.

A block of a graph is non-trivial if it has at least two vertices. For a boundaried graph (GS), a block B of G is called an S-block if it contains an edge of G[S]. Note that every non-trivial block of G[S] is contained in a unique S-block of G because two distinct blocks share at most one vertex.

Let (GS) be a boundaried graph. We define \({\mathbf {Aux}}(G,S)\) as the bipartite boundaried graph with bipartition \(({\mathcal {X}}, {\mathcal {Y}})\) and boundary \({\mathcal {Y}}\) such that

  1. 1.

    \({\mathcal {X}}\) is the set of components of G, and \({\mathcal {Y}}\) is the set of components of G[S], and

  2. 2.

    for \(C_1\in {\mathcal {X}}\) and \(C_2\in {\mathcal {Y}}\), \(C_1C_2\in E({\mathbf {Aux}}(G,S))\) if and only if \(C_2\) is contained in \(C_1\).

We remark that when (GS) and (HS) are two compatible d-labeled graphs, \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) is well-defined, as G and H have the same set of components on S. We will use this notation to check, when we take the sum of two compatible d-labeled graphs (GS) and (HS), whether the sum contains a chordless cycle through the cycle of \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\).

3 Lemmas About Chordal Graphs and S-Blocks

In this section, we present several lemmas regarding S-blocks.

For a biconnected d-labeled graph Q, we say that a d-labeled graph (GS) is block-wise partially label-isomorphic to Q if every S-block B of G is partially label-isomorphic to Q. A first result describes sufficient conditions for when, given a chordal labeled graph Q, the sum of two given labeled graphs (GS) and (HS), each block-wise partially label-isomorphic to Q, is again block-wise partially label-isomorphic to Q. This argument will be used in the algorithm to decide whether the sum of two partial solutions is again a partial solution.

To guarantee that the sum is again a block-wise partially label-isomoprhic to Q, we need a compatibility condition. Informally, this condition arises due to the property of chordal graphs in Lemma 1. Suppose B is a block of G[S]. Then, for the sum to be label-isomorphic to Q, if \(B_1\) and \(B_2\) are the S-blocks of G and H containing B, then connected components of \(B_1-V(B)\) and \(B_2-V(B)\) have to indicate other components of \(Q-X\), where X is the corresponding vertex set of B in Q. This can be checked by the labels of neighbors of X in Q, since there is a bijection between connected components of \(Q-X\) and connected components of \(Q[N_Q(X)]\).

Formally, we define this compatibility condition as follows. For two compatible d-labeled graphs (GS) and (HS) with labelings \(L_G\) and \(L_H\) respectively, we say that (GS) and (HS) are block-wise Q-compatible if

  1. 1.

    (GS) and (HS) are block-wise partially label-isomorphic to Q; and

  2. 2.

    for every non-trivial block B of G[S], letting \(B_1\) and \(B_2\) be the S-blocks of G and H that contain B, respectively, we have

    1. (a)

      \(L_G(N_{B_1}(V(B)){\setminus } S) \cap L_H(N_{B_2}(V(B)){\setminus } S)=\emptyset \), and,

    2. (b)

      for every \(\ell _1\in L_G(N_{B_1}(V(B)){\setminus } S)\) and every \(\ell _2\in L_H(N_{B_2}(V(B)){\setminus } S)\), the vertices in Q with labels \(\ell _1\) and \(\ell _2\) are not adjacent.

However, this local property is not sufficient to guarantee that the sum is again label-isomorphic to Q. The reason is that there might be a chordless cycle that is not captured by S-blocks of \((G,S)\oplus (H,S)\). We provide such an example in Fig. 2. Observe that, in that case, \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has a cycle. On the other hand, we can show that if we add the condition that \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles, then the sum is indeed label-isomorphic to Q.

Fig. 2
figure 2

An example where the sum of two labeled graphs (GS) and (HS), each partially label-isomorphic to Q, is not partially label-isomorphic to Q, since \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has a cycle

Proposition 1

Let Q be a biconnected d-labeled chordal graph. Let (GS) and (HS) be two block-wise Q-compatible d-labeled graphs such that \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles. Then \((G,S)\oplus (H,S)\) is block-wise partially label-isomorphic to Q.

The following lemma is an essential property of chordal graphs.

Lemma 3

Let F be a connected graph and Q be a connected chordal graph. Let \(\mu :V(F)\rightarrow V(Q)\) be a function such that for every induced path \(p_1 \cdots p_m\) in F of length at most two, \(\mu (p_1), \ldots , \mu (p_m)\) are pairwise distinct and \(\mu (p_1)\cdots \mu (p_m)\) is an induced path of Q. Then \(\mu \) is an injection and preserves the adjacency relation.

Proof

We first show that \(\mu \) is an injection.

Claim 1

F has no two vertices v and w with \(\mu (v)=\mu (w)\).

Proof

Suppose F has two distinct vertices v and w with \(\mu (v)=\mu (w)\). Let \(P=p_1p_2 \cdots p_x\) be a shortest path from \(v=p_1\) to \(w=p_x\) in F. Note that P is an induced path, and by assumption, \(x\geqslant 4\) and \(\mu (p_1)\mu (p_2)\mu (p_3)\) is an induced path in Q. This further implies that \(\mu (p_4)\ne \mu (p_i)\) for \(i\in \{1,2,3\}\). Thus, we have \(x\geqslant 5\).

Let \(y\in \{4, \ldots , x-1\}\) be the smallest integer such that \(\mu (p_y)\) has a neighbor in \(\{\mu (p_1), \ldots , \mu (p_{y-3})\}\). Such an integer exists as \(\mu (p_1)=\mu (p_x)\), so \(\mu (p_{x-1})\) is adjacent to \(\mu (p_1)\), and \(\mu (p_i)\mu (p_{i+1})\mu (p_{i+2})\) is an induced path for each \(1\leqslant i\leqslant x-2\). Let \(\mu (p_z)\) be a neighbor of \(\mu (p_y)\) with \(z\in \{1, 2, \ldots , y-3\}\) and maximum z. Then \(\mu (p_z)\mu (p_{z+1}) \cdots \mu (p_y)\mu (p_z)\) is an induced cycle of length at least 4, which contradicts the assumption that Q is chordal. \(\square \)

Now, we show that \(\mu \) preserves the adjacency relation.

Claim 2

For each \(v,w\in V(F)\), \(vw\in E(F)\) if and only if \(\mu (v)\mu (w)\in E(Q)\).

Proof

Suppose there are two vertices v and w in F such that the adjacency relation between v and w in F is different from the adjacency relation between \(\mu (v)\) and \(\mu (w)\) in Q. When \(vw\in E(F)\), \(\mu (v)\) is adjacent to \(\mu (w)\) in Q by assumption. Thus, \(vw\notin E(F)\) and \(\mu (v)\mu (w)\in E(Q)\). We choose such vertices v and w with minimum distance in F. Let \(P=p_1p_2 \cdots p_x\) be a shortest path from \(v=p_1\) to \(w=p_x\) in F. Observe that \(x\geqslant 4\). By the minimality of the distance, each of \(\mu (p_1)\mu (p_2) \cdots \mu (p_{x-1})\) and \(\mu (p_2)\mu (p_3) \cdots \mu (p_x)\) is an induced path in Q. Therefore,

$$\begin{aligned} \mu (p_1)\mu (p_2) \cdots \mu (p_x)\mu (p_1) \end{aligned}$$

is an induced cycle of length at least four in Q, contradicting the assumption that Q is chordal. \(\square \)

This completes the proof. \(\square \)

We need two more auxiliary lemmas to prove Proposition 1.

Fig. 3
figure 3

The case when the block B is not an S-block in Lemma 4. For each connected component X of G[S], there is a cut vertex of G in B separating X from B in \((G, S)\oplus (H,S)\)

Lemma 4

Let (GS) and (HS) be two compatible d-labeled graphs such that \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles. If F is an S-block of \((G,S)\oplus (H,S)\) and uv is an edge in F, then uv is contained in some S-block of G or H.

Proof

We may assume that one of u and v is not contained in S, otherwise the block containing uv in G or H is an S-block by definition. Without loss of generality, let us assume \(v\in V(G){\setminus } S\). This implies that u is also contained in G.

Since uv is an edge, there is a unique block of G containing both u and v. Let C be the component of G containing u and v, and let B be the block of G containing u and v. If B is an S-block, then we are done. Thus, we may assume that B is not an S-block.

For each vertex w of G contained in B, let \(H_w\) be the subgraph of G induced by the union of w and all components of \(C-V(B)\) containing a neighbor of w. One can observe that if \(H_w\) contains a vertex in a connected component of G[S], then \(C-V(H_w)\) does not contain a vertex of that component; otherwise, the existence of a cycle through \(H_{w}\) and B implies that B is an S-block. See Fig. 3 for an illustration. This implies that for each connected component X of G[S] contained in C, there is a vertex w contained in B such that w separates B and X. Furthermore, since \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles, for every connected component X of G[S], there is a vertex w of G in B such that w separates B from X in \((G,S)\oplus (H,S)\).

As F is an S-block of \((G,S)\oplus (H,S)\), F contains an edge of G[S], say xy. Since F contains xy and \(v\notin S\), F has at least 3 vertices and thus it is 2-connected. On the other hand, the conclusion in the previous paragraph implies that there is a vertex w such that w separates B and \(\{x,y\}\) in \((G,S)\oplus (H,S)\). This contradicts the fact that F is 2-connected.

We conclude that B is an S-block. \(\square \)

Lemma 5

Let (GS) and (HS) be two compatible d-labeled graphs such that each S-block of G or H is chordal, and \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles. If F is an S-block of \((G,S)\oplus (H,S)\) and uvw is an induced path in F such that u and w are not contained in the same S-block of G or H, then

  1. 1.

    \(v\in S\), and

  2. 2.

    There is an induced path \(q_1q_2 \cdots q_{\ell }\) from \(u=q_1\) to \(w=q_{\ell }\) in \(F-v\) such that each \(q_i\) is a neighbor of v.

Proof

Since F contains at least 3 vertices, F is 2-connected. Let C be the component of G containing v.

  1. (1)

    We verify that \(v\in S\). Suppose \(v\notin S\), and without loss of generality we assume \(v\in V(G){\setminus } S\). By Lemma 4, each of uv and vw is contained in some S-block of G. Moreover, since u and w are not contained in the same block, v is a cut vertex of G. Let \(H_1\) be the subgraph of G induced by the union of v and the component of \(C-v\) containing u, and let \(H_2\) be the subgraph of G induced by the union of v and the component of \(C-v\) containing w. Then \(H_1\) and \(H_2\) do not contain vertices from the same component of G[S]. This implies that v separates u and w in G, and since \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles, v separates u and w in \((G, S)\oplus (H,S)\). This contradicts the assumption that F is 2-connected. Therefore, we have \(v\in S\).

  2. (2)

    Let D be the component of G[S] containing v. As \(v\in V(D)\), for each \(z\in \{u,w\}\), we have either \(z\in V(G){\setminus } S\) or \(z\in V(H){\setminus } S\) or \(z\in V(D){\setminus } \{v\}\).

Claim 3

For each \(z\in \{u,w\}\), there is a path from z to \(V(D){\setminus } \{v\}\) in \(G-v\) or \(H-v\).

Proof

If \(z\in V(D){\setminus } \{v\}\), then this is clear. We assume \(z\in V(G){\setminus } S\); the symmetric argument works when \(z\in V(H){\setminus } S\). Suppose for contradiction that there is no path from z to \(V(D){\setminus } \{v\}\) in \(G-v\). Then, v is a cut vertex of G separating z from \(D-v\).

Let \(H'\) be the component of \(C-v\) containing z. If the other vertex in \(\{u,w\}{\setminus } \{z\}\) is also contained in \(H'\), then there is a cycle formed with v and a path from u to w in \(H'\), and thus uvw are contained in the same block of G. Furthermore this block is an S-block by Lemma 4. This contradicts the assumption that u and w are not contained in the same S-block. Thus, \(H'\) does not contain the other vertex in \(\{u,w\}{\setminus } \{z\}\).

Furthermore, since \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles, v separates u and w in \((G,S)\oplus (H,S)\). This contradicts the assumption that F is 2-connected. Therefore, there is a path from z to \(V(D){\setminus } \{v\}\) in \(G-v\). \(\square \)

Let \(U'_1, \ldots , U'_p\) be the connected components of \(D-v\), and for each \(i\in \{1, \ldots , p\}\), let \(U_i:=G[V(U'_i)\cup \{v\}]\). Generally, we show the following.

Claim 4

There is a sequence \(W_1-W_2- \cdots -W_m\) of distinct graphs in \(\{U_1, \ldots , U_p\}\) such that

  • there is a path from u to \(V(W_1)\) in \(G-v\) or \(H-v\),

  • there is a path from w to \(V(W_m)\) in \(G-v\) or \(H-v\), and

  • if \(m\geqslant 2\), then for each \(i\in \{1, \ldots , m-1\}\), there is a path from \(V(W_i){\setminus } \{v\}\) to \(V(W_{i+1}){\setminus } \{v\}\) in \(G-v\) or \(H-v\).

Proof

Let \({\mathcal {X}}_u, {\mathcal {X}}_w\subseteq \{U_1, \ldots , U_p\}\) such that

  • for each \(X\in {\mathcal {X}}_u\), there is a path from u to X in \((G, S)\oplus (H,S)-v\),

  • for each \(X\in {\mathcal {X}}_w\), there is a path from w to X in \((G, S)\oplus (H,S)-v\).

By Claim 3, \({\mathcal {X}}_u\) and \({\mathcal {X}}_w\) are non-empty. If \({\mathcal {X}}_u\cap {\mathcal {X}}_w\ne \emptyset \), then there is a required path. Suppose for contradiction that \({\mathcal {X}}_u\cap {\mathcal {X}}_w=\emptyset \). This implies that there is no path from components in \({\mathcal {X}}_u\) to components in \({\mathcal {X}}_w\) in \((G, S)\oplus (H,S)-v\), and furthermore, there is no path from u to w in \((G, S)\oplus (H,S)-v\). This contradicts the fact that F is 2-connected. \(\square \)

Now, we construct the required path. Fix a sequence \(W_1-W_2- \cdots -W_m\) as obtained in Claim 4. Recall that the vertex set of each \(W_i\) is contained in S. See Fig. 4 for an illustration.

Fig. 4
figure 4

The required path from u to w described in Lemma 5. Dashed edges denote edges incident with vertices in \(H-S\)

Let \(P_0=z_1z_2 \cdots z_{\ell }\) be a path from \(u=z_1\) to \(w_0=z_{\ell }\in V(W_1){\setminus } \{v\}\) in \(G-v\) or \(H-v\) such that

  1. (1)

    \(\ell \) is minimum,

  2. (2)

    subject to (1), the distance from \(w_0\) to v in \(W_1\) is minimum.

Let R be a shortest path from \(z_{\ell }\) to v in \(W_1\). As \(G[V(P_0)\cup V(R)]\) is 2-connected, it is contained in an S-block of G or H, and by assumption, it is chordal. We claim that every vertex in \(P_0\) is a neighbor of v. Suppose there exists \(i\in \{2, \ldots , \ell -1\}\) such that \(z_i\) is not adjacent to v. By the distance condition, there are no edges between \(\{z_1, \ldots , z_{i-1}\}\) and \(\{z_{i+1}, \ldots , z_{\ell }\}\cup (V(W_1){\setminus } \{v\})\). Merging a shortest path from \(z_i\) to v in \(G[\{z_1, \ldots , z_i\}\cup \{v\}]\) and a shorest path from \(z_i\) to v in \(G[\{z_i, \ldots , z_{\ell }\}\cup V(R)]\), one can find a chordless cycle in \(G[V(P_0)\cup V(R)]\); a contradiction. Therefore, every vertex in \(V(P_0){\setminus } \{z_{\ell }\}\) is a neighbor of v. Finally, by the assumption that the distance from \(w_0\) to v in \(W_1\) is minimum, \(w_0\) is a neighbor of v; otherwise \(G[\{z_{\ell -1}\}\cup V(R)]\) is a chordless cycle. Also, we can observe that every vertex in \(P_0\) is in F.

Similarly, let \(P_m\) be a path from w to \(v_m\in V(W_m){\setminus } \{v\}\) such that the length of \(P_m\) is minimum, and subject to that, the distance from \(v_m\) to v in \(W_m\) is minimum. Also, for each \(i\in \{1,\ldots , m-1\}\), let \(P_i\) be the path from \(v_i\in V(W_i){\setminus } \{v\}\) to \(w_i\in V(W_{i+1}){\setminus } \{v\}\) in \(G-v\) or \(H-v\) such that the length of \(P_i\) is minimum, and subject to that, the sum of the distance from \(v_i\) to v in \(W_i\) and the distance from \(w_i\) to v in \(W_{i+1}\) is minimum. Lastly, for each \(i\in \{1, \ldots , m\}\), let \(Q_i\) be a shortest path from \(w_{i-1}\) to \(v_i\) in \(W_i-v\). Similar to \(P_0\), we can prove that every vertex of \(Q_1\cup P_1\cup \cdots \cup Q_m \cup P_m\) is a neighbor of v, and is contained in F. Therefore, the shortest path from u to w in \(P_0\cup Q_1\cup P_1\cup \cdots \cup Q_m \cup P_m\) is the required path. \(\square \)

Proof of Proposition 1

Let F be an S-block of \((G,S)\oplus (H,S)\). We need to show that F is partially label-isomorphic to Q. If F contains at most 2 vertices, then it is contained in G[S], and it is clearly partially label-isomorphic to Q. So we may assume \(|V(F)|\geqslant 3\), and thus F is 2-connected.

Let \(L_Q\) be the labeling of Q. Let \(L_G\) and \(L_H\) be labelings of G and H, respectively, and \(L:=L_G\oplus L_H\). By Lemma 4, every edge of F is contained in some S-block of G or H. This implies that for every edge uv of F, we have \(L(u)\ne L(v)\) and the vertices with labels L(u) and L(v) are adjacent in Q. Moreover, since (GS) and (HS) are block-wise partially label-isomorphic to Q, we have \(L(V(F))\subseteq L_Q(V(Q))\). Let \(\mu :V(F)\rightarrow V(Q)\) such that for each \(v\in V(F)\), \(L(v)=L_Q(\mu (v))\).

To apply Lemma 3, it is sufficient to prove the following. Notice that we do not know yet whether F is chordal or not. But since Q is chordal, every S-block of G is chordal, and also every S-block of H is chordal.

Claim 5

If uvw is an induced path in F, then \(L(u)\ne L(w)\) and \(\mu (u)\mu (v)\mu (w)\) is an induced path in Q.

Proof

First assume that u and w are contained in an S-block of G or H. We further assume that they are contained in an S-block of G, say \(B_{uw}\). The symmetric argument holds when they are contained in an S-block of H. We claim that there is an S-block of G or H containing all of uvw. We divide into two cases.

  • (Case 1. \(v\in V(G)\).) If \(B_{uw}\) contains v, then we are done, so we may assume that \(v\notin V(B_{uw})\). Let \(P_{uw}\) be a path from u to w in \(B_{uw}\). Note that \(P_{uw}\) and v form a cycle of G. But this implies that v is contained in \(B_{uw}\); a contradiction. This proves the claim.

  • (Case 2. \(v\in V(H){\setminus } S\).) In this case, u and w are contained in S. If u and w are contained in distinct connected components of G[S], then \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) contains a cycle of length 4, because uw are contained in a connected component of each of G and H. So, u and w are contained in the same connected component of G[S]. Let \(P_{uw}\) be a path from u to w in G[S]. Then \(P_{uw}\) and v form a cycle in H, which implies that uvw are contained in the same S-block of H.

Then, by the definition of partially label-isomorphic graphs, \(G[\{u,v,w\}]\) or \(H[\{u,v,w\}]\) is isomorphic to \(Q[\{ \mu (u), \mu (v), \mu (w)\}]\). This means that \(\mu (u)\mu (v)\mu (w)\) is an induced path in Q and the labels of \(\mu (u)\) and \(\mu (w)\) are distinct.

Now, we assume that u and w are not contained in the same S-block of G or H. Recall that \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) contains no cycles, by the assumption. So, by Lemma 5, \(v\in S\) and there is an induced path \(q_1q_2 \cdots q_{\ell }\) from \(u=q_1\) to \(w=q_{\ell }\) in \(F-v\) such that each \(q_i\) is a neighbor of v.

We show that for each \(i\in \{1, \ldots , \ell -2\}\), \(L(q_i), L(q_{i+1}), L(q_{i+2})\) are pairwise distinct, and \(\mu (q_i)\mu (q_{i+1})\mu (q_{i+2})\) is an induced path of Q. Let \(i\in \{1, \ldots , \ell -2\}\). If all of \(q_i, q_{i+1}, q_{i+2}\) are contained in G or H, then they are contained in the same S-block with v, and the claim follows. Thus, we may assume that one of \(q_i\) and \(q_{i+2}\) is contained in \(G-S\), and the other one is contained in \(H-S\). Then the S-block containing \(q_i, q_{i+1}, v\) and the S-block containing \(q_{i+1}, q_{i+2}, v\) share the edge \(q_{i+1}v\). Since (GS) and (HS) are block-wise Q-compatible, \(L(q_i)\ne L(q_{i+2})\) and \(\mu (q_i)\) is not adjacent to \(\mu (q_{i+2})\) in Q.

We verify that \(\mu (q_1)\mu (q_2)\cdots \mu (q_{\ell })\) is an induced path of Q. Suppose this is false, and choose \(i_1, i_2\in \{1, 2, \ldots , \ell \}\) with \(i_2-i_1>1\) and minimum \(i_2-i_1\) such that \(\mu (q_{i_1})\) is adjacent to \(\mu (q_{i_2})\) in Q. By minimality, \(\mu (q_{i_1})\cdots \mu (q_{i_2-1})\) and \(\mu (q_{i_1+1})\cdots \mu (q_{i_2})\) are induced paths and have length at least 2. Thus \(\mu (q_{i_1})\cdots \mu (q_{i_2})\) is an induced cycle of length at least 4, contradicting the assumption that Q is chordal. Therefore, \(\mu (q_1)\mu (q_2)\cdots \mu (q_{\ell })\) is an induced path of Q, and, in particular, \(L(u)\ne L(w)\) and \(\mu (u)\) and \(\mu (w)\) are not adjacent in Q, as required. \(\square \)

By Claim 5 and Lemma 3, we conclude that F is partially label-isomorphic to Q. \(\square \)

Later, we will consider some information on non-trivial blocks of G[S], where two blocks in G[S] contained in the same S-block of G or H have the same information. In Lemma 6, we analyze when this property is preserved after taking the sum of (GS) and (HS).

Lemma 6

Let A be a set. Let (GS) and (HS) be two compatible d-labeled graphs, \({\mathcal {B}}\) be the set of non-trivial blocks in G[S], and \(g:{\mathcal {B}}\rightarrow A\) be a function such that

  • each S-block of G or H is chordal,

  • \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles, and

  • for every \(B_1, B_2\in {\mathcal {B}}\) where \(B_1\) and \(B_2\) are contained in an S-block of G or H, \(g(B_1)=g(B_2)\).

If F is an S-block of \((G,S)\oplus (H,S)\) and \(B_1, B_2\in {\mathcal {B}}\) where \(V(B_1), V(B_2)\subseteq V(F)\), then \(g(B_1)=g(B_2)\).

Proof

By Lemma 4, every edge of F is contained in an S-block of G or H. We define a function \(g':E(F)\rightarrow A\) such that for each \(vw\in E(F)\), \(g'(vw)=g(B)\) where \(B\in {\mathcal {B}}\) and B is contained in the S-block of G or H containing v and w. We claim that \(g'(e)=g'(f)\) for all \(e,f\in E(F)\).

Claim 6

\(g'(e)=g'(f)\) for all \(e,f\in E(F)\).

Proof

Suppose towards a contradiction that there are \(e,f\in E(F)\) such that e and f share a vertex and \(g'(e)\ne g'(f)\). Let \(e=uv\) and \(f=vw\). Then uvw are not contained in the same S-block of G or H as \(g'(e)\ne g'(f)\). Also, this implies that u is not adjacent to w. Thus by Lemma 5, \(v\in S\), and there is an induced path \(q_1q_2 \cdots q_{\ell }\) from \(u=q_1\) to \(w=q_{\ell }\) in \(F-v\) such that each \(q_i\) is a neighbor of v.

As \(q_1, q_2, v\) are contained in the same S-block of G or H, we observe that \(g'(q_1q_2)=g'(q_1v)=g'(uv)\). Similarly, we have \(g'(q_{\ell -1}q_{\ell })=g'(q_{\ell }w)=g'(vw)\).

We claim that for each \(i\in \{1, \ldots , \ell -2\}\), \(g'(q_iq_{i+1})=g'(q_{i+1}q_{i+2})\). Let \(i\in \{1, \ldots , \ell -2\}\). If \(\{q_i, q_{i+1}, q_{i+2}\}\subseteq V(G)\) or \(\{q_i, q_{i+1}, q_{i+2}\}\subseteq V(H)\), then \(q_i, q_{i+1}, q_{i+2}\) are contained in the same S-block with v, and the claim follows. We may assume that one of \(q_i\) and \(q_{i+2}\) is contained in \(G-S\) and the other one is contained in \(H-S\). In this case, the S-block containing \(q_i, q_{i+1}, v\) and the S-block containing \(q_{i+1}, q_{i+2}, v\) share the edge \(q_{i+1}v\), and we have \(g'(q_iq_{i+1})=g'(q_{i+1}v)=g'(q_{i+1}q_{i+2})\). Therefore, \(g'(uv)=g'(q_1q_2)=g'(q_{\ell -1}q_{\ell })=g'(vw)\), which is a contradiction.

We conclude that \(g'(e)=g'(f)\) for all \(e,f\in E(F)\), as required. \(\square \)

Now, for each \(i\in \{1,2\}\), we choose an edge \(u_iv_i\) in \(B_i\). By Claim 6, we have \(g(B_1)=g'(u_1v_1)=g'(u_2v_2)=g(B_2)\). \(\square \)

We also need the following lemma.

Lemma 7

Let (GS) and (HS) be two compatible d-labeled graphs such that \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles. If F is an S-block of \((G,S)\oplus (H,S)\), then \({\mathbf {Aux}}(F\cap G,S\cap V(F))\oplus {\mathbf {Aux}}(F\cap H,S\cap V(F))\) has no cycles.

Proof

Let \(S_F:=S\cap V(F)\). Suppose towards a contradiction that \({\mathbf {Aux}}(F\cap G,S_F)\oplus {\mathbf {Aux}}(F\cap H,S_F)\) has a cycle \(C_1-F_1-\cdots -C_m-F_m-C_1\), where \(C_1, \ldots , C_m\) are components of \(F[S_F]\).

First assume that there are two distinct components \(C_i, C_j\in \{C_1, \ldots , C_m\}\) contained in the same component of G[S]. We choose such components \(C_i, C_j\) such that the distance between \(C_i\) and \(C_j\) in the cycle \(C_1-F_1-\cdots -C_m-F_m-C_1\) is minimum. By relabeling if necessary, we may assume that \(i<j\) and in the sequence \(C_i, C_{i+1}, \ldots , C_j\), there are no two components contained in the same component of G[S] except the pair \((C_i, C_j)\).

We claim that all of \(C_i, F_i, C_{i+1}, F_{i+1}, \ldots , C_j\) are contained in the same component of G or H. Without loss of generality, we assume that \(F_i\) is contained in G.

Note that \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles. So if there is \(C_{i_1}\) for some \(i<i_1\leqslant j\) where \(C_{i_1}\) and \(C_i\) are not contained in the same component of G or H, then there exists \(i_1<i_2\leqslant j\) where \(C_{i_2}\) and \(C_{i_1}\) are contained in the same connected component of G[S]. But this contradicts the assumption that \(C_i\) and \(C_j\) are contained in the same connected component of G[S] where the distance between \(C_i\) and \(C_j\) in the cycle \(C_1-F_1-\cdots -C_m-F_m-C_1\) is minimum. Also, if \(F_{i'}\) is contained in H for some \(i<i'\), then there exists \(i'<i''\) such that \(C_{i'}\) and \(C_{i''}\) are contained in the same connected component of G[S]; a contradiction. Therefore, all of \(C_i, F_i, C_{i+1}, F_{i+1}, \ldots , C_j\) are contained in the same component of G.

This implies that \(j=i+1\); because all these subgraphs are connected to each other in \(F\cap G\). Let P be a path from \(V(C_i)\) to \(V(C_{i+1})\) in \(F_i\) with endpoints x and y, and Q be a path from x to y in G[S]. Then \(P\cup Q\) is a cycle containing x and y, and the existence of this cycle implies that \(V(P)\cup V(Q)\subseteq V(F)\), as F is a block of \((G,S)\oplus (H,S)\). But this implies that \(C_i\) and \(C_{i+1}\) are contained in the same connected component of \(F[S_F]\); a contradiction. We conclude that there are no two distinct components \(C_i\) and \(C_j\) contained in the same component of G[S].

We observe that all of \(C_1, \ldots , C_m\) are contained in the same component of G or H since there are no two distinct components \(C_i\) and \(C_j\) contained in the same component of G[S]. This implies that \(C_1, \ldots , C_m\) are contained in the same component of \(F\cap G\) or \(F\cap H\). This contradicts the assumption that \(C_1-F_1-\cdots -C_m-F_m-C_1\) is a cycle. \(\square \)

Lastly, we show that when every S-block of \((G,S)\oplus (H,S)\) is chordal, \((G,S)\oplus (H,S)\) is chordal if and only if \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles.

Proposition 2

Let (GS) and (HS) be two compatible graphs such that every S-block of \((G,S)\oplus (H,S)\) is chordal. The following are equivalent:

  1. 1.

    \((G, S)\oplus (H,S)\) is chordal.

  2. 2.

    \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles.

Proof

Let \({\mathcal {C}}\) be the set of components of G[S].

Fig. 5
figure 5

Finding a chordless cycle in Proposition 2

(1 \(\Rightarrow \) 2). Suppose that \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has a cycle \(C_1-A_1-C_2-A_2-\cdots -C_n-A_n-C_1\) where \(C_1, \ldots , C_n\in {\mathcal {C}}\). For convenience, let \(C_{n+1}:=C_1\) and \(A_{n+1}:=A_1\).

We construct an induced cycle of length at least 4 in \((G,S)\oplus (H,S)\). For each \(i\in \{1, \ldots , n\}\), we define that

  • \(P_i\) is the shortest path from \(C_i\) to \(C_{i+1}\) in \(A_i\),

  • \(v_i, w_i\) are the end vertices of \(P_i\) where \(v_i\in V(C_i)\) and \(w_i\in V(C_{i+1})\).

  • \(Q_i\) is the shortest path from \(w_i\) to \(v_{i+1}\) in \(C_{i+1}\).

Note that \(n\geqslant 2\). We consider two cases depending on whether \(n=2\) or not.

Suppose \(n=2\). Notice that \(A_1\) and \(A_2\) may share several components of G[S]. We choose \(C_1,C_2, P_1, P_2, Q_1, Q_2\) such that the cycle \(P_1\cup Q_1\cup P_2\cup Q_2\) passes the minimum number of components of G[S]. This minimality implies that \(C_1\) and \(C_2\) are the only components of G[S] that contain vertices of both \(P_1\) and \(P_2\), and there are no edges between the internal vertices of \(P_1\) and the internal vertices of \(P_2\). Therefore, \(P_1\cup Q_1\cup P_2\cup Q_2\) contains a chordless cycle.

Now, assume that \(n\geqslant 3\). In this case, \(v_1-P_1-Q_1-P_2-Q_2-\cdots -P_n-Q_n-v_1\) is a cycle in \((G,S)\oplus (H,S)\), but is not necessarily a chordless cycle. Call this cycle C. We claim that C contains a chordless cycle. Let x be the vertex following \(v_2\) in \(P_2\), and y be the vertex preceding \(w_n\) in \(P_n\). See Fig. 5 for an illustration. Take a shortest path P from x to y in the path \(y-Q_n-P_1-Q_1-x\). Clearly P has length at least 2, as x and y are contained in distinct components of Q. Also, every internal vertex of P has no neighbors in the other path of the cycle \(v_1-P_1-Q_1-P_2-Q_2-\cdots -P_n-Q_n-v_1\) between x and y. So, if we take a shortest path \(P'\) from x to y along the other part of the cycle \(v_1-P_1-Q_1-P_2-Q_2-\cdots -P_n-Q_n-v_1\), then \(P\cup P'\) is a chordless cycle. This proves the claim.

(2 \(\Rightarrow \) 1). Suppose, towards a contradiction, that \((G, S)\oplus (H, S)\) contains a chordless cycle C. Since G and H are chordal, C should contain a vertex of \(G-S\) and a vertex of \(H-S\). By assumption, we know that every S-block of \((G, S)\oplus (H, S)\) is chordal. Thus, C can contain at most one vertex from each S-block of \((G, S)\oplus (H,S)\). Furthermore, we can observe that \(|V(C)\cap V(F)|\leqslant 1\) for every component F of G[S]; otherwise one of S-blocks of \((G,S)\oplus (H,S)\) should contain all vertices of C, contradicting the fact that every S-block is chordal.

Let \(C_1-C_2- \cdots - C_n-C_1\) be the sequence of components of G[S] such that

  1. 1.

    for each \(v\in V(C)\cap V(C_i)\), one neighbor of v in C is contained in \(G-S\) and the other is contained in \(H-S\), and

  2. 2.

    C passes through the components of G[S] in this order.

As C contains at least one vertex of \(G-S\) and one vertex of \(H-S\), such a sequence exists, and \(n\geqslant 2\). Without loss of generality, we may assume that the internal vertices in the path from \(C_1\) to \(C_2\) (corresponding to the first part of the sequence) are contained in G. Then, the internal vertices in the path from \(C_2\) to \(C_3\) are contained in H, and we use parts of \(G-S\) and \(H-S\) alternately. For each i, pick \(A_i\in V({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)){\setminus } {\mathcal {C}}\) corresponding to a component of G or H containing the internal vertices of the path from \(C_i\) to \(C_{i+1}\). Then \(C_1-A_1-C_2-A_2-\cdots -C_n-A_n-C_1\) contains a cycle of \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\). \(\square \)

4 Representative Sets for Acyclicity

In our algorithm, we need to store auxiliary graphs \({\mathbf {Aux}}(G,S)\) for boundaried graphs (GS). Instead of working with \({\mathbf {Aux}}(G,S)\), we work with the partition of the set \({\mathcal {C}}\) of components of G[S], where \(C_1, C_2\in {\mathcal {C}}\) are in the same part if and only if they are contained in the same component of G. This formulation has the advantage that it is convenient for applying representative-set techniques.

For a set S and a family \({\mathcal {X}}\) of subsets of S, we define \({\mathbf {Inc}}(S, {\mathcal {X}})\) as the bipartite graph on the bipartition \((S, {\mathcal {X}})\) such that for \(v\in S\) and \(X\in {\mathcal {X}}\) with \(v\in X\), v and X are adjacent in \({\mathbf {Inc}}(S, {\mathcal {X}})\). Let S be a set, and \({\mathcal {A}}\) be a set of partitions of S. A subset \({\mathcal {A}}'\) of \({\mathcal {A}}\) is called a representative set if

  • for every \({\mathcal {X}}_1\in {\mathcal {A}}\) and every partition \({\mathcal {Y}}\) of S where \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {Y}})\) has no cycles, there exists a partition \({\mathcal {X}}_2\in {\mathcal {A}}'\) such that \({\mathbf {Inc}}(S, {\mathcal {X}}_2\cup {\mathcal {Y}})\) has no cycles.

Computing a representative set for a family of partitions is an essential part of our algorithm. To apply the ideas in [3], it is necessary to translate our problem to finding a pair of partitions \({\mathcal {X}}_1, {\mathcal {X}}_2\) where \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) is connected.

For partitions \({\mathcal {X}}_1\) and \({\mathcal {X}}_2\) of a set S, \({\mathcal {X}}_1\) is a coarsening of \({\mathcal {X}}_2\) if every two elements in the same part of \({\mathcal {X}}_2\) are in the same part of \({\mathcal {X}}_1\). We denote by \({\mathcal {X}}_1\uplus {\mathcal {X}}_2\) the common coarsening of \({\mathcal {X}}_1\) and \({\mathcal {X}}_2\) with the maximum number of parts. For instance, if \({\mathcal {X}}_1=\{\{1\}, \{2,3\}, \{4\}\}\) and \({\mathcal {X}}_2=\{\{1,2\}, \{3\}, \{4\} \}\), then both \(\{\{1,2,3\}, \{4\}\}\) and \(\{\{1,2,3,4\}\}\) are common coarsenings of \({\mathcal {X}}_1\) and \({\mathcal {X}}_2\), and \({\mathcal {X}}_1\uplus {\mathcal {X}}_2=\{\{1,2,3\}, \{4\}\}\).

Lemma 8

Let S be a set and let \({\mathcal {X}}_1, {\mathcal {X}}_2\) be two partitions of S such that \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) is connected. Then \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) has no cycles if and only if \(|{\mathcal {X}}_1|+|{\mathcal {X}}_2|=|S|+1\).

Proof

Let \(H:={\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {X}}_2)\). The result follows from the fact that \(|V(H)|=|S|+|{\mathcal {X}}_1|+|{\mathcal {X}}_2|\), \(|E(H)|=2|S|\), and a connected graph H has no cycles if and only if \(|E(H)|=|V(H)|-1\). \(\square \)

For a set S and a partition \({\mathcal {X}}\) of S, a partition \({\mathcal {Y}}\) of S is called a 1-coarsening of \({\mathcal {X}}\) if \({\mathcal {Y}}={\mathcal {X}}{\setminus } \{X_1, \ldots , X_m\}\cup \{X_1\cup \cdots \cup X_m\}\) for some \(X_1, \ldots , X_m\in {\mathcal {X}}\). Notice that the partition \({\mathcal {X}}\) itself is a 1-coarsening of \({\mathcal {X}}\). We will use the following observation. For two partitions \({\mathcal {X}}_1, {\mathcal {X}}_2\) of a set S, the following are equivalent:

  • \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) has no cycles.

  • There exists a 1-coarsening \({\mathcal {X}}_1'\) of \({\mathcal {X}}_1\) such that \({\mathbf {Inc}}(S, {\mathcal {X}}_1'\cup {\mathcal {X}}_2)\) is connected and has no cycles.

Such a 1-coarsening \({\mathcal {X}}_1'\) can be obtained by taking one part of \({\mathcal {X}}_1\) for each component of \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) and unifying them into one part. Since the vertex corresponding to the new part of \({\mathcal {X}}_1'\) would be a cut vertex of \({\mathbf {Inc}}(S, {\mathcal {X}}_1'\cup {\mathcal {X}}_2)\), there will not be an additional cycle in \({\mathbf {Inc}}(S, {\mathcal {X}}_1'\cup {\mathcal {X}}_2)\) while it is connected.

Theorem 7

([3]; see also Theorem 11.11 in [8]) Given two families of partitions \({\mathcal {A}}\), \({\mathcal {B}}\) of a set S, one can, in time \({\mathcal {A}}^{{\mathcal {O}}(1)} 2^{{\mathcal {O}}(|S|)}\), find a set \({\mathcal {A}}'\subseteq {\mathcal {A}}\) of size at most \(2^{|S|-1}\) such that for every \({\mathcal {X}}_1\in {\mathcal {A}}\) and every \({\mathcal {Y}}\in {\mathcal {B}}\) such that \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {Y}})\) is connected, there exists \({\mathcal {X}}_2\in {\mathcal {A}}'\) such that \({\mathbf {Inc}}(S, {\mathcal {X}}_2\cup {\mathcal {Y}})\) is connected.

We explicitly describe a necessary subroutine, Algorithm 1.

figure c

Proposition 3

Given a family \({\mathcal {A}}\) of partitions of a set S, Algorithm 1 outputs a representative set of \({\mathcal {A}}\) of size at most \(|S|\cdot 2^{|S|-1}\) in time \({\mathcal {A}}^{{\mathcal {O}}(1)} 2^{{\mathcal {O}}(|S|)}\).

Proof

Let \({\mathcal {R}}\) be the output of Algorithm 1. Clearly, \({\mathcal {R}}\subseteq {\mathcal {A}}\), because we take the original partitions of \(\bigcup _{1\leqslant i\leqslant |S|}{\mathcal {R}}_i\) at the last step. Thus, it is sufficient to show that

  • for every \({\mathcal {X}}_1\in {\mathcal {A}}\) and every partition \({\mathcal {Y}}\) of S where \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {Y}})\) has no cycles, there exists a partition \({\mathcal {X}}_2\in {\mathcal {R}}\) such that \({\mathbf {Inc}}(S, {\mathcal {X}}_2\cup {\mathcal {Y}})\) has no cycles.

To show this, let \({\mathcal {X}}_1\in {\mathcal {A}}\) and \({\mathcal {Y}}\) be partitions of S such that \({\mathbf {Inc}}(S, {\mathcal {X}}_1\cup {\mathcal {Y}})\) has no cycles. We know that there exists a 1-coarsening \({\mathcal {X}}_2\) of \({\mathcal {X}}_1\) such that \({\mathbf {Inc}}(S, {\mathcal {X}}_2\cup {\mathcal {Y}})\) is connected and has no cycles. This 1-coarsening \({\mathcal {X}}_2\) is obtained in Step 1. In Step 3, we obtain \({\mathcal {R}}_{|{\mathcal {X}}_2|}\), and there exists \({\mathcal {X}}_3\in {\mathcal {R}}_{|{\mathcal {X}}_2|}\) such that \({\mathbf {Inc}}(S, {\mathcal {X}}_3\cup {\mathcal {Y}})\) is connected and has no cycles. Let \({\mathcal {X}}_4\) be the partition obtained from \({\mathcal {X}}_3\) by taking the original partition before taking a 1-coarsening. We have that \({\mathcal {X}}_4\in {\mathcal {R}}\) and \({\mathbf {Inc}}(S, {\mathcal {X}}_4\cup {\mathcal {Y}})\) has no cycles, as required. By Theorem 7, \(|{\mathcal {R}}|\leqslant \sum _{1\leqslant i\leqslant |S|} |{\mathcal {R}}_{i}|\leqslant |S|\cdot 2^{|S|-1}\) and Algorithm 1 runs in time \({\mathcal {A}}^{{\mathcal {O}}(1)} 2^{{\mathcal {O}}(|S|)}\). \(\square \)

5 Bounded \({\mathcal {P}}\)-Block Vertex Deletion

In this section, we prove Theorem 1, restated below.

Theorem 1

Let \({\mathcal {P}}\) be a class of graphs that is block-hereditary, recognizable in polynomial time, and consists of only chordal graphs. Then Bounded\({\mathcal {P}}\)-Block Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(wd^2)}k^2 n\) on graphs with n vertices and treewidth w.

We provide an overview of our approach for Theorem 1.

  1. 1.

    Let (GS) be a d-labeled \({\mathcal {P}}\)-block graph, which will be the graph that remains after removing some partial solution in the dynamic programming algorithm. We first focus on S-blocks of (GS). For each non-trivial block of G[S], we guess its final shape as a d-labeled biconnected graph, and store the labelings of the vertices and their neighbors in the S-block of G containing it. Collectively, we call this information a characteristic of (GS).

  2. 2.

    Suppose (HS) is a d-labeled \({\mathcal {P}}\)-block boundaried graph compatible with (GS) such that every S-block of \((G,S)\oplus (H,S)\) is a d-labeled \({\mathcal {P}}\)-block graph. Note that \((G,S)\oplus (H,S)\) still may have a chordless cycle, and by Proposition 2, \((G,S)\oplus (H,S)\) is chordal if and only if \({\mathbf {Aux}}(G,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles. If \((G,S)\oplus (H,S)\) is chordal, then it is easy to check that for every block B of \((G,S)\oplus (H,S)\), either B is contained in one of G and H, or it is an S-block. Thus, instead of storing \({\mathbf {Aux}}(G,S)\), we will store the corresponding partition of the set of components of G[S]. To avoid storing all such partitions, whose total size might be \(2^{c\cdot w\log w}\) for some constant c, we use the representative set technique discussed in Sect. 4.

  3. 3.

    We formally describe and prove an equivalence between two boundaried graphs in Theorem 8.

For convenience, we fix an integer \(d\geqslant 2\) and a class \({\mathcal {P}}\) of graphs that is block-hereditary, recognizable in polynomial time, and consists of only chordal graphs. Let \({\mathcal {U}}_d\) be the set of all d-labeled biconnected \({\mathcal {P}}\)-block graphs. For a boundaried graph (GS), we denote by \({\text {Block}}(G,S)\) the set of all non-trivial blocks in G[S].

5.1 Characteristics

For a d-labeled graph (GS) with labeling L, a characteristic of (GS) is a pair (gh) of functions \(g:{\text {Block}}(G,S) \rightarrow {\mathcal {U}}_d\) and \(h:{\text {Block}}(G,S) \rightarrow 2^{[d]}\) satisfying the following: for each \(B\in {\text {Block}}(G,S)\) and the unique S-block X of G containing B,

  1. (a)

    (label-isomorphism condition) X is partially label-isomorphic to g(B);

  2. (b)

    (coincidence condition) for every \(B'\in {\text {Block}}(G,S)\) contained in X, \(g(B')=g(B)\);

  3. (c)

    (neighborhood condition) \(h(B)=L(N_{X}(V(B)){\setminus } S)\); and

  4. (d)

    (completeness condition) for every w where \(w\in V(X){\setminus } S\) or \(\{w\}=V(X)\cap V(C)\) for some component C of G[S], \(X[N_X[w]]\) is label-isomorphic to \(g(B)[N_{g(B)}[z]]\) where z is the vertex in g(B) with label L(w).

Motivation for conditions (a) and (c) was given in the overview. Since we want that g(B) is a final block containing B, for any other non-trivial block \(B'\) of G[S] already contained in the same block of G with B, it has to indicate the same final block; this is condition (b). If we just say that (a) X is partially label-isomorphic to g(B), then some vertex of X may have an unexpected neighbor. To avoid this problem, we impose the last condition (d).

For a d-labeled \({\mathcal {P}}\)-block graph (GS) with characteristic (gh) and a d-labeled \({\mathcal {P}}\)-block graph (HS) compatible with (GS), the sum \((G,S)\oplus (H,S)\)respects (gh) if for each \(B\in {\text {Block}}(G,S)\), the S-block of \((G,S)\oplus (H,S)\) containing B is label-isomorphic to g(B).

The following is the main combinatorial result regarding characteristics.

Theorem 8

Let \((G_1, S)\), \((G_2, S)\), and (HS) be d-labeled \({\mathcal {P}}\)-block graphs such that

  • for each \(i\in \{1,2\}\), \((G_i, S)\) is compatible with (HS),

  • \((G_1, S)\) and \((G_2, S)\) have the same characteristic (gh), and

  • \({\mathbf {Aux}}(G_2,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles.

If \((G_1, S)\oplus (H, S)\) is a d-labeled \({\mathcal {P}}\)-block graph that respects (gh), then \((G_2, S)\oplus (H, S)\) is a d-labeled \({\mathcal {P}}\)-block graph that respects (gh).

Proof

Suppose \((G_1, S)\oplus (H, S)\) is a d-labeled \({\mathcal {P}}\)-block graph that respects (gh). We first show that \((G_2, S)\oplus (H, S)\) respects (gh). Choose a non-trivial block B of \(G_2[S]\), let \(Q:=g(B)\), and let F be the S-block of \((G_2, S)\oplus (H, S)\) containing B. As a shortcut, set \(S_{F}:=V(F)\cap S\). Let \(L_F\) be the function from V(F) to [d] that sends each vertex to its label from \(G_2\) or H. Let \(L_Q\) be the labeling of Q.

We show that \(L_F\) is a d-labeling of F, and F is partially label-isomorphic to Q. We verify the conditions of Proposition 1 by regarding F as the sum of \((F\cap G_2, S_F)\) and \((F\cap H, S_F)\) to show that F is partially label-isomorphic to Q. We additionally show that \(L_Q(V(Q))\subseteq L_F(V(F))\), in order to complete the proof.

Claim 7

For every non-trivial block \(B'\) of \(G_2[S]\) with \(V(B')\subseteq V(F)\), \(g(B')=Q\).

Proof

Note that \({\mathbf {Aux}}(G_2,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles. Since (gh) is a characteristic of \((G_2, S)\), for non-trivial blocks \(B_1, B_2\) of \(G_2[S]\) contained in the same S-block of \(G_2\), \(g(B_1)=g(B_2)\). Also, since \((G_1, S)\oplus (H,S)\) respects (gh), for non-trivial blocks \(B_1, B_2\) of \(G_2[S]\) contained in the same S-block of H, \(g(B_1)=g(B_2)\). Thus, the claim follows from Lemma 6. \(\square \)

Since \({\mathbf {Aux}}(G_2,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles, by Lemma 7, \({\mathbf {Aux}}(F\cap G_2,S_F)\oplus {\mathbf {Aux}}(F\cap H,S_F)\) has no cycles. To apply Proposition 1, it remains to show that \((F\cap G_2,S_F)\) and \((F\cap H,S_F)\) are block-wise Q-compatible.

Claim 8

\((F\cap G_2, S_F)\) and \((F\cap H, S_F)\) are block-wise Q-compatible.

Proof

By Claim 7 and the fact that (gh) is a characteristic of \((G_2, S)\), \(F\cap G_2\) is block-wise partially label-isomorphic to Q. By Claim 7 and the fact that \((G_1, S)\oplus (H,S)\) respects (gh), \(F\cap H\) is block-wise partially label-isomorphic to Q.

We now confirm the second condition of being block-wise Q-compatible. Let \(B\in {\text {Block}}(F, S_F)\). Let \(B_1\) be the S-block of \(G_2\) containing B, \(B_2\) be the S-block of H containing B, and \(B_1'\) be the S-block of \(G_1\) containing B.

Since \((G_1, S)\oplus (H,S)\) respects (gh), \(N_{B_1'}(V(B)){\setminus } S\) and \(N_{B_2}(V(B)){\setminus } S\) have disjoint sets of labels. As \((G_1, S)\) and \((G_2, S)\) have the same characteristic, \(N_{B_1'}(V(B)){\setminus } S\) and \(N_{B_1}(V(B)){\setminus } S\) have the same set of labels, and thus \(N_{B_1}(V(B)){\setminus } S\) and \(N_{B_2}(V(B)){\setminus } S\) have disjoint sets of labels. Furthermore, for every \(\ell _1\in L_F(N_{B_1}(V(B)){\setminus } S)\) and every \(\ell _2 \in L_F(N_{B_2}(V(B)){\setminus } S)\), the vertices in Q with labels \(\ell _1\) and \(\ell _2\) are not adjacent because there are no edges between \(N_{B_1'}(V(B)){\setminus } S\) and \(N_{B_2}(V(B)){\setminus } S\) in \((G_1, S)\oplus (H,S)\). \(\square \)

By Claim 8 and Proposition 1, \(L_F\) is a d-labeling of F and F is partially label-isomorphic to Q. Lastly, we show that F and Q have the same set of labels.

Claim 9

\(L_Q(V(Q))\subseteq L_F(V(F))\).

Proof

Suppose there is a vertex v in Q such that F has no vertex with label \(L_Q(v)\). We choose such a vertex v so that there exists \(w\in V(Q)\) that is adjacent to v in Q where the label of w appears in F. We can choose such vertices v and w because Q is connected, \(V(F)\ne \emptyset \), and \(L_F(V(F))\subseteq L_Q(V(Q))\). Let \(w'\) be the vertex in F with label \(L_Q(w)\).

First assume \(w'\in V(F){\setminus } S\). If \(w'\in V(G_2){\setminus } S\), then by the completeness condition of the characteristic, \(U[N_U[w']]\) is label-isomorphic to \(Q[N_Q[w]]\), where U is the S-block of \(G_2\) containing \(w'\) and \(V(U)\subseteq V(F)\). If \(w'\in V(H){\setminus } S\), then since \((G_1, S)\oplus (H,S)\) respects (gh), \(U[N_U[w']]\) is label-isomorphic to \(Q[N_Q[w]]\), where U is the S-block of H containing \(w'\) and \(V(U)\subseteq V(F)\). Thus, in these cases, F contains a vertex with label \(L_Q(v)\); a contradiction. We may assume that \(w'\) is contained in S.

Next, we assume that \(\{w'\}\) is the vertex set of some component of \(F[S_F]\). In this case, F has at least 3 vertices, because F contains some edge of \(G_2[S]\). Thus, \(w'\) has a neighbor in F. We claim that \(w'\) has neighbors in precisely one of \(F\cap G_2\) and \(F\cap H\). Towards a contradiction, suppose \(w'\) has neighbors in both \(F\cap G_2\) and \(F\cap H\). Note that \(F-w'\) is connected. We take a shortest path P from \(N_{F\cap G_2}(w')\) to \(N_{F\cap H}(w')\). By construction, the end vertices of P are not adjacent, and \(w'\) is not adjacent to any internal vertices of P. Thus, \(F[\{w'\}\cup V(P)]\) is a chordless cycle, contradicting the fact that F is partially label-isomorphic to Q and Q is chordal. We conclude that \(w'\) has neighbors in precisely one of \(F\cap G_2\) and \(F\cap H\).

If \(w'\) has a neighbor in \(F\cap G_2\), then by the completeness condition of the characteristic, \(U[N_U[w']]\) is label-isomorphic to \(Q[N_Q[w]]\), where U is the S-block of \(G_2\) containing \(w'\) and \(V(U)\subseteq V(F)\). If \(w'\) has a neighbor in \(F\cap H\), then since \((G_1, S)\oplus (H,S)\) respects (gh), \(U[N_U[w']]\) is label-isomorphic to \(Q[N_Q[w]]\), where U is the S-block of H containing \(w'\) and \(V(U)\subseteq V(F)\). Thus, in these cases, F contains a vertex with label \(L_Q(v)\); a contradiction.

Finally, we may assume that there is a non-trivial block \(B'\) of \(F[S_F] \) containing \(w'\). We observe that the S-block of \((G_1, S)\oplus (H, S)\) containing \(B'\) is label-isomorphic to Q. We also observe that every label appearing in the neighborhood of \(w'\) in the S-block of \((G_1, S)\oplus (H, S)\) containing \(B'\) appears in the neighborhood of \(w'\) in \((G_2, S)\oplus (H, S)\) as well, because \((G_1, S)\) and \((G_2, S)\) have the same characteristic. This contradicts the assumption that F has no vertex with label \(L_Q(v)\). We conclude that \(L_Q(V(Q))\subseteq L_F(V(F))\). \(\square \)

We conclude that F is label-isomorphic to Q. Since B was arbitrarily chosen, this implies that \((G_2, S)\oplus (H,S)\) respects (gh). Lastly, we confirm that \((G_2,S)\oplus (H,S)\) is a d-labeled \({\mathcal {P}}\)-block graph.

Claim 10

The graph \((G_2,S)\oplus (H,S)\) is a d-labeled \({\mathcal {P}}\)-block graph.

Proof

It is sufficient to show that every non S-block of \((G_2,S)\oplus (H,S)\) is fully contained in \(G_2\) or H. We observe that since \({\mathbf {Aux}}(G_2,S)\oplus {\mathbf {Aux}}(H,S)\) has no cycles and every S-block of \((G_2, S)\oplus (H,S)\) is chordal, by Proposition 2, we have \((G_2, S)\oplus (H, S)\) is chordal.

Suppose towards a contradiction that there is a non S-block U of \((G_2,S)\oplus (H,S)\) intersecting both \(G_2-S\) and \(H-S\). We choose a triple (vwD) such that

  • \(v\in V(U)\cap (V(G_2){\setminus } S)\), \(w\in V(U)\cap (V(H){\setminus } S)\), D is a cycle containing v and w in U; and

  • the length of D is minimum.

Let \(P_1\) and \(P_2\) be the two paths from v to w in D.

We claim that there are no edges between the internal vertices of \(P_1\) and the internal vertices of \(P_2\). Suppose there is an edge \(p_1p_2\) for some \(p_1\in V(P_1){\setminus } \{v,w\}\) and \(p_2\in V(P_2){\setminus } \{v,w\}\). One of \(p_1\) and \(p_2\) is contained in \(G_2-S\) or \(H-S\), as U can contain at most one vertex of each component of \(G_2[S]\). Now, if \(p_1\) and \(p_2\) are contained in \(G_2\), then we can replace v with one of \(p_1\) and \(p_2\) that is in \(G_2-S\), and obtain a cycle shorter than D; a contradiction. Similarly, if they are contained in H, then we obtain a cycle shorter than D. This implies that there are no edges between the internal vertices of \(P_1\) and the internal vertices of \(P_2\). Since v is not adjacent to w, D is a chordless cycle, which contradicts the fact that \((G_2,S)\oplus (H,S)\) is chordal. We conclude that every non S-block of \((G_2,S)\oplus (H,S)\) is fully contained in \(G_2\) or H, and therefore \((G_2,S)\oplus (H,S)\) is a d-labeled \({\mathcal {P}}\)-block graph. \(\square \)

This concludes the proof. \(\square \)

5.2 Main Algorithm

Let (GS) be a boundaried graph, and \({\mathcal {C}}\) be the set of components of G[S]. For a partition \({\mathcal {Z}}\) of \({\mathcal {C}}\), we write \({\mathbf {Inc}}({\mathcal {C}}, {\mathcal {Z}})\sim {\mathbf {Aux}}(G,S)\) if

  • two components of G[S] are in the same part of \({\mathcal {Z}}\) if and only if they are contained in the same component of G.

One can observe that there is an isomorphism from \({\mathbf {Inc}}({\mathcal {C}}, {\mathcal {Z}})\) to \({\mathbf {Aux}}(G,S)\) that maps each component of \({\mathcal {C}}\) to the same component.

Proof of Theorem 1

Using Theorem 6 and Lemma 2, we obtain a nice tree decomposition of G of width at most \(5w+4\) in time \({\mathcal {O}}(c^w\cdot n)\) for some constant c. Let \((T, {\mathcal {B}}=\{B_t\}_{t\in V(T)})\) be the resulting nice tree decomposition with root node ro. For each node t of T, let \(G_t\) be the subgraph of G induced by the union of all bags \(B_{t'}\) where \(t'\) is a descendant of t. Recall that \({\mathcal {U}}_d\) is the class of all biconnected d-labeled \({\mathcal {P}}\)-block graphs, where each H in \({\mathcal {U}}_d\) has a labeling \(L_H\). Note that \(|{\mathcal {U}}_d|\leqslant 2^{\left( {\begin{array}{c}d\\ 2\end{array}}\right) }\). We start with enumerating all graphs in \({\mathcal {U}}_d\) and their labelings. It takes time \(2^{{\mathcal {O}}(d^2)}\).

We define the following notation for every pair a node t of T and \(X\subseteq B_t\):

  1. 1.

    Let \({\text {Comp}}(t,X)\) be the set of all components of \(G[B_t{\setminus } X]\).

  2. 2.

    Let \({\text {Part}}(t,X)\) be the set of all partitions of \({\text {Comp}}(t,X)\).

  3. 3.

    Let \({\text {Block}}(t,X)\) be the set of all non-trivial blocks of \(G[B_t{\setminus } X]\).

For each node t of T, \(X\subseteq B_t\), and a function \(L:B_t{\setminus } X\rightarrow [d]\), we define \({\mathcal {F}}(t, X, L)\) as the set of all pairs (gh) consisting of functions \(g:{\text {Block}}(t, X)\rightarrow {\mathcal {U}}_d\) and \(h:{\text {Block}}(t,X)\rightarrow 2^{[d]}\). We say that (gh) is valid if

  • L is a d-labeling of \(G[B_t{\setminus } X]\),

  • for each \(B\in {\text {Block}}(t,X)\), B is partially label-isomorphic to g(B), and

  • for each \(B\in {\text {Block}}(t,X)\), \(L(V(B))\cap h(B)=\emptyset \).

Furthermore, for \(i\in \{0, 1, \ldots , k\}\) and \((g,h)\in {\mathcal {F}}(t, X, L)\), let c[t, (XLi, (gh))] be the family of all partitions \({\mathcal {X}}\) in \({\text {Part}}(t,X)\) satisfying the following property: there exist \(S\subseteq V(G_t){\setminus } B_t\) with \(|S|=i\) and a d-labeling \(L'\) of \(G_t-(X\cup S)\) where

  • \(L =L'|_{B_t{\setminus } X}\),

  • \(G_t-(X\cup S)\) is a \({\mathcal {P}}\)-block graph,

  • (gh) is a characteristic of \((G_t-(X\cup S), B_t{\setminus } X)\), and

  • \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}})\sim {\mathbf {Aux}}(G_t-(X\cup S), B_t{\setminus } X)\).

Such a pair \((S, L')\) will be called a partial solution with respect to

$$\begin{aligned} (t, (X, L, i, (g,h)), {\mathcal {X}}). \end{aligned}$$

It is easy to verify that \(c[t, (X, L, i, (g,h)) ]=\emptyset \) if (gh) is not valid. Let \({\mathcal {M}}_t\) be the set of all possible tuples (XLi, (gh)) at node t.

The main idea of the algorithm is that instead of fully computing c[tM] for \(M=(X,L, i, (g,h))\in {\mathcal {M}}_t\), we recursively enumerate a set r[tM] that represents c[tM]. Formally, for a subset \(r[t,M]\subseteq c[t,M]\), we denote \(r[t,M]\equiv c[t,M]\) if

  • for every \({\mathcal {X}}\in c[t,M]\) and a partial solution \((S, L')\) with respect to \((t, M, {\mathcal {X}})\) and \(S_{out}\subseteq V(G){\setminus } V(G_t)\) where \((G-(S\cup X\cup S_{out}), B_t{\setminus } X)\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh) (considering \(G-(S\cup X\cup S_{out})\) as the sum \((G_t-(S\cup X), B_t{\setminus } X)\oplus (G-(V(G_t){\setminus } B_t)-(X\cup S_{out}), B_t{\setminus } X)\)), there exists \({\mathcal {X}}_1\in r[t,M]\) and a partial solution \((S', L'')\) with respect to \((t, M, {\mathcal {X}}_1)\) such that \((G-(S'\cup X\cup S_{out}), B_t{\setminus } X)\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh).

By the definition of r[tM], the problem is a Yes-instance if and only if there exists \((X, L, i, (g,h))\in {\mathcal {M}}_{ro}\) with \(|X|+i\leqslant k\) such that \(r[ro,(X, L, i, (g,h))]\ne \emptyset \). To decide whether the problem is a Yes-instance, we enumerate r[tM] for all nodes t and all \(M\in {\mathcal {M}}_t\).

Whenever we update r[tM], we confirm that \(|r[t,M]|\leqslant w\cdot 2^{w-1}\). This is a consequence of Proposition 3. We describe how to update families r[tM] depending on the type of node t, and prove the correctness of each procedure. We fix such a tuple. For each leaf node t and all \(0\leqslant i\leqslant k\) and empty functions L, g, h, we assign \(r[t,(\emptyset , L, i, (g, h))]:=\emptyset \). We may assume that t is not a leaf node. Let \(M:=(X,L, i, (g,h))\in {\mathcal {M}}_t\). We may assume (gh) is valid.

(1)tis an introduce node with child\(t'\)and\(B_t{\setminus } B_{t'}=\{v\}\):

If \(v\in X\), then \(G_t-X=G_{t'}-(X{\setminus } \{v\})\) and \(B_t{\setminus } X=B_{t'}{\setminus } (X{\setminus } \{v\})\). So, we can set \(r[t,M]:=r[t', (X{\setminus } \{v\}, L, i, (g, h))]\). We assume \(v\notin X\), and let \(L_{res}:=L|_{B_{t'}{\setminus } X}\).

For a pair \((g,h)\in {\mathcal {F}}(t, X, L)\), a pair \((g', h')\in {\mathcal {F}}(t', X, L_{res})\) is called the restriction of (gh) if

  • for \(B_1\in {\text {Block}}(t', X)\) and \(B_2\in {\text {Block}}(t, X)\) with \(V(B_1)\subseteq V(B_2)\),

    • \(g'(B_1)=g(B_2)\),

    • if \(v\in V(B_2)\), then every vertex in \(g'(B_1)\) with label in \(h'(B_1)\) is not adjacent to the vertex in \(g'(B_1)\) with label L(v),

  • for \(B_1\in {\text {Block}}(t', X)\) and \(B_2\in {\text {Block}}(t, X)\) with \(V(B_1)\subseteq V(B_2)\) and \(v\notin V(B_2)\), \(h'(B_1)=h(B_2)\), and

  • for \(B_2\in {\text {Block}}(t,X)\) containing v,

    $$\begin{aligned} h(B_2)=\bigcup _{B_1\in {\text {Block}}(t', X), V(B_1)\subseteq V(B_2)} h'(B_1). \end{aligned}$$

Claim 11

For every \({\mathcal {X}}\in {\text {Part}}(t,X)\), \({\mathcal {X}}\in c[t,M]\) if and only if there exist a restriction \((g',h')\) of (gh) and \({\mathcal {Y}}\in c[t',(X,L_{res}, i, (g',h'))]\) such that

  • v has neighbors on at most one component in each part of \({\mathcal {Y}}\) (that is, \({\mathbf {Inc}}({\text {Comp}}(t',X), {\mathcal {Y}})\oplus {\mathbf {Aux}}(G[B_t{\setminus } X], B_{t'}{\setminus } X)\) has no cycles), and

  • if v has at least one neighbor in \(G[B_t{\setminus } X]\), then \({\mathcal {X}}\) is the partition obtained from \({\mathcal {Y}}\) by, for parts \(Y_1, \ldots , Y_m\) of \({\mathcal {Y}}\) containing components having a neighbor of v, removing all of \(Y_1, \ldots , Y_m\) and adding a part that consists of all components of \(G[B_t{\setminus } X]\) that are not contained in parts of \({\mathcal {Y}}{\setminus } \{Y_1, \ldots , Y_m\}\); and otherwise, \({\mathcal {X}}={\mathcal {Y}}\cup \{\{v\}\}\).

Proof

Suppose \({\mathcal {X}}\in c[t,M]\) and let \((S,L_t)\) be a partial solution with respect to \((t, M, {\mathcal {X}})\). Observe that

$$\begin{aligned} G_t-(X\cup S)= (G_{t'}-(X\cup S), B_{t'}{\setminus } X)\oplus (G[B_t{\setminus } X], B_{t'}{\setminus } X). \end{aligned}$$

Let \({\mathcal {Y}}\in {\text {Part}}(t',X)\) such that \({\mathbf {Inc}}({\text {Comp}}(t',X), {\mathcal {Y}})\sim {\mathbf {Aux}}(G_{t'}-(X\cup S), B_{t'}{\setminus } X)\).

As \(G_t-(X\cup S)= (G_{t'}-(X\cup S), B_{t'}{\setminus } X)\oplus (G[B_t{\setminus } X], B_{t'}{\setminus } X)\) and \(G_t-(X\cup S)\) is chordal, by Proposition 2,

$$\begin{aligned} {\mathbf {Inc}}({\text {Comp}}(t',X), {\mathcal {Y}})\oplus {\mathbf {Aux}}(G[B_t{\setminus } X], B_{t'}{\setminus } X) \end{aligned}$$

has no cycles. The second condition holds by the definition of \({\mathcal {Y}}\). Since we can naturally obtain a restriction \((g',h')\) of (gh) for \((G_{t'}-(X\cup S), B_{t'}{\setminus } X)\), this concludes the proof of the forward direction.

For the converse, suppose there exist \((g',h')\) and \({\mathcal {Y}}\) satisfying the assumptions. Let \(M_{res}:=(X,L_{res}, i, (g',h'))\), and \((S, L_{t'})\) be a partial solution with respect to \((t', M_{res}, {\mathcal {Y}})\). For convenience, we define that

  • \(H:=G_t-(X\cup S)\),

  • \(H':=G_{t'}-(X\cup S)\),

  • \(L_t:V(H)\rightarrow [d]\) is the function obtained from \(L_{t'}\) by further assigning \(L_t(v):=L(v)\).

We claim that (gh) is a characteristic of \((H, B_t{\setminus } X)\). Before checking the conditions of a characteristic, we show that if two blocks \(D_1, D_2\in {\text {Block}}(t',X)\) are contained in the same \((B_{t'}{\setminus } X)\)-block of H, then \(g'(D_1)=g'(D_2)\).

Let \(D_1, D_2\in {\text {Block}}(t', X)\). If \(D_1\) and \(D_2\) are contained in the same \((B_{t'}{\setminus } X)\)-block of \((H', B_{t'}{\setminus } X)\), then \(g'(D_1)=g'(D_2)\) because \((g',h')\) is a characteristic of \((H', B_{t'}{\setminus } X)\). Also, if \(D_1\) and \(D_2\) are contained in the same \((B_{t'}{\setminus } X)\)-block of \((G_{t}[B_t{\setminus } X], B_{t'}{\setminus } X)\), then \(g'(D_1)=g'(D_2)\) as \((g',h')\) is a restriction of (gh). By the assumption, \({\mathbf {Inc}}({\text {Comp}}(t',X), {\mathcal {Y}})\oplus {\mathbf {Aux}}(G[B_t{\setminus } X], B_{t'}{\setminus } X)\) and equivalently, \({\mathbf {Aux}}(H', B_{t'}{\setminus } X)\oplus {\mathbf {Aux}}(G[B_t{\setminus } X], B_{t'}{\setminus } X)\) have no cycles. Therefore, by Lemma 6, if \(D_1\) and \(D_2\) are contained in the same \((B_{t'}{\setminus } X)\)-block of H, then \(g'(D_1)=g'(D_2)\).

Let \(B\in {\text {Block}}(t,X)\) and F be the \((B_t{\setminus } X)\)-block of H containing B.

  1. 1.

    (Coincidence condition)

    Let \(B'\in {\text {Block}}(H, B_t{\setminus } X)\) such that \(B\ne B'\) and \(B'\) is contained in F. First assume that \(|V(B){\setminus } \{v\}|=1\) or \(|V(B'){\setminus } \{v\}|=1\). In this case, since v has neighbors on at most one component in each part of \({\mathcal {Y}}\), \(B_t{\setminus } \{v\}\) and \(B_{t'}{\setminus } \{v\}\) must be contained in the same component of \(G[B_{t'}{\setminus } X]\); call it C. Then there is a path from \(B_t{\setminus } \{v\}\) to \(B_{t'}{\setminus } \{v\}\) in C, and therefore B and \(B'\) are contained in the same block of \(G[B_t{\setminus } X]\). This contradicts the assumption that B and \(B'\) are distinct blocks in \({\text {Block}}(H, B_t{\setminus } X)\).

    Thus, both B and \(B'\) contain non-trivial blocks U and \(U'\) in \(G[B_{t'}{\setminus } X]\) respectively, where \(g'(U)=g'(U')\). This implies that \(g(B)=g(B')\).

  2. 2.

    (Neighborhood condition)

    We need to show that \(h(B)=\bigcup _{B_1\in {\text {Block}}(t', X), V(B_1)\subseteq V(B)} h'(B_1)\). Note that \((g',h')\) is a restriction of (gh). If B does not contain v, then B is a block of \(G[B_{t'}{\setminus } X]\), and \(h(B)=h'(B)\). We assume that B contains v.

    It is easy to confirm that \(h(B)\supseteq \bigcup _{B_1\in {\text {Block}}(t', X), V(B_1)\subseteq V(B)} h'(B_1)\), since the block of \(H'\) containing \(B_1\in {\text {Block}}(t', X)\) with \(V(B_1)\subseteq V(B)\) has to be contained in F. To see that

    $$\begin{aligned} h(B)\subseteq \bigcup _{B_1\in {\text {Block}}(t', X), V(B_1)\subseteq V(B)} h'(B_1), \end{aligned}$$

    let \(z\in N_F(V(B))\), and choose a neighbor \(z'\) of z in B. Since v is introduced at the current node, \(z'\ne v\). Thus F contains three vertices, and F is 2-connected. Also, if \(V(B)=\{v,z'\}\), then \(z'\) is a cut vertex in F, a contradiction. So B also has at least 3 vertices, and it is 2-connected. In particular, \(B-v\) is connected.

    We take a shortest path P from z to V(B) in \(F-z'\). Let p be the endpoint of P at V(B), and let Q be a path from p to \(z'\) in \(B-v\). Then \(P\cup Q\) and \(z'z\) form a cycle and thus there exists an S-block \(B_1\) of \(H'\) with \(V(B_1)\subseteq V(B)\), where z is in the neighborhood of this block. This implies that \(h(B)\subseteq \bigcup _{B_1\in {\text {Block}}(t', X), V(B_1)\subseteq V(B)} h'(B_1)\).

  3. 3.

    (Label-isomorphism condition)

    We prove that F is partially label-isomorphic to g(B). Let \(F_1:=F\cap H'\), \(F_2:=F\cap G[B_t{\setminus } X]\), and \(U=V(F_1)\cap V(F_2)\). Since

    $$\begin{aligned} {\mathbf {Aux}}(H', B_{t'}{\setminus } X)\oplus {\mathbf {Aux}}(G[B_t{\setminus } X], B_{t'}{\setminus } X) \end{aligned}$$

    has no cycles, by Lemma 7,

    $$\begin{aligned} {\mathbf {Aux}}(F_1,U)\oplus {\mathbf {Aux}}(F_2,U) \end{aligned}$$

    has no cycles. To apply Proposition 1, we verify that \((F_1, U)\) and \((F_2, U)\) are block-wise g(B)-compatible. We observed that if two non-trivial blocks \(D_1\) and \(D_2\) of \(G[B_{t'}{\setminus } X]\) are contained in F, then \(g'(D_1)=g'(D_2)=g(B)\).

    Since \((g',h')\) is a characteristic of \((H', B_{t'}{\setminus } X)\), \((F_1, U)\) is block-wise partially label-isomorphic to g(B). Also, since (gh) is valid, \((F_2, U)\) is block-wise partially label-isomorphic to g(B). As \((g',h')\) is a restriction of (gh), for \(B_1\in {\text {Block}}(t', X)\) and \(B_2\in {\text {Block}}(t, X)\) with \(V(B_1)\subseteq V(B_2)\) and \(v\in V(B_2)\), every vertex in \(g'(B_1)\) with label in \(h'(B_1)\) is not adjacent to the vertex in \(g'(B_1)\) with label L(v). Because of this condition, the second condition of being block-wise g(B)-compatible is also satisfied.

    By Proposition 1, F is partially label-isomorphic to g(B).

  4. 4.

    (Completeness condition)

    This follows from the fact that \((g',h')\) is a restriction of (gh) and it is a characteristic of \((H', B_{t'}{\setminus } X)\).

All together we conclude that (gh) is a characteristic of \((H, B_t{\setminus } X)\) and therefore \({\mathcal {X}}\in c[t,M]\). \(\square \)

When \(v\notin X\), we update r[tM] as follows. Set \({\mathcal {K}}:=\emptyset \) at the beginning. For every \((g',h')\in {\mathcal {F}}(t',X,L_{res})\), we test whether \((g',h')\) is a restriction of (gh). Assume that \((g',h')\) is a restriction of (gh), otherwise, we skip it. Now, for each \({\mathcal {Y}}\in r[t',(X,L_{res}, i, (g',h'))]\), we check the two conditions for \((g',h')\) and \({\mathcal {Y}}\) in Claim 11, and if they are satisfied, then we add the set \({\mathcal {X}}\) described in Claim 11 to \({\mathcal {K}}\); otherwise, we skip it. Since \(|{\mathcal {F}}(t',X,L_{res})|\leqslant 2^{{\mathcal {O}}(wd^2)}\) and \(|r[t',(X,L_{res}, i, (g',h'))]|\leqslant w\cdot 2^{w-1}\), the whole procedure can be done in time \(2^{{\mathcal {O}}(wd^2)}\). After we do this for all possible candidates, we take a representative set of \({\mathcal {K}}\) using Proposition 3, and assign the resulting set to r[tM]. Since \(|{\mathcal {K}}|\leqslant 2^{{\mathcal {O}}(wd^2)}\), we can apply Proposition 3 in time \(2^{{\mathcal {O}}(wd^2)}\). Also, we have \(|r[t,M]|\leqslant w\cdot 2^{w-1}\).

We claim that \(r[t,M]\equiv c[t,M]\). Let \(G_{out}:=G-(V(G_t){\setminus } B_t)\). Let \({\mathcal {X}}\in c[t,M]\) and \((S, L')\) be a partial solution with respect to \((t, M, {\mathcal {X}})\), and suppose there exists \(S_{out}\subseteq V(G){\setminus } V(G_t)\) where

$$\begin{aligned} G-(S\cup X\cup S_{out})=(G_{t}-(X\cup S), B_{t}{\setminus } X)\oplus (G_{out}-(X\cup S_{out}), B_{t}{\setminus } X) \end{aligned}$$

is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). Note that every \((B_{t'}{\setminus } X)\)-block of \(G-(S\cup X\cup S_{out})\) is chordal as such a block is a \((B_t{\setminus } X)\)-block of \(G-(S\cup X\cup S_{out})\). Since \(G-(S\cup X\cup S_{out})\) is chordal, by Proposition 2, \({\mathbf {Aux}}(G_{t'}-(X\cup S), B_{t'}{\setminus } X)\oplus {\mathbf {Aux}}(G_{out}-(X\cup S_{out}), B_{t'}{\setminus } X)\) has no cycles. Recall that \(M_{res}:=(X,L_{res}, i, (g',h'))\). As \(r[t',M_{res}]\equiv c[t', M_{res}]\), there exist \({\mathcal {Y}}\in r[t',M_{res}]\) and a partial solution \((S', L'')\) with respect to \((t', M_{res}, {\mathcal {Y}})\) such that

  • \({\mathbf {Inc}}({\text {Comp}}(t',X), {\mathcal {Y}})\sim {\mathbf {Aux}}(G_{t'}-(X\cup S'), B_{t'}{\setminus } X)\), and

  • \({\mathbf {Aux}}(G_{t'}-(X\cup S'), B_{t'}{\setminus } X)\oplus {\mathbf {Aux}}(G_{out}-(X\cup S_{out}), B_{t'}{\setminus } X)\) has no cycles.

By Theorem 8, \(G-(S'\cup X\cup S_{out})\) is also a d-labeled \({\mathcal {P}}\)-block graph respecting (gh).

By the update procedure, the partition \({\mathcal {X}}_1\) where \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}}_1)\sim {\mathbf {Aux}}(G_{t}-(X\cup S'), B_{t}{\setminus } X)\) is added to the set \({\mathcal {K}}\), and there exist \({\mathcal {X}}_2\in r[t,M]\) and a partial solution \((S'', L''')\) with respect to \((t, M, {\mathcal {X}}_2)\) such that \(G-(S''\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). This shows that \(r[t,M]\equiv c[t,M]\).

(2)tis a forget node with child\(t'\)and\(B_{t'}{\setminus } B_t=\{v\}\):

A pair \((g', h')\in {\mathcal {F}}(t', X, L')\) is called an extension of (gh) if

  • \((g', h')\) is valid and \(L'\) is an extension of L on \(B_{t'}{\setminus } X\),

  • for \(B_1\in {\text {Block}}(t,X)\) and \(B_2\in {\text {Block}}(t',X)\) with \(V(B_1)\subseteq V(B_2)\),

    • \(g'(B_2)=g(B_1)\),

    • if \(v\notin V(B_2)\), then \(h(B_1)=h'(B_2)\),

    • if \(v\in V(B_2)\), then \(h(B_1)\) is the union of \(\{L'(v)\}\) and the set of labels in \(N_{g(B_1)}(A)\) that appear in \(h'(B_2)\) where A is the set of vertices in \(g(B_1)\) with labels in \(L(B_1)\).

Here, it is important to note that for \(B_1\in {\text {Block}}(t,X)\) and \(B_2\in {\text {Block}}(t',X)\) with \(V(B_1)\subseteq V(B_2)\), we can find \(h(B_1)\) by looking at the labeled graph \(g(B_1)=g(B_2)\). We show the following.

Claim 12

For every \({\mathcal {X}}\in {\text {Part}}(t,X)\), \({\mathcal {X}}\in c[t,M]\) if and only if one of the following holds:

  1. (i)

    \({\mathcal {X}}\in c[t',(X\cup \{v\},L, i-1, (g,h))]\), or

  2. (ii)

    there exist an extension \(L_{ext}\) of L on \(B_{t'}{\setminus } X\), an extension \((g',h')\) of (gh) in \({\mathcal {F}}(t',X, L_{ext})\), and \({\mathcal {Y}}\in c[t',(X,L_{ext}, i, (g',h'))]\) such that \({\mathcal {X}}\) is the partition obtained from \({\mathcal {Y}}\) by replacing the component U of \(G[B_{t'}{\setminus } X]\) containing v with the components of \(G[B_t{\setminus } X]\) contained in U.

Proof

We first show the backward direction. If \({\mathcal {X}}\in c[t',(X\cup \{v\},L, i-1, (g,h))]\), then \({\mathcal {X}}\in c[t,M]\), as we can put v into the partial solution. Suppose statement (ii) holds. Then there exists a partial solution \((S, L')\) with respect to \((t, (X,L_{ext}, i, (g',h')), {\mathcal {Y}})\). It is not difficult to verify that (gh) is the characteristic of \((G_t-(X\cup S), B_{t}{\setminus } X)\) and \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}})\sim {\mathbf {Aux}}(G_{t}-(X\cup S), B_{t}{\setminus } X)\). Thus, \({\mathcal {X}}\in c[t,M]\).

For the other direction, suppose \({\mathcal {X}}\in c[t,M]\), and let \((S, L')\) be a partial solution with respect to \((t, M, {\mathcal {X}})\). If \(v\in S\), then \({\mathcal {X}}\in c[t', (X\cup \{v\}, L, i-1, (g,h))]\), and the statement (i) holds. Thus, we may assume that \(v\notin S\).

Let \(L_{ext}:=L'|_{B_{t'}{\setminus } X}\) and \({\mathcal {Y}}\in {\text {Part}}(t',X)\) such that \({\mathbf {Inc}}({\text {Comp}}(t', X), {\mathcal {Y}})\sim {\mathbf {Aux}}(G_t-(X\cup S), B_{t'}{\setminus } X)\). Since \(G_t-(X\cup S)=G_{t'}-(X\cup S)\), one can observe that \({\mathcal {X}}\) is the partition obtained from \({\mathcal {Y}}\) by replacing the component U of \(G[B_t{\setminus } X]\) containing v with the components of \(B_{t'}{\setminus } X\) contained in U. We focus on showing that there exists an extension \((g',h')\) of (gh) in \({\mathcal {F}}(t',X, L_{ext})\) that is the characteristic of \((G_{t'}-(X\cup S), B_{t'}{\setminus } X)\).

We construct \((g', h')\) as follows.

  • Suppose there is a block \(B\in {\text {Block}}(t',X)\) containing v. If there exists \(B'\in {\text {Block}}(t,X)\) where B and \(B'\) are contained in the same block of \(G_t-(X\cup S)\), then we let \(g'(B)=g(B')\). Otherwise, we know that the block of \(G_{t'}-(X\cup S)\) containing v is label-isomorphic to a graph in \({\mathcal {U}}_d\); let \(g'(B)\) be this graph.

  • For \(B\in {\text {Block}}(t',X)\) with \(v\notin V(B)\), let \(g'(B)=g(B)\).

  • Also, for every \(B\in {\text {Block}}(t', X)\), let \(h'(B)\) be the set of labels that appear in the neighbors of vertices of B that are in the block of \(G_{t'}-(S\cup X)\) containing B and are not in \(B_{t'}{\setminus } X\).

Then \((g',h')\) is an extension of (gh), and \({\mathcal {Y}}\in c[t',(X, L_{ext}, i, (g',h'))]\). \(\square \)

We update r[tM] as follows. Set \({\mathcal {K}}:=\emptyset \). First, we add all partitions in \(r[t',(X\cup \{v\},L, i-1, (g,h))]\) to \({\mathcal {K}}\). At the second step, for every extension \(L_{ext}\) of L on \(B_{t'}{\setminus } X\) and every \((g',h')\in {\mathcal {F}}(t',X,L_{ext})\), we test whether \((g',h')\) is an extension of (gh). Note that the condition for h can be checked in time polynomial in d and w. In the case when \((g',h')\) is an extension of (gh) with respect to \(L_{ext}\), for all partitions \({\mathcal {Y}}\in r[t',(X, L_{ext}, i, (g',h'))]\), we add the set \({\mathcal {X}}\) satisfying the second statement in Claim 12 to \({\mathcal {K}}\), and otherwise, we skip this pair. This can be done in time \(2^{{\mathcal {O}}(wd^2)}\). After we do this for all possible candidates, we take a representative set of \({\mathcal {K}}\) using Proposition 3, and assign the resulting set to r[tM]. Notice that \(|{\mathcal {K}}|\leqslant 2^{{\mathcal {O}}(wd^2)}\). By Proposition 3, the procedure of obtaining a representative set can be done in time \(2^{{\mathcal {O}}(wd^2)}\), and we have \(|r[t,M]|\leqslant w\cdot 2^{w-1}\).

We claim that \(r[t,M]\equiv c[t,M]\). Let \({\mathcal {X}}\in c[t,M]\) and \((S, L')\) be a partial solution with respect to \((t, M, {\mathcal {X}})\) and \(S_{out}\subseteq V(G){\setminus } V(G_t)\) where \(G-(S\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). Let \(G_{out}:=G-(V(G_{t'}){\setminus } B_{t'})\). The graph \(G-(S\cup X\cup S_{out})\) can be seen as \((G_{t'}-(X\cup S), B_{t'}{\setminus } X)\oplus (G_{out}-(X\cup S_{out}), B_{t'}{\setminus } X)\).

Note that every \((B_{t'}{\setminus } X)\)-block of \(G-(S\cup X\cup S_{out})\) is chordal. Since \(G-(S\cup X\cup S_{out})\) is chordal, by Proposition 2, \({\mathbf {Aux}}(G_{t'}-(X\cup S), B_{t'}{\setminus } X)\oplus {\mathbf {Aux}}(G_{out}-(X\cup S_{out}), B_{t'}{\setminus } X)\) has no cycles. As \(r[t',(X, L_{ext}, i, (g',h')]\equiv c[t', (X, L_{ext}, i, (g',h')]\), there exists \({\mathcal {Y}}\in r[t', (X, L_{ext}, i, (g',h')]\) and a partial solution \((S', L'')\) with respect to \((t', (X, L_{ext}, i, (g',h'), {\mathcal {Y}})\) such that

$$\begin{aligned} {\mathbf {Inc}}({\text {Comp}}(t',X), {\mathcal {Y}})\sim {\mathbf {Aux}}(G_{t'}-(X\cup S'), B_{t'}{\setminus } X), \end{aligned}$$

and thus \({\mathbf {Aux}}(G_{t'}-(X\cup S'), B_{t'}{\setminus } X)\oplus {\mathbf {Aux}}(G_{out}-(X\cup S_{out}), B_{t'}{\setminus } X)\) has no cycles. By Theorem 8, \(G-(S'\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting \((g',h')\) for some extension \((g',h')\) of (gh). By the procedure, the partition \({\mathcal {X}}_1\) where \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}}_1)\sim {\mathbf {Aux}}(G_{t}-(X\cup S'), B_{t}{\setminus } X)\) is added to the set \({\mathcal {K}}\), and there exists \({\mathcal {X}}_2\in r[t,M]\) and a partial solution \((S'', L''')\) with respect to \((t, M, {\mathcal {X}}_2)\) such that \(G-(S''\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). This shows that \(r[t,M]\equiv c[t,M]\).

(3)tis a join node with two children\(t_1\)and\(t_2\):

We show the following.

Claim 13

For every \({\mathcal {X}}\in {\text {Part}}(t,X)\), \({\mathcal {X}}\in c[t,M]\) if and only if there exist integers \(i_1, i_2\) with \(i_1+i_2=i\), \((g,h_1)\in {\mathcal {F}}(t_1,X,L)\), \((g,h_2)\in {\mathcal {F}}(t_2,X, L)\), \({\mathcal {X}}_1\in c[t_1,(X,L,i_1, (g,h_1))]\), and \({\mathcal {X}}_2\in c[t_2,(X,L,i_2, (g,h_2))]\) such that

  • \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) has no cycles,

  • \({\mathcal {X}}={\mathcal {X}}_1\uplus {\mathcal {X}}_2\), and

  • for each \(B\in {\text {Block}}(t,X)\), \(h_1(B)\cap h_2(B)=\emptyset \) and \(h(B)=h_1(B)\cup h_2(B)\), and for \(\ell _1\in h_1(B)\) and \(\ell _2\in h_2(B)\), the vertices with labels \(\ell _1\) and \(\ell _2\) in g(B) are not adjacent.

Proof

The forward direction is straightforward. For the converse direction, suppose there exist integers \(i_1, i_2\) with \(i_1+i_2=i\), and \((g,h_1)\), \((g,h_2)\), and partitions \({\mathcal {X}}_1, {\mathcal {X}}_2\) as specified in the statement. For each \(j\in \{1,2\}\), let \(M_j:=(X,L,i_j, (g,h_j))\) and \((S_j, L_j)\) be a partial solution with respect to \((t_j,M_j, {\mathcal {X}}_j)\). Furthermore, let \(H_j:=G_{t_j}-(X\cup S_j)\), \(H:=H_1\cup H_2\), and \(L_H:=L_1\oplus L_2\).

We claim that (gh) is a characteristic of \((H, B_t{\setminus } X)\).

  1. 1.

    (Coincidence condition)

    Let \(i\in \{1,2\}\). Since \((g,h_i)\) is a characteristic of \(H_i\), if \(B_1, B_2\in {\text {Block}}(t,X)\) are contained in the same \((B_t{\setminus } X)\)-block of \(H_i\), \(g(B_1)=g(B_2)\). Since \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) and equivalently,

    $$\begin{aligned} {\mathbf {Aux}}(H_1, B_t{\setminus } X)\oplus {\mathbf {Aux}}(H_2, B_t{\setminus } X) \end{aligned}$$

    have no cycles, by Lemma 6, if \(B_1, B_2\in {\text {Block}}(t,X)\) are contained in the same \((B_t{\setminus } X)\)-block of H, then we have \(g(B_1)=g(B_2)\).

  2. 2.

    (Neighborhood condition)

    This follows from the assumption that \(h(B)=h_1(B)\cup h_2(B)\) for each \(B\in {\text {Block}}(t, X)\).

  3. 3.

    (Label-isomorphism condition)

    Let \(B\in {\text {Block}}(t,X)\) and F be the \((B_t{\setminus } X)\)-block of H containing B. We show that F is partially label-isomorphic to g(B). Let \(U:=V(F)\cap (B_t{\setminus } X)\).

    Since \({\mathbf {Aux}}(H_1, B_t{\setminus } X)\oplus {\mathbf {Aux}}(H_2, B_t{\setminus } X)\) has no cycles, by Lemma 7, \({\mathbf {Aux}}(F\cap H_1,U) \oplus {\mathbf {Aux}}(F\cap H_2, U)\) has no cycles. Since each \((g,h_j)\) is a characteristic of \((H_j, B_{t_j}{\setminus } X)\), \((F\cap H_1, U)\) and \((F\cap H_2, U)\) are block-wise partially label-isomorphic to g(B). Moreover, \((F\cap H_1, U)\) and \((F\cap H_2, U)\) are block-wise g(B)-compatible, because of the assumption that for each \(B\in {\text {Block}}(t,X)\), \(h_1(B)\cap h_2(B)=\emptyset \) and \(h(B)=h_1(B)\cup h_2(B)\), and for \(\ell _1\in h_1(B)\) and \(\ell _2\in h_2(B)\), the vertices with labels \(\ell _1\) and \(\ell _2\) in g(B) are not adjacent. By Proposition 1, F is partially label-isomorphic to g(B).

  4. 4.

    (Completeness condition)

    It follows from the fact that each \((g,h_j)\) is a characteristic of \((H_j, B_{t_j}{\setminus } X)\).

This proves that (gh) is a characteristic of \((H, B_t{\setminus } X)\). That is, \((S_1\cup S_2, L_1\oplus L_2)\) is a partial solution with respect to \((t,M,{\mathcal {X}})\), and thus we have \({\mathcal {X}}\in c[t,M]\). \(\square \)

We update r[tM] as follows. Set \({\mathcal {K}}:=\emptyset \). We fix integers \(i_1, i_2\) with \(i_1+i_2=i\), \((g, h_1)\in {\mathcal {F}}(t_1, X, L)\) and \((g,h_2)\in {\mathcal {F}}(t_2, X, L)\). We can check in time \({\mathcal {O}}(wd^2)\) the condition that

  • for each \(B\in {\text {Block}}(t,X)\), \(h_1(B)\cap h_2(B)=\emptyset \) and \(h(B)=h_1(B)\cup h_2(B)\), and for \(\ell _1\in h_1(B)\) and \(\ell _2\in h_2(B)\), the vertices with labels \(\ell _1\) and \(\ell _2\) in g(B) are not adjacent.

If these pairs do not satisfy this condition, then we skip them. We assume that these pairs satisfy this condition. For \({\mathcal {X}}_1\in r[t_1, M_1]\) and \({\mathcal {X}}_2\in r[t_2, M_2]\), we test whether \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}}_1\cup {\mathcal {X}}_2)\) has no cycles and \({\mathcal {X}}={\mathcal {X}}_1\uplus {\mathcal {X}}_2\). We can check this in time \({\mathcal {O}}(w)\). If they satisfy the two conditions, then we add the partition \({\mathcal {X}}\) to the set \({\mathcal {K}}\), and otherwise, we do not add it. After we do this for all possible candidates, we take a representative set of \({\mathcal {K}}\) using Proposition 3, and assign the resulting set to r[tM]. The total running time is \(k\cdot 2^{{\mathcal {O}}(wd^2)}\) because \(|{\mathcal {F}}(t_j, X, L)|\leqslant 2^{{\mathcal {O}}(wd^2)}\) and \(| r[t_j,M_j]|\leqslant w\cdot 2^{w-1}\) for each \(j\in \{1,2\}\). We have \(|r[t,M]|\leqslant w\cdot 2^{w-1}\).

We claim that \(r[t,M]\equiv c[t,M]\). Let \({\mathcal {X}}\in c[t,M]\) and \((S, L')\) be a partial solution with respect to \((t, M, {\mathcal {X}})\) and \(S_{out}\subseteq V(G){\setminus } V(G_t)\) where \(G-(S\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). Let \(H_{out}:=G-(V(G_{t}){\setminus } B_{t})-(X\cup S_{out})\), and for each \(j\in \{1,2\}\), let \(S_j=V(H_j)\cap S\). Note that every \((B_{t}{\setminus } X)\)-block of \(G-(S\cup X\cup S_{out})\) is chordal.

We first consider \(G-(S\cup X\cup S_{out})\) as the sum \((H_1, B_{t}{\setminus } X)\oplus (H_2\cup H_{out}, B_{t}{\setminus } X)\). Since \(G-(S\cup X\cup S_{out})\) is chordal, by Proposition 2,

$$\begin{aligned} {\mathbf {Aux}}(H_1, B_{t}{\setminus } X)\oplus {\mathbf {Aux}}(H_2\cup H_{out}, B_{t}{\setminus } X) \end{aligned}$$

has no cycles. As \(r[t_1,M_1]\equiv c[t_1, M_1]\), there exists \({\mathcal {Y}}_1\in r[t_1,M_1]\) and a partial solution \((S_1', L_1)\) with respect to \((t_1, M_1, {\mathcal {Y}}_1)\) such that \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {Y}}_1)\sim {\mathbf {Aux}}(G_{t}-(X\cup S_1'), B_{t}{\setminus } X)\), and

$$\begin{aligned} {\mathbf {Aux}}(G_{t_1}-(X\cup S_1'), B_{t}{\setminus } X)\oplus {\mathbf {Aux}}(H_2\cup H_{out}, B_{t}{\setminus } X) \end{aligned}$$

has no cycles. By Theorem 8, \(G-(S_1'\cup S_2\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). Let \(H_1':=G_{t_1}-(X\cup S_1')\). In a similar manner, we consider \(G-(S_1'\cup S_2\cup X\cup S_{out})\) as the sum \((H_1'\cup H_{out}, B_{t}{\setminus } X)\oplus (H_2, B_{t}{\setminus } X)\). Since \(G-(S_1'\cup S_2\cup X\cup S_{out})\) is chordal, by Proposition 2, \({\mathbf {Aux}}(H_1'\cup H_{out}, B_{t}{\setminus } X)\oplus {\mathbf {Aux}}(H_2, B_{t}{\setminus } X)\) has no cycles. As \(r[t_2,M_2]\equiv c[t_2, M_2]\), there exist \({\mathcal {Y}}_2\in r[t_2,M_2]\) and a partial solution \((S_2', L_2)\) with respect to \((t_2, M_2, {\mathcal {Y}}_2)\) such that \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {Y}}_2)\sim {\mathbf {Aux}}(G_{t}-(X\cup S_2'), B_{t}{\setminus } X)\), and

$$\begin{aligned} {\mathbf {Aux}}(H_1\cup H_{out}, B_{t}{\setminus } X)\oplus {\mathbf {Aux}}(G_{t_2}-(X\cup S_2'), B_{t}{\setminus } X) \end{aligned}$$

has no cycles. By Theorem 8, \(G-(S_1'\cup S_2'\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). Thus the partition \({\mathcal {X}}_1={\mathcal {Y}}_1\uplus {\mathcal {Y}}_2\) which satisfies \({\mathbf {Inc}}({\text {Comp}}(t,X), {\mathcal {X}}_1)\sim {\mathbf {Aux}}(G_{t}-(X\cup S_1'\cup S_2'), B_{t}{\setminus } X)\) is added to the set \({\mathcal {K}}\). And there exists \({\mathcal {X}}_2\in r[t,M]\) and a partial solution \((S'', L''')\) with respect to \((t, M, {\mathcal {X}}_2)\) such that \(G-(S''\cup X\cup S_{out})\) is a d-labeled \({\mathcal {P}}\)-block graph respecting (gh). This shows that \(r[t,M]\equiv c[t,M]\).

Total running time. We denote \(|V(G)|\) by n. Note that the number of nodes in T is \({\mathcal {O}}(wn)\) by Lemma 2. For fixed \(t\in V(T)\), there are at most \(2^{w+1}\) possible choices for \(X\subseteq B_t\), and for fixed \(X\subseteq B_t\), there are at most \(d^{w+1}\) possible functions L. Furthermore, the size of \({\mathcal {F}}(t,X,L)\) is bounded by \(2^{{\mathcal {O}}(wd^2)}\). Thus, there are \({\mathcal {O}}(n\cdot k\cdot \max (2,d)^{w+1}\cdot 2^{{\mathcal {O}}(wd^2)})\) tables.

In summary, the algorithm runs in time \({\mathcal {O}}(n\cdot k\cdot \max (2,d)^{w+1})\cdot 2^{{\mathcal {O}}(wd^2)}\cdot k=2^{{\mathcal {O}}(wd^2)}k^2n\). \(\square \)

We finish this section with a remark regarding Bounded\({\mathcal {P}}\)-Component Vertex Deletion. For this problem, we think of graphs as labeled graphs where each component consists of vertices with distinct labels from 1 to d. Let \({\text {Comp}}(G,S)\) be the set of components of G[S]. For such a graph (GS), we define a ‘characteristic’ as a pair (gh) of functions \(g:{\text {Comp}}(G,S) \rightarrow {\mathcal {U}}_d\) and \(h:{\text {Comp}}(G,S) \rightarrow 2^{[d]}\) satisfying the following, for \(C\in {\text {Comp}}(G,S)\) and the component H of G containing C,

  1. (a)

    (label-isomorphism condition) H is partially label-isomorphic to g(C),

  2. (b)

    (coincidence condition) for every \(C'\in {\text {Comp}}(G,S)\) where \(C'\) is contained in H, \(g(C')=g(C)\),

  3. (c)

    (neighborhood condition) \(h(C)=L(N_{H}(V(C)))\), and

  4. (d)

    (completeness condition) for every \(w\in V(H){\setminus } S\), the graph \(H[N_H[w]]\) is label-isomorphic to \(g(C)[N_{g(C)}[z]]\) where z is the vertex in g(C) with label L(w).

By following similar, but simpler, arguments, one can prove that Bounded\({\mathcal {P}}\)-Component Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(wd^2)}k^2n\). We omit the details.

Theorem 3

Let \({\mathcal {P}}\) be a class of graphs that is hereditary, recognizable in polynomial time, and consists of only chordal graphs. Then Bounded\({\mathcal {P}}\)-Component Vertex Deletion can be solved in time \(2^{{\mathcal {O}}(wd^2)}k^2 n\) on graphs with n vertices and treewidth w.

6 Lower Bound for Fixed d

We showed that Bounded\({\mathcal {P}}\)-Component Vertex Deletion and Bounded\({\mathcal {P}}\)-Block Vertex Deletion admit single-exponential time algorithms parameterized by treewidth, when \({\mathcal {P}}\) is a class of chordal graphs. We now establish that, assuming the ETH, this is no longer the case when \({\mathcal {P}}\) contains a graph that is not chordal.

In the \(k \times k\)Independent Set problem, one is given a graph \(G=([k] \times [k],E)\) over the \(k^2\) vertices of a k-by-k grid. We denote by \(\langle i,j \rangle \) with \(i,j \in [k]\) the vertex of G in the i-th row and j-th column. The goal is to find an independent set of size k in G that contains exactly one vertex in each row. The Permutation\(k \times k\)Independent Set problem is similar but with the additional constraint that the independent set should also contain exactly one vertex per column.

The following is the restatement and combination of Theorems 2 and 4.

Theorem 9

  1. (1)

    Let \({\mathcal {P}}\) be a block-hereditary and polynomial-time recognizable class of graphs. If \({\mathcal {P}}\) contains the cycle graph on \(\ell \geqslant 4\) vertices, then Bounded\({\mathcal {P}}\)-Block Vertex Deletion is not solvable in time \(2^{o(w\log w)}n^{{\mathcal {O}}(1)}\) on graphs with n vertices and treewidth at most w even for fixed \(d=\ell \), unless the ETH fails.

  2. (2)

    Let \({\mathcal {P}}\) be a hereditary and polynomial-time recognizable class of graphs. If \({\mathcal {P}}\) contains the cycle graph on \(\ell \geqslant 4\) vertices, then Bounded\({\mathcal {P}}\)-Component Vertex Deletion is not solvable in time \(2^{o(w\log w)}n^{{\mathcal {O}}(1)}\) on graphs with n vertices and treewidth at most w even for fixed \(d=\ell \), unless the ETH fails.

Proof

We reduce from Permutation\(k \times k\)Independent Set which, like Permutation\(k \times k\)Clique, cannot be solved in time \(2^{o(k \log k)}k^{{\mathcal {O}}(1)}\) unless the ETH fails [16]. Let \(G=([k] \times [k],E)\) be an instance of Permutation\(k \times k\)Independent Set. We assume that \(\forall h,i,j \in [k]\) with \(h \ne i\), \(\langle i,j \rangle \langle h,j \rangle \in E\). Adding these edges does not change the Yes- and No-instances, but has the virtue of making Permutation\(k \times k\)Independent Set equivalent to \(k \times k\)Independent Set. We also assume that \(\forall h,i,j \in [k]\), \(\langle i,j \rangle \langle i,h \rangle \in E\), since at most one of \(\langle i,j \rangle \) and \(\langle i,h \rangle \) can be in a given solution. Let \(m := |E| = {\mathcal {O}}(k^4)\) be the number of edges of G.

Outline. We build two almost identical graphs \(G'=(V',E')\) and \(G''=(V',E'')\) with treewidth at most \((3d+4)k+6d-5={\mathcal {O}}(k)\), and \(((3d-2)k^2+2k)m\) vertices, such that the following three conditions are equivalent:

  1. 1.

    G has an independent set of size k with one vertex per row of G.

  2. 2.

    There is a set \(S \subseteq V'\) of size at most \((3d-2)k(k-1)m\) such that each component of \(G'-S\) has size at most d and belongs to \({\mathcal {P}}\).

  3. 3.

    There is a set \(S \subseteq V'\) of size at most \((3d-2)k(k-1)m\) such that each block of \(G''-S\) has size at most d and belongs to \({\mathcal {P}}\).

The overall construction of \(G'\) and \(G''\) will display m almost identical copies of the encoding of an edgelessG arranged in a cycle. Each copy embeds one distinct edge of G. The point of having the information of G distilled edge by edge in \(G'\) and \(G''\) is to control the treewidth. This general idea originates from a paper of Lokshtanov et al. [15].

Fig. 6
figure 6

A high-level schematic of \(G'\) and \(G''\). The \(H^{e_i}\)s only differ by a constant number of edges (in red/light gray) that encode their edge \(e_i\) of G (Color figure online)

Construction. We first describe \(G'\). As a slight abuse of notation, a gadget (and, more generally, a subpart of the construction) may refer to either a subset of vertices or to an induced subgraph. For each \(e=\langle i^e,j^e \rangle \langle i'^e,j'^e \rangle \in E\), we detail the internal construction of \(H^e\) and \(X^e\) of Fig. 6 and how they are linked to one another. Each vertex \(v=\langle i,j \rangle \) of G is represented by a gadget \(H^e(v)\) on \(3d-2\) vertices in \(G'\): a path on \(d-3\) vertices whose endpoints are \(v^e_{-a}\) and \(v^e_{-b}\), an isolated vertex \(v^e_+\), and two disjoint cycles of length d. Observe that if \(d=4\), then \(v^e_{-a}\) and \(v^e_{-b}\) is the same vertex. We add all the edges between \(H^e(\langle i,j \rangle )\) and \(H^e(\langle i,j' \rangle )\) for \(i,j,j' \in [k]\) with \(j \ne j'\). We also add all the edges between \(H^e(\langle i^e,j^e \rangle )\) and \(H^e(\langle i'^e,j'^e \rangle )\). We call \(H^e\) the graph induced by the union of every \(H^e(v)\), for \(v \in V(G)\). The row/column selector gadget \(X^e\) consists of a set \(X^e_r\) of k vertices with one vertex \(r^e_i\) for each row index \(i \in [k]\), and a set \(X^e_c\) of k vertices with one vertex \(c^e_j\) for each column index \(j \in [k]\). The gadget \(X^e\) forms an independent set of size 2k. We arbitrarily number the edges of G: \(e_1, e_2, \ldots , e_m\). For each \(h \in [m]\) and \(v=\langle i,j \rangle \in V\), we link \(v^{e_h}_{-a}\) to \(r^{e_h}_i\) (the row index of v) and \(v^{e_h}_{-b}\) to \(c^{e_h}_j\) (the column index of v). We also link, for every \(h \in [m-1]\), \(v^{e_h}_+\) to \(r^{e_{h+1}}_i\) and to \(c^{e_{h+1}}_j\), and \(v^{e_m}_+\) to \(r^{e_1}_i\) and to \(c^{e_1}_j\). That concludes the construction (see Fig. 7). To obtain \(G''\) from \(G'\), we add the edges \(c^{e_h}_jc^{e_h}_{j+1}\) for every \(h \in [m]\) and \(j \in [k-1]\). We ask for a deletion set S of size \(s := (3d-2)k(k-1)m\).

Fig. 7
figure 7

The overall picture of \(G'\) and \(G''\) with \(k=3\). Dotted edges are subdivided \(d-4\) times. In particular, if \(d=4\), they are simply edges. Dashed edges are subdivided \(d-5\) times. In particular, if \(d=4\), the two endpoints are in fact a single vertex. Edges between two boxes link each vertex of one box to each vertex of the other box. The gray edges in the column selectors \(X^{e_h}_c\) are only present in \(G''\)

Treewidth of\(G'\)and\(G''\). We claim that the pathwidth, and hence treewidth, of \(G'\) and \(G''\) are bounded by \((3d+4)k+6d-5\). For any edge \(e=\langle i^e,j^e \rangle \langle i'^e,j'^e \rangle \in E\), we set \(H(e) := H^e(\langle i^e,j^e \rangle ) \cup H^e(\langle i'^e,j'^e \rangle )\). For any \(h \in [m-1]\), we set \({\tilde{X}}_h := X^{e_1} \cup X^{e_h} \cup X^{e_{h+1}}\), and \({\tilde{X}}_m := X^{e_1} \cup X^{e_m}\). For each \(e \in E\), and \(i \in [k]\), \(H^e(i)\) denotes the union of the \(H^e(v)\) for all vertices v of the i-th row. Here is a path decomposition of \(G'\) and \(G''\) where the bags contain no more than \((3d+4)k+6d-4\) vertices:

$$\begin{aligned} \begin{array}{c} {\tilde{X}}_1 \cup H(e_1) \cup H^{e_1}(1) \rightarrow {\tilde{X}}_1 \cup H(e_1) \cup H^{e_1}(2) \rightarrow \cdots \rightarrow {\tilde{X}}_1 \cup H(e_1) \cup H^{e_1}(k) \rightarrow \\ {\tilde{X}}_2 \cup H(e_2) \cup H^{e_2}(1) \rightarrow {\tilde{X}}_2 \cup H(e_2) \cup H^{e_2}(2) \rightarrow \cdots \rightarrow {\tilde{X}}_2 \cup H(e_2) \cup H^{e_2}(k) \rightarrow \\ \vdots \\ {\tilde{X}}_m \cup H(e_m) \cup H^{e_m}(1) \rightarrow {\tilde{X}}_m \cup H(e_m) \cup H^{e_m}(2) \rightarrow \cdots \rightarrow \\ {\tilde{X}}_m \cup H(e_m) \cup H^{e_m}(k). \end{array} \end{aligned}$$

As, for any \(h \in [m]\), \(|{\tilde{X}}_h| \leqslant 6k\), \(|H(e_h)|=2(3d-2)\), and \(|H^{e_h}(i)|\leqslant (3d-2)k\) for any \(i \in [k]\), the size of a bag is bounded by \(\max _{h \in [m],i \in [k]}|{\tilde{X}}_h \cup H(e_h) \cup H^{e_h}(i)| \leqslant 6k+2(3d-2)+(3d-2)k=(3d+4)k+6d-4\).

Correctness. We first show 1 \(\Rightarrow \) 2. Let us assume that there is an independent set \(I := \{v_1=\langle 1,j_1 \rangle ,v_2=\langle 2,j_2 \rangle ,\ldots ,v_k=\langle k,j_k \rangle \}\) in G. We define the deletion set \(S \subseteq V'\) as follows. For each \(e \in E\) and \(i \in [k]\), we delete all of \(H^e(i)\) except \(H^e(v_i)\). The cardinality of S adds up to a total of \((|H^e(i)|-|H^e(v_i)|)mk=((3d-2)k-3d+2)mk=(3d-2)k(k-1)m=s\) vertices. We claim that all the components of \(G'-S\) are isomorphic to \(C_d\), and belong to \({\mathcal {P}}\) since \(d \geqslant 4\). First, we observe that the \(C_d\)s inside any \(H^e(v_i)\), for \(e \in E\) and \(i \in [k]\), are isolated in \(G'-S\). Indeed, \(H^e(v_i)\) is the only remaining \(H^e(v)\) from \(H^e(i)\). So, it might only be linked to \(H^e(v_j)\) with some \(j \ne i \in [k]\). But this would imply that \(v_iv_j \in E\), contradicting that I is an independent set. Besides those \(C_d\)s contained in the \(H^e(v_i)\)s, we claim that the rest of \(G'-S\) is mk disjoint \(C_d\)s formed with the vertices \({v_p}_+^{e_{h-1}}\), \(r^{e_h}_p\), \(c^{e_h}_{j_p}\), and the path \(P_{v_p}^{e_h}\) between \({v_p}_{-a}^{e_h}\) and \({v_p}_{-b}^{e_h}\), for any \(h \in [m]\) and \(p \in [k]\) (with the convention that \(e_0=e_m\)). Indeed, let us recall that \(\{j_1,j_2,\ldots ,j_k\}=[k]\). Therefore, \(\{{v_p}_+^{e_{h-1}}, r^{e_h}_p, c^{e_h}_{j_p}\} \cup P_{v_p}^{e_h}\) is a family of mk pairwise disjoint sets of size d. The vertices \(r^{e_h}_p\) and \(c^{e_h}_{j_p}\) have degree 2 in \(G'-S\) since I contains only one vertex in the p-th row of G, and I contains only one vertex in the \(j_p\)-th column; and in both cases this vertex is \(v_p\). The vertex \({v_p}_+^{e_{h-1}}\) and the vertices of \(P_{v_p}^{e_h}\) also have degree 2 in \(G'-S\). Therefore, \(G'-S\) is a disjoint union of \(C_d\)s. The implication 1 \(\Rightarrow \) 3 is derived similarly. We now claim that, with the same deletion set S, all the blocks of \(G''-S\) are isomorphic to \(C_d\) or \(K_2\). As \({\mathcal {P}}\) is a hereditary class that contains the induced cycle of length \(d \geqslant 4\), it holds that \(K_2 \in {\mathcal {P}}\). We still have the property that the \(C_d\)s within any \(H^e(v_i)\) are isolated in \(G''-S\). Now, the slight difference is that \(\{{v_p}_+^{e_{h-1}}, r^{e_h}_p, c^{e_h}_{j_p}\} \cup P_{v_p}^{e_h}\) induces m disjoint \({\mathcal {C}}_{k,d}\)s in \(G''-S\), where \({\mathcal {C}}_{k,d}\) is the graph obtained by linking each of the k vertices of a path to the two endpoints of a path on \(d-1\) vertices. Informally, \({\mathcal {C}}_{k,d}\) corresponds to k\(C_d\)s attached to different vertices of a path on k vertices. In this case, the path consists of the vertices \(c^{e_h}_1, c^{e_h}_2, \ldots , c^{e_h}_k\). Finally, we observe that the blocks of \(\mathcal C_{k,d}\) are k\(C_d\)s and \(k-1\)\(K_2\)s.

We now show that 2 \(\Rightarrow \) 1 and 3 \(\Rightarrow \) 1. We assume that there is a set \(S \subseteq V'\) of size at most s such that all the blocks of \(G''-S\) (resp. \(G'-S\)) have size at most d. We note that this is implied by 3 (resp. by a weaker assumption than 2). The first property we show on S is that, for any \(e \in E\) and \(i \in [k]\), \(|H^e(i) \cap S| \geqslant (3d-2)(k-1)\). In other words, there are at most \(3d-2\) vertices of \(H^e(i)\) remaining in \(G''-S\) (or \(G'-S\)). Assume, for the sake of contradiction, that \(H^e(i)-S\) contains at least \(3d-1\) vertices. Observe that \(H^e(i)-S\) cannot contain at least one vertex from three distinct \(H^e(u)\), \(H^e(v)\), and \(H^e(w)\) (with u, v and w in the i-th row of G), since then \(H^e(i)-S\) would be 2-connected (and of size \(>d\)). For the same reason, \(H^e(i)-S\) cannot contain at least two vertices in \(H^e(u)\) and at least two vertices in another \(H^e(v)\). Therefore, the only way of fitting \(3d-1\) vertices in \(H^e(i)-S\) is the \(3d-2\) vertices of an \(H^e(u)\) plus one vertex from some other \(H^e(v)\). But then, this vertex of \(H^e(v)\) would form, together with one \(C_d\) of \(H^e(u)\), a 2-connected subgraph of \(G''-S\) (or \(G'-S\)) of size \(d+1\). Now, we know that \(|H^e(i) \cap S| \geqslant (3d-2)(k-1)\). As there are precisely mk sets \(H^e(i)\) in \(G'\) (and they are disjoint), it further holds that \(|H^e(i) \cap S| = (3d-2)(k-1)\), since otherwise S would contain strictly more than \(s=(3d-2)k(k-1)m\) vertices. Thus, \(H^e(i)-S\) contains exactly \(3d-2\) vertices. By the previous remarks, \(H^e(i)-S\) can only consist of the \(3d-2\) vertices of the same \(H^e(u)\) or \(3d-3\) vertices of \(H^e(u)\) plus one vertex from another \(H^e(v)\). In fact, the latter case is not possible, since the vertex of \(H^e(v)\) would form, with at least one remaining \(C_d\) of the \(3d-3\) vertices of \(H^e(u)\), a 2-connected subgraph of \(G''-S\) (or \(G'-S\)) of size \(d+1\). Note that this is why we needed two disjoint \(C_d\)s in the construction instead of just one. So far, we have proved that, assuming 2 or 3, for any \(e \in E\) and \(i \in [k]\), \(H^e(i) \cap S=H^e(z)\) for some vertex z of the i-th row of G, and for any \(e \in E\), \(X^e \cap S=\emptyset \). Let v(ie) be the vertex of the i-th row of G such that \(H^e(v(i,e))=H^e(i) \cap S\).

The second part of the proof consists of showing that v(ie) does not depend on e. Formally, we want to show that there is a \(v_i\) such that, for any \(e \in E\), \(v(i,e)=v_i\). Observe that it is enough to derive that, for any \(h \in [m]\), \(v(i,e_h)=v(i,e_{h+1})\) (with \(e_{m+1}=e_1\)). Let \(j \in [k]\) (resp. \(j' \in [k]\)) be the column of \(v(i,e_h)\) (resp. \(v(i,e_{h+1})\)) in G. We first assume 2. For any \(h \in [m]\), \({v(i,e_h)}_+^{e_h}\), \(r^{e_{h+1}}_i\), \(c^{e_{h+1}}_{j'}\), \(c^{e_{h+1}}_j\) plus the path \(P_{v(i,{e_{h+1}})}^{e_{h+1}}\) (between \({v(i,{e_{h+1}})}_{-a}^{e_{h+1}}\) and \({v(i,{e_{h+1}})}_{-b}^{e_{h+1}}\)) induces a path (in particular, a connected subgraph) of size \(d+1\) in \(G''-S\), unless \(j=j'\) (with \(e_{m+1}=e_1\)). Therefore, \(j=j'\). As \(v(i,e_h)\) and \(v(i,e_{h+1})\) have the same column j and the same row i in G, \(v(i,e_h)=v(i,e_{h+1})\).

Now, we assume 3. For any \(h \in [m]\),

$$\begin{aligned} {v(i,e_h)}_+^{e_h}, r^{e_{h+1}}_i, {v(i,e_{h+1})}_{-a}^{e_{h+1}}, {v(i,e_{h+1})}_{-b}^{e_{h+1}}, c^{e_{h+1}}_{j'}, c^{e_{h+1}}_{j'+1}, \ldots , c^{e_{h+1}}_{j-1}, c^{e_{h+1}}_j \end{aligned}$$

if \(j \geqslant j'\) (resp. \(c^{e_{h+1}}_{j'-1}, \ldots \), \( c^{e_{h+1}}_{j+1}, c^{e_{h+1}}_j\) if \(j \leqslant j'\)) plus the path from \({v(i,e_{h+1})}_{-a}^{e_{h+1}}\) to \({v(i,e_{h+1})}_{-b}^{e_{h+1}}\) induces a cycle (that is, a 2-connected subgraph) of length at least \(d+1\) in \(G''-S\), unless \(j=j'\) (with \(e_{m+1}=e_1\)). Again, \(j=j'\); and the vertices \(v(i,e_h)\) and \(v(i,e_{h+1})\) have the same column and the same row in G, which implies that \(v(i,e_h)=v(i,e_{h+1})\). In both cases (2 or 3), we can now safely define \(v_i := v(i,e)\).

We finally claim that \(\{v_1,v_2,\ldots ,v_k\}\) is an independent set in G (and for each \(i \in [k]\), \(v_i\) is in the i-th row). Indeed, if there were an edge \(e=v_iv_j \in E\) for some \(i \ne j \in [k]\), then \(H^e(v_i) \cup H^e(v_j)\) would induce a 2-connected subgraph of size \(2(3d-2)>d\) (since \(d \geqslant 4\)) in \(G''-S\) (or \(G'-S\)).

That finishes the proof that 1 \(\Leftrightarrow \) 2 \(\Leftrightarrow \) 3. Therefore, for any fixed integer \(d \geqslant 4\), an algorithm running in time \(2^{o(w \log w)}|V'|^{{\mathcal {O}}(1)}\) for either Bounded\({\mathcal {P}}\)-Component Vertex Deletion or Bounded\({\mathcal {P}}\)-Block Vertex Deletion on graphs of treewidth w with \(C_d \in {\mathcal {P}}\) would also solve Permutation\(k \times k\)Independent Set in time

$$\begin{aligned} 2^{o(((3d+4)k+6d-5) \log ((3d+4)k+6d-5))}(((3d-2)k^2+2k)m)^{{\mathcal {O}}(1)}=2^{o(k \log k)}k^{{\mathcal {O}}(1)}, \end{aligned}$$

which contradicts the ETH. \(\square \)

7 Hardness and Lower Bounds, When d is not Fixed

In this section, we prove Theorem 5. Our first reduction is from the following problem:

figure d

We call a set \(V_i\), for some \(i \in [k]\), a color class. The problem Multicolored Clique is known to be W[1]-complete (see, for example, [8]), and it is clear that this remains true under the assumption that there are no edges between vertices of the same color class. Moreover, we may assume that each color class has the same size, and between every distinct pair of color classes we have the same number of edges [12]. We say that \(X \subseteq V(G)\) is a multicolored k-clique if X is a k-clique such that \(|X \cap V_i| = 1\) for each \(i \in [k]\).

Theorem 10

Bounded\({\mathcal {P}}\)-Component Vertex Deletion is W[1]-hard parameterized by the combined parameter (wk), when \({\mathcal {P}}\) contains all chordal graphs.

Before proving this theorem, we describe the reduction used in the proof. Given an instance \((G,k,(V_1,\ldots ,V_k))\) of Multicolored Clique, where each color class has size t, we construct a graph \(G'\) such that G has a multicolored k-clique if and only if there exists a set \(S \subseteq V(G')\) of size at most \(k'\) such that each component of \(G'-S\) consists of at most d vertices, where \(k' = 3 \left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -6\) and \(d = 3t^2+3t+3\), and the treewidth of \(G'\) is bounded above by \(54k-69\). Each component of \(G'-S\) is a chordal graph, so we obtain a reduction to Bounded\({\mathcal {P}}\)-Component Vertex Deletion whenever \({\mathcal {P}}\) contains all chordal graphs. We may assume that \(k \geqslant 2\).

Let \(V_i = \{v_i^1, v_i^2, \ldots , v_i^t\}\), for each \(i \in [k]\). For \(i,j \in [k]\) with \(i < j\), we denote the set of edges in \(G[V_i \cup V_j]\) by \(E_{i,j}\), and we may assume that \(|E_{i,j}| = p\), say. We construct \(G'\) from several gadgets; namely, an “edge-encoding gadget” \(G_{i,j}\) for each \(i,j \in [k]\) with \(i<j\), which represents the set \(E_{i,j}\), linked together by copies of one of the “propagator gadgets”, \(H_i\) or \(\tilde{H_i}\), which collectively represent the color class \(V_i\) for some \(i \in [k]\). We also have a gadget \(G_{i,i}\), for each \(i \in [2,k-2]\), which ensures that the vertex selection in the \(H_i\) gadgets also propagates to the \(\tilde{H_i}\) gadgets.

Each gadget encodes a sequence of \(z+1\) integers \(X=\left<x_0,x_1,\ldots ,x_{z}\right>\), where \(x_0 \geqslant 3\), and \(x_s-x_{s-1} \geqslant 3\) for each \(s \in [z]\). We denote such a gadget G(X) and call it a gadget of\(G'\)of order z. It is constructed as follows. First, set

$$\begin{aligned} (d_0,d_1,d_2,\ldots ,d_z) := (x_0, x_1-x_0, x_2-x_1, \ldots , x_z-x_{z-1}). \end{aligned}$$

Note that \(d_q \geqslant 3\) for every \(q \in [0,z]\). For each \(q \in [0,z]\), we now define a graph \(P_q\) which resembles a “thickened path”. For \(q \in [1,z-1]\), let \(P_q\) be the graph on the vertex set \(\{w_{q,1},w_{q,2},\ldots ,w_{q,d_q-1}\}\) with edges between distinct \(w_{q,d}\) and \(w_{q,d'}\) if and only if \(|d-d'| \in [2]\). For \(q \in \{0,z\}\), let \(P_q\) be the graph on the vertex set \(\{w_{q,1},w_{q,2},\ldots ,w_{q,d_q}\}\) with edges between distinct \(w_{q,d}\) and \(w_{q,d'}\) if and only if \(|d-d'| \in [3]\). For each \(q \in [z]\), we add a vertex \(u_q\) adjacent to \(w_{q-1,1}\), \(w_{q-1,2}\), \(w_{q,1}\), and \(w_{q,2}\). The resulting graph G(X) consists of \(d_0 + \big (\sum _{q \in [z-1]} (d_q - 1)\big ) + d_z + z = \big (\sum _{q \in [0,z]} d_q\big )+1 = x_{z}+1\) vertices, and, for \(q \in [z]\), the graph obtained by deleting \(u_q\) has two components: one of size \(x_q\), and the other of size \(x_{z}- x_q\). Let \(B := \{w_{0,1}, w_{0,2}, w_{0,3}\}\) and \(D := \{w_{z,1}, w_{z,2}, w_{z,3}\}\). Since we will use several copies of this gadget, we usually refer to \(P_q\) as \(P_q(G(X))\), a vertex \(v \in V(G(X))\) as v(G(X)), and B or D as B(G(X)) or D(G(X)) respectively; but we sometimes omit the “(G(X))” when there is no ambiguity.

Fig. 8
figure 8

The different uses of the gadgets: the edge encoding gadget and the two kinds of propagator gadgets

We now describe the edge encoding gadget\(G_{i,j}\), for some \(i,j \in [k]\) with \(i < j\); an example is given in Fig. 8a. We can uniquely describe an edge between a vertex in \(V_i\) and a vertex in \(V_j\) by an ordered pair (ab), representing the edge \(v_i^av_j^b\), where \(a, b \in [t]\). We define an injective function \(\phi \) from such a pair to an integer in \(\{3,6,\ldots ,3t^2\}\), as given by \((a,b) \mapsto 3t(a-1) + 3b\). Thus, the set \(\{\phi (a,b) : v_i^av_j^b \in E_{i,j}\}\) uniquely describes the set \(E_{i,j}\). Let \((f_{i,j}^0,f_{i,j}^1,\ldots ,f_{i,j}^{p-1})\) be the sequence obtained after ordering the elements of this set in increasing order, and let \(f_{i,j}^{p} = 3t^2+3\). Note that \(f_{i,j}^0 \geqslant 3\), and \(f_{i,j}^q-f_{i,j}^{q-1} \geqslant 3\) for each \(q \in [p]\). Finally, we set \(G_{i,j} := G\left( \left<f_{i,j}^0,f_{i,j}^1,\ldots ,f_{i,j}^{p}\right>\right) \).

We define the propagator gadgets as \(H_i := G(\left<3,6,\ldots ,3(t+1)\right>)\) and \(\tilde{H_i} := G(\left<3t,6t,\ldots ,3(t+1)t\right>)\); see Fig. 8b and c. Note that these gadgets have size \(3(t+1)+1\) and \(3t(t+1)+1\), respectively. For each color class \(V_i\), where \(i \in [2,k-1]\), we will take i copies of the gadget \(H_i\), and \(k-i+1\) copies of \(\tilde{H_i}\); whereas for \(i=1\) (or \(i=k\)), we take \(k-1\) copies of \(\tilde{H_i}\) (or \(H_i\), respectively) only. Let \({\mathcal {H}}_i\) denote the set containing the copies of \(H_i\), and let \(\tilde{{\mathcal {H}}_i}\) denote the copies of \(\tilde{H_i}\). Note that \(|{\mathcal {H}}_i \cup \tilde{{\mathcal {H}}}_i| = k+1\) when \(i \in [2,k-1]\), and \(|{\mathcal {H}}_i \cup \tilde{{\mathcal {H}}}_i| = k-1\) when \(i \in \{1,k\}\).

Finally, for each \(i \in [2,k-2]\), we have a special gadget \(G_{i,i} := G\left( \left<\phi (1,1),\phi (2,2),\ldots ,\phi (t,t)\right>\right) \). Intuitively, this gadget is used to ensure the vertex selected in each \(H_i \in {\mathcal {H}}_i\) is the same as in each \(\tilde{H_i} \in \tilde{{\mathcal {H}}_i}\). However, we also consider \(G_{i,i}\) an edge encoding gadget, since it is treated as one in the construction.

Fig. 9
figure 9

The overall picture with \(k=4\)

In order to describe how these gadgets are joined together in \(G'\), as shown in Fig. 9, we require some terminology. Given some \(G_{i,j}\) and \(G_{i,j'}\) with \(i,j,j' \in [k]\), we say we connect\(G_{i,j}\)to\(G_{i,j'}\)using\(\tilde{H_i}\) to describe adding all nine edges between \(D(G_{i,j})\) and \(B(\tilde{H_i})\), and all nine edges between \(D(\tilde{H_i})\) and \(B(G_{i,j'})\). In this case, we also say \(\tilde{H_i}\)connects from\(G_{i,j}\) and connects to\(G_{i,j'}\). Given some \(G_{i,j}\) and \(G_{i',j}\) with \(i,i',j \in [k]\), the operation of connecting\(G_{i,j}\)to\(G_{i',j}\)using\(H_j\) is defined analogously. We give the following cyclic ordering to the edge encoding gadgets:

$$\begin{aligned} (G_{1,2},G_{1,3},\ldots ,G_{1,k},G_{2,2},G_{2,3}, \ldots ,G_{2,k},\ldots ,G_{k-1,k-1},G_{k-1,k}). \end{aligned}$$

For each \(G_{i,j}\), we connect this gadget to the next gadget \(G_{i,j'}\) in the cyclic ordering that matches on the first index using one of the copies of \(\tilde{H_i}\), and also connect it to the next gadget \(G_{i',j}\) in the ordering that matches on the second index using one of the copies of \(H_j\). For example, we connect \(G_{1,3}\) to \(G_{1,4}\) using a copy of \(\tilde{H_1}\), and connect \(G_{1,3}\) to \(G_{2,3}\) using a copy of \(H_3\). This completes the construction.

Proof of Theorem 10

Observe that each vertex \(v \in V(G')\) is contained in precisely one gadget, and so each vertex of \(G'\) inherits either a ‘u’ label or a ‘w’ label from its gadget. In what follows, whenever we refer to an edge encoding gadget \(G_{i,j}\), or a propagator gadget \(\tilde{H_i}\) or \(H_j\), it is for some \(i \in [1,k-1]\) and \(j \in [2,k]\) with \(i \leqslant j\).

Treewidth. We now describe a path decomposition of \(G'\) that illustrates that its pathwidth, and hence treewidth, is at most \(54k-69\).

First, observe that for a gadget \(H := G(\left<x_0,x_1,\ldots ,x_{z}\right>)\), there is a path decomposition where each bag has size at most 4. By adding \(B(H) \cup D(H)\) to every bag, we obtain a path decomposition where each bag has size at most 10; we denote this path decomposition by \({\mathbf {P}}(H)\). Note that H is only linked to other gadgets in \(G'\) by edges with one end in either B(H) or D(H).

Recall that the edge encoding gadgets are joined together using propagator gadgets with respect to the cyclic ordering

$$\begin{aligned} (G_{1,2},G_{1,3},\ldots ,G_{1,k},G_{2,2},G_{2,3},\ldots ,G_{2,k},\ldots ,G_{k-1,k-1},G_{k-1,k}). \end{aligned}$$

Consider an auxiliary multigraph F on the vertex set \(\{G_{i,j} : i \in [1,k-1], j \in [2,k], i \leqslant j\}\) where there is an edge between \(G_{i,j}, G_{i',j'} \in V(F)\) whenever the gadget \(G_{i,j}\) is connected to \(G_{i',j'}\) using some propagator gadget in \(G'\). (Formally, there is an edge for \(i=i'\) and \(|j-j'| \in \{1,k-i,k-2\}\), or \(j=j'\) and \(|i-i'| \in \{1,j-1,k-2\}\).)

We now show that F has pathwidth at most \(3k-5\). Let \({\mathcal {G}}_1 = \{G_{1,j} : j \in [2,k]\}\) and, for \(i \in [2,k-1]\), let \({\mathcal {G}}_i = \{G_{i,j} : j \in [i,k]\}\). Then \(({\mathcal {G}}_1 \cup {\mathcal {G}}_2 \cup {\mathcal {G}}_3, {\mathcal {G}}_1 \cup {\mathcal {G}}_3 \cup {\mathcal {G}}_4, \ldots , {\mathcal {G}}_1 \cup {\mathcal {G}}_{k-2} \cup {\mathcal {G}}_{k-1})\) is a path decomposition for F where the largest bag, the first one, has size \(3k-4\). We denote this path decomposition \({\mathbf {P}}(F)\).

We extend this to a path decomposition of \(G'\) by replacing each bag of \({\mathbf {P}}(F)\) with a path, which is in turn constructed from several concatenated “subpaths”, one for each gadget. Suppose, for some \(i,j \in [k]\) with \(i \leqslant j\), we have that \(\tilde{H_i}\) and \(H_j\) connect to \(G_{i,j}\) in \(G'\), and \(\tilde{H_i'}\) and \(H_j'\) connect from \(G_{i,j}\) in \(G'\); then we denote \(X_{i,j} = D(\tilde{H_i}) \cup D(H_j) \cup B(G_{i,j}) \cup D(G_{i,j}) \cup B(\tilde{H_i'}) \cup B(H_j')\). Let \(Z \subseteq [k] \times [k]\) such that \(\bigcup _{(i,j) \in Z} G_{i,j}\) is a bag of the path decomposition of F. From this bag, we construct a path where each bag contains \(Q=\bigcup _{(i,j) \in Z} X_{i,j}\). The subpaths of this path are as follows. For each \((i,j) \in Z\) we have a subpath obtained from \({\mathbf {P}}(G_{i,j})\) by adding Q to each bag. Every edge of F is contained in some bag of the path decomposition, and corresponds to a propagator gadget H of \(G'\). For each such H, we have a subpath obtained from \({\mathbf {P}}(H)\) by adding Q to each bag. These subpaths are then concatenated together, end to end, to create the path that replaces the bag \(\bigcup _{(i,j) \in Z} G_{i,j}\) in \({\mathbf {P}}(F)\). After doing this for each bag, we obtain a path decomposition of \(G'\).

Note that \(|Z| \leqslant 3k-4\), and \(|X_{i,j}| = 18\), for any \((i,j) \in Z\). So \(|Q| \leqslant 18(3k-4)\). A path decomposition \({\mathbf {P}}(H)\), for some gadget H, has bags with size at most 10, but each bag meets Q in precisely the elements \(B(H) \cup D(H)\). So the pathwidth of \(G'\) is at most \(18(3k-4)+4-1 = 54k-69\).

Correctness (\(\Rightarrow \)). First, let X be a multicolored k-clique in G; we will show that \(G'\) has a set \(S \subseteq V(G')\) such that \(|S| = 3 \left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -6\) and each component of \(G'-S\) has at most d vertices, where \(d = 3t^2+3t+3\). Let \(\gamma (i)\) be the index of the unique vertex in \(X \cap V_i\) for each \(i \in [k]\); that is, \(X \cap V_i = \{v_i^{\gamma (i)}\}\). For each \(H \in {\mathcal {H}}_i \cup \tilde{{\mathcal {H}}_i}\), we add the vertex \(u_{\gamma (i)}(H)\) to S; there are \((k-2)(k+1)+2(k-1)=k(k+1)-4\) such gadgets, so this many vertices are added to S so far. For each pair \(i,j \in k\) with \(i < j\), there is some \(q \in [p]\) such that \(\phi (\gamma (i),\gamma (j)) = f_{i,j}^q\); we add the vertex \(u_q(G_{i,j})\) to S. For \(i \in [2,k-2]\), we also add the vertex \(u_{\gamma (i)}(G_{i,i})\) to S. Now \(|S| = k(k+1)-4 + \left( {\begin{array}{c}k\\ 2\end{array}}\right) +k-2 = 3\left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -6\).

We now consider the size of the components of \(G'-S\). We first analyze the size of the components of a gadget \(G_{i,j}\), \(\tilde{H_i}\) or \(H_j\) after deleting S. Note that S meets the vertex set of one of these gadgets in precisely one vertex, and the deletion of this vertex splits the gadget into two components. The two components of \(G_{i,j} - u_q\) have \(f_{i,j}^q = 3t(\gamma (i)-1)+3\gamma (j)\) and \(f_{i,j}^{p} - f_{i,j}^q = 3t^2+3 - (3t(\gamma (i)-1)+3\gamma (j))\) vertices. The two components of \(\tilde{H_i} - u_{\gamma (i)}\) have \(3t\gamma (i)\) and \(3t(t+1-\gamma (i))\) vertices, while the two components of \(H_j - u_{\gamma (j)}\) have \(3\gamma (j)\) and \(3(t+1-\gamma (j))\) vertices. These gadgets are joined in such a way that the size of a component of \(G'-S\) is

$$\begin{aligned}&\big [3t(\gamma (i)-1)+3\gamma (j)\big ] + 3t(t+1-\gamma (i)) + 3(t+1-\gamma (j)) \\&\quad = 3t^2+3t+3 \\&\quad = \big [3t^2+3 - \big (3t(\gamma (i)-1)+3\gamma (j)\big )\big ] + 3t\gamma (i) + 3\gamma (j), \end{aligned}$$

as required. Finally, observe that the only cycles in each component are contained in a gadget, and each gadget has no chordless cycles, so each component is a chordal graph.

(\(\Leftarrow \)). Suppose \(G'\) has a set \(S \subseteq V(G')\) with \(|S| \leqslant 3 \left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -6\) such that each component of \(G'-S\) has at most d vertices, where \(d = 3t^2+3t+3\). We call any such set S a solution.

First, we show, loosely speaking, that we may assume each vertex in S is a ‘u’ vertex of its gadget, not a ‘w’ vertex. Let H be a gadget of \(G'\) of order s. There are two cases to consider: the first is when, for some \(r \in [1,s-1]\), we have that \(S \cap V(P_r(H)) \ne \emptyset \). Suppose \(P_r(H)\) contains a pair of adjacent vertices w and \(w'\) such that \(\{w,w'\} \cap S \ne \emptyset \). If \(w \in S\) and \(w' \notin S\), then, in \(G'-(S {\setminus } \{w\})\), only the component containing \(w'\) can have size more than d, and \(|V(P_r(H))| \leqslant 3t^2 < d\), so replacing \(w'\) in S with \(u_{r-1}(H)\) or \(u_r(H)\) also gives a solution. If \(\{w,w'\} \subseteq S\), then \((S {\setminus } \{w,w'\}) \cup \{u_{r-1}(H),u_r(H)\}\) is also a solution. So we may assume that \(V(P_r(H)) \cap S = \emptyset \) for each \(r \in [1,s-1]\).

Now we consider the second case; let \(G_{i,j}\) be an edge encoding gadget, let \(H \in {\mathcal {H}}_i\) and \({\tilde{H}} \in \tilde{{\mathcal {H}}_j}\) connect from \(G_{i,j}\), and let J be the set of vertices \(V(P_y(G_{i,j})) \cup V(P_z(H)) \cup V(P_z({\tilde{H}}))\), for \((y,z) \in \{(p,0),(0,k+1)\}\). Observe that \(G'[J]\) is connected and \(|J| \leqslant d\); intuitively, these are the vertices involved in the “join” of multiple gadgets in \(G'\). We show that if \(J \cap S \ne \emptyset \), then there is some solution \(S'\) with \(J \cap S' = \emptyset \). Let \(U := N_{G'}(J)\), so \(|U|=3\). If \(|J \cap S| \geqslant 3\), then \((S{\setminus } J) \cup U\) is a solution. Moreover, if \(|U{\setminus } S| \leqslant |J\cap S|\), then \((S{\setminus } J) \cup U\) is again a solution. Assuming otherwise, we can pick \(U' \subseteq U{\setminus } S\) such that \(|U'| = |J\cap S|\). If \(G'[(J \cup U){\setminus } S]\) is connected, then \(S' = (S {\setminus } J) \cup U'\) is a solution. But since \(|J \cap S| \leqslant 2\), it follows, by the construction of \(G'\), that \(G'[J {\setminus } S]\) is connected. Thus, in the exceptional case, the deletion of \(J \cap S\) disconnects some \(u \in U {\setminus } S\) from \(G'[J{\setminus } S]\). But in this case, if we ensure that \(U'\) is chosen to contain u, then we still obtain a solution \(S' = (S {\setminus } J) \cup U'\).

Next, we claim that each edge encoding gadget \(G_{i,j}\) or propagator gadget \(\tilde{H_i} \in \tilde{{\mathcal {H}}_i}\), has at least one vertex in S. Consider the subgraph \(D_{i,j}\) of \(G'\) induced by \(V(G_{i,j}) \cup V(\tilde{H_i}) \cup V(H_j)\), where \(\tilde{H_i}\) and \(H_j\) connect from \(G_{i,j}\). Recall that \(G_{i,j}\) consists of \(3t^2+3+1\) vertices, \(\tilde{H_{i}}\) consists of \(3t^2+3t+1\) vertices, \(H_{j}\) consists of \(3t+3+1\) vertices, and hence \(D_{i,j}\) has size \(2d+3\). If \(V(\tilde{H_{i}}) \cap S\) is empty, then the connected subgraph of \(D_{i,j}-S\) containing \(V(\tilde{H_i})\) also contains \(P_p(G_{i,j})\), which has size at least 3, so this connected subgraph contains at least \(3t^2 + 3t + 1 + 3 = d+1\) vertices; a contradiction. Similarly, if \(V(G_{i,j}) \cap S\) is empty, then the connected subgraph of \(D_{i,j}-S\) containing \(V(G_{i,j})\) also contains at least 3t vertices of \(V(\tilde{H_i})\), so at least \(d + 1\) in total; a contradiction. So \(|V(\tilde{H_{i}}) \cap S|, |V(G_{i,j}) \cap S| \geqslant 1\), as claimed.

Now we claim that each component of \(G'-S\) has size exactly d. Pick \(S' \subseteq S\) such that \(|V(G_{i,j}) \cap S'| = 1\) for each edge encoding gadget \(G_{i,j}\), and \(|V(\tilde{H_i}) \cap S'| = 1\) for each \(\tilde{H_i} \in \tilde{{\mathcal {H}}_i}\). It follows that \(|S'| = 2\big (\left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -2\big )\), and \(|S {\setminus } S'| = \left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -2\). Now, for distinct propagator gadgets \(H, H' \in \bigcup {\mathcal {H}}_i\), there is no path in \(G'-S'\) between a vertex in H and a vertex in \(H'\), so \(G'-S'\) has at least \(\left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -2\) components, one for each \(H \in \bigcup {\mathcal {H}}_i\). In fact, for every vertex v of \(G'-S\), there exists a vertex \(v' \in V(H)\) for some \(H \in \bigcup {\mathcal {H}}_i\) such that there is a path from v to \(v'\), so \(G'-S'\) has precisely \(\left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -2\) components. Moreover, since S consists only of ‘u’ vertices, the deletion of each vertex in \(S {\setminus } S'\) further increases the number of components by one. As \(|V(G')| = (2d+3) \big (\left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -2\big )\), so \(|V(G'-S)| = 2d \big (\left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -2\big )\), and each of the \(2\big (\left( {\begin{array}{c}k+1\\ 2\end{array}}\right) -2\big )\) components of \(G'-S\) has size at most d, these components must have size precisely d, as claimed.

Next we show that each gadget \(H_j \in {\mathcal {H}}_j\) also has at least one vertex in S. Suppose we have some \(H_j\) for which \(S \cap V(H_j) = \emptyset \). We calculate the size, modulo 3, of the component C of \(G'-S\) that contains \(H_j\). Since the size of \(V(C) \cap V(\tilde{H_i})\) or \(V(C) \cap V(G_{i,j})\) is congruent to \(0 \pmod 3\), and \(|V(H_j)| \equiv 1 \pmod 3\), we deduce that \(|V(C)| \equiv 1 \pmod 3\); a contradiction. So \(|S \cap V(H_j)| \geqslant 1\) for every \(H_j \in {\mathcal {H}}_j\) with \(j \in [2,k]\). Since \(|S| = 3\left( {\begin{array}{c}k\\ 2\end{array}}\right) \), it follows that each gadget meets S in precisely one vertex.

Finally, suppose \(u_{q}(G_{i,j}) \in S\), for some \(q \in [p]\). Then \(\phi (a,b) = f_{i,j}^q\), for some \(a,b \in [t]\). Let \(\tilde{H_i} \in {\mathcal {H}}_i\) and \(H_j \in {\mathcal {H}}_j\) be the propagators that connect from \(G_{i,j}\). Now, the component of \(G'-S\) containing \(3t^2+3 - (3t(a-1)+3b)\) vertices of \(G_{i,j} - u_q\) also contains \(3ta'\) vertices of \(\tilde{H_i}\), and \(3b'\) vertices of \(H_j\), for some \(a',b' \in [t]\). So

$$\begin{aligned} 3t^2 + 3ta' - 3t(a-1) + 3b' -3b +3 = 3t^2+3t+3. \end{aligned}$$

Working modulo t, we deduce that \(3(b'-b+1) \equiv 3 \pmod t\), hence \(b = b'\). It then follows that \(3t(a'-(a-1)) = 3t\), so \(a = a'\). Thus \(u_a(\tilde{H_i}), u_b(H_j) \in S\).

On the other hand, if for some \(a,b \in [t]\) we have \(u_a(\tilde{H_i}), u_b(H_{j}) \in S\), where \(\tilde{H_i}\) and \(H_{j}\) connect to \(G_{i,j}\), then the component of \(G'-S\) containing vertices from these three gadgets contains \(3t(t+1-a)\) vertices from \(\tilde{H_i}\), as well as \(3(t+1-b)\) vertices from \(H_j\), and \(3t(a'-1) + 3b'\) from \(G_{i,j}\) for some \(a',b' \in [t]\). Since this component has a total of \(3t^2+3t+3\) vertices, working modulo t we deduce that \(3b' + 3 - 3b \equiv 3 \pmod t\), so \(b=b'\). It follows that \(3t(a-a'+1) = 3t\), so \(a=a'\). Thus, \(u_{q}(G_{i,j}) \in S\) for \(q \in [p]\) such that \(\phi (a,b) = f_{i,j}^q\).

We deduce that for every \(l \in [k]\), there exists some \(\gamma (l)\) such that \(V({\tilde{H}}) \cap S = \{u_{\gamma (i)}\}\) for every \({\tilde{H}} \in \tilde{{\mathcal {H}}_{i}}\), \(V(H) \cap S = \{u_{\gamma (j)}\}\) for every \(H \in {\mathcal {H}}_j\), and \(V(G_{i,j}) \cap S = \{u_q\}\) for \(q \in [p]\) such that \(f_{i,j}^q=\phi (\gamma (i),\gamma (j))\). It follows that each \(v_i^{\gamma (i)}v_j^{\gamma (j)}\) is an edge of G, and \(X=\{v_i^{\gamma (i)} : i \in [k]\}\) is a multicolored k-clique in G, as required. \(\square \)

Theorem 10 implies that Bounded\({\mathcal {P}}\)-Component Vertex Deletion has no algorithm running in time \(f(w)n^{{\mathcal {O}}(1)}\), assuming \(\text {FPT} \ne W[1]\). However, we can say something stronger, assuming the ETH holds. Since, in the parameterized reduction in the previous proof, the treewidth of the reduced instance \(G'\) has linear dependence on k, a \(f(w)n^{o(w)}\)-time algorithm for this problem would lead to a \(f(k)n^{o(k)}\)-time algorithm for Multicolored Clique. But, assuming the ETH holds, no such algorithm for Multicolored Clique exists [14]. So we have the following:

Theorem 11

Unless the ETH fails, there is no \(f(w)n^{o(w)}\)-time algorithm for Bounded\({\mathcal {P}}\)-Component Vertex Deletion when \({\mathcal {P}}\) contains all chordal graphs.

Furthermore, Marx [17] showed that, assuming the ETH holds, Subgraph Isomorphism has no \(f(k)n^{o(k / \log k)}\)-time algorithm, where k is the number of edges in the smaller graph. By reducing from Subgraph Isomorphism, instead of Multicolored Clique, we obtain a lower bound with the combined parameter treewidth and solution size.

Theorem 12

Unless the ETH fails, there is no \(f(k')n^{o(k'/\log k')}\)-time algorithm for Bounded\({\mathcal {P}}\)-Component Vertex Deletion, where \(k' = w + k\), when \({\mathcal {P}}\) contains all chordal graphs.

Proof

Let (GH) be a Subgraph Isomorphism instance where the task is to find if G has a subgraph isomorphic to H. Let \(k:=|V(H)|\) and \(t:=|V(G)|\), and suppose \(V(G) = \{v^a : a \in [t]\}\) and \(V(H) = \{v_i : i \in [k]\}\). Let \(V_i = \{v_i^a : a \in [t]\}\) for each \(i \in [k]\), and let \(G^+\) be the graph on the vertex set \(\bigcup _{i \in [k]} V_i\) with an edge \(v_i^av_j^b\) if and only if \(i \ne j\) and \(v^av^b\) is an edge of G. Now the task is to select |E(H)| edges of \(G^+\) that induce a multicolored subgraph of \(G^+\); that is, the vertex set of this edge-induced subgraph meets each \(V_i\) in exactly one vertex.

We construct \(G'\) from \(G^+\) using a similar construction as in the proof of Theorem 10, but we only have an edge encoding gadget \(G_{i,j}\) for \(1 \leqslant i < j \leqslant k\) when \(v_iv_j\) is an edge in H. More specifically, we take the subsequence of \((G_{1,2},G_{1,3},\ldots ,G_{1,k},G_{2,2},G_{2,3},\ldots ,G_{2,k},\ldots ,G_{k-1,k-1},G_{k-1,k})\) consisting of each \(G_{i,j}\) for which \(v_iv_j \in E(H)\), as well as \(G_{i,i}\) for all \(i \in [2,k-1]\), and, as before, connect each \(G_{i,j}\) to the next \(G_{i,j'}\) in the cyclic ordering that matches on the first index using a copy of \(\tilde{H_i}\), and also connect it to the next gadget \(G_{i',j}\) in the ordering that matches on the second index using a copy of \(H_j\). Note that \(p=|E_{i,j}| = 2|E(G)|\).

By a routine adaptation of Theorem 10, it is easy to see that \({\text {tw}}(G') = {\mathcal {O}}(k)\), and that G has a subgraph isomorphic to H if and only if \(G'\) has a set \(S \subseteq V(G')\) of size at most \(k'\) such that each component of \(G'-S\) has size at most d. Now the parameter in the reduced instance is \(k'' := {\text {tw}}(G') + k' = {\mathcal {O}}(|V(H)|) + {\mathcal {O}}(|V(H)|^2) = {\mathcal {O}}(|E(H)|)\). Thus, an \(f(k'')n^{o(k''/\log k'')}\)-time algorithm for Bounded\({\mathcal {P}}\)-Component Vertex Deletion would lead to an algorithm for Subgraph Isomorphism running in time

$$\begin{aligned} f(|E(H)|)n^{o(|E(H)|/\log |E(H)|)}. \end{aligned}$$

But there is no algorithm for Subgraph Isomorphism with this running time unless the ETH fails [17]. \(\square \)