Keywords

1 Introduction and Motivation

The vertex-arboricity of a graph G is the minimum integer p such that the vertices of G can be partitioned into p parts each of which induces a forest. It is, in general, NP-complete to decide if a graph G has arboricity less than or equal to a fixed p, \(p \ge 2\) [9]. This is a situation analogous to deciding if a graph G has chromatic number less than or equal a fixed q, \(q \ge 3\) [6]. Both problems can be efficiently solved on the class of cographs, and in [8], the authors have studied, for cographs, a blended problem, whereby a graph is partitioned into p parts inducing forests and q parts that are independent sets. Each of these problems can be efficiently solved in the class of cographs, and in fact characterized by a finite number of minimal cograph obstructions. This parallels the situation for a similar blended problem studied earlier, where a cograph G is to be partitioned into k independent sets and \(\ell \) cliques [2, 10].

Cographs are one of the most popular and intensively studied classes of perfect graphs. We say that G is a cograph if it has no induced subgraph isomorphic to \(P_4\), the path on 4 vertices. Equivalently [1], cographs can be recursively defined as follows: (i) The graph on single vertex is a cograph; (ii) If \(G_{1}, G_{2},...,G_{k}\) are cographs then so is their union, \(G_{1}\,\cup \, G_{2}\, \cup ... \cup \,G_{k}\); and (iii) If G is a cograph, then so is its complement \(\overline{G}\). Since cographs are perfect, many intractable problems can be solved in polynomial time on the class of cographs [7]. Moreover, the recursive description of cographs corresponds to a natural data structure (called a co-tree [1]), and partition problems like the chromatic number or arboricity can be solved in linear time directly on the co-tree. This is explicitly done for the chromatic number in [1], and can be done in a very similar fashion for vertex-arboricity. In fact, in [8], the authors similarly solve, for cographs, the blended problem of partition into p forests and q independent sets (and for even more general partitions). Furthermore, it follows from [3] that each of these problems has a characterization by a finite set of minimal cograph obstructions. Here a minimal cograph obstruction is a cograph G that does not admit a required partition, but each proper induced subgraph of G does admit such a partition. Thus a cograph admits a required partition if and only if it does not contain an induced subgraph isomorphic to a minimal cograph obstruction.

Minimal cograph obstructions for partition into k independent sets and \(\ell \) cliques were described in [2, 4, 5, 10]; they have \((k+1)(\ell +1)\) vertices, and admit a partition into \(k+1\) independent sets of size \(\ell +1\) as well as a partition into \(\ell +1\) cliques of size \(k+1\). In particular, the unique minimal cograph obstruction for partition into k independent sets is \(K_{k+1}\), and the minimal cograph obstruction for partition into \(\ell \) cliques is \(\overline{K_{\ell +1}}\) (as is required for perfect graphs).

Minimal cograph obstructions for partition into p forests and q independent sets were investigated in [8]. Consider first the special case of \(q=0\), that is partitions into forests (arboricity). Since cographs are perfect, there are two minimal cograph obstructions for being a forest, i.e., admitting a partition with \(p=1\): these are the cycles \(C_3\) and \(C_4\). For partitions into \(p=2\) forests, there turn out to be exactly 7 minimal cograph obstructions, forming the family \(\mathcal {A}_2\) depicted in Fig. 1.

Fig. 1.
figure 1

The family \(\mathcal {A}_2\).

Each of these obstructions has a natural generalization to minimal cograph obstruction for partition into p forests. For example, \(K_5\) generalizes to \(K_{2p+1}\), \(\overline{3 K_3}\) generalizes to \(\overline{(p+1) K_{p+1}}\), and so on. These 7 generalizations form a family \(\mathcal {A}_p\), given by an explicit uniform description in [8]. They are all minimal cograph obstructions to partition into p forests. Nevertheless, it turns out that there are in general many additional minimal cograph obstructions, and in fact the number of minimal cograph obstructions for partition to p forests grows exponentially with p [8].

There is, however, a class of partition problems in which minimal cograph obstructions can be uniformly described. This is the class of problems generalizing the problem of independent vertex feedback set [8]. A q-colourable vertex feedback set of a graph G is a set V of vertices such that \(G {\setminus } V\) admits a q-colouring. Thus a graph admits a q-colourable vertex-feedback set if and only if it has a partition into \(p=1\) forest and q independent sets. It is shown in [8] that there are precisely two minimal cograph obstructions for such a partition, namely \(K_{q+3}\) and \(\overline{(q+2)K_2}\). (Note that for \(q=0\) we again obtain \(C_3\) and \(C_4\) as the minimal cograph obstructions to being a forest.) This family describes all minimal cograph obstructions for partitions into \(p=1\) forest and q of independent sets, uniformly for all values of q. As mentioned above, there is only one minimal cograph obstruction for partitions into (\(p=0\) forests and) an arbitrary number q of independent sets, namely \(K_{q+1}\), which is again a family uniformly described for all values of q. This motivates the natural question whether there are other values of p for which such uniformity is possible.

In this paper we investigate the first open case of \(p=2\). In order to address the question of possible unform description, we explicitly describe all minimal cograph obstructions for partition into \(p=2\) forests and \(q=1\) independent set. Each member of the family \(\mathcal {A}_2\) again has a natural generalization as an obstruction for such a partition. For example, \(K_5\) generalizes to \(K_6\), because an independent set will take only one vertex and the remaining \(K_5\) cannot be partitioned into 2 forests. Similarly, \(\overline{3 K_3} = K_{3,3,3}\) generalizes to \(K_{3,3,3,3}\), \(\overline{3 K_2 + K_1}=K_{2,2,2} \oplus K_{1}\) generalizes to \(K_{2,2,2,2} \oplus K_{1}\), \(\overline{2 K_2} \oplus (K_1 + K_2) = K_{2,2} \oplus \overline{K_{1,2}}\) generalizes to \(K_{2,2,2} \oplus \overline{K_{1,2}}\), and so on. Below, we present a complete set \(\mathcal {F}\) of minimal cograph obstructions for partition into \(p=2\) forests and \(q=1\) independent set. The family \(\mathcal {F}\) contains 9 cographs, and while most of them can be interpreted as generalizations of members of \(\mathcal {A}_2\), some appear to be definitely new. In particular, the last member, 9, of the family \(\mathcal {F}\), does not seem to arise from any member of the family \(\mathcal {A}_2\) in any obvious fashion. Thus the evidence suggests that a uniform description of minimal cograph obstructions for all (2, q)-partitions seems unlikely.

The reference [8] presents a linear-time dynamic programming algorithm to decide whether an input cograph G admits a (2, 1)-partition (or any other (pq)-partition. As an application of our result we explain how to certify a negative outcome of the algorithm (i.e., a non-partitionable cograph G) by finding an actual forbidden induced subgraph.

2 The List of Minimal Obstructions

For brevity, we call a partition of a graph G into p forests and q independent sets, a (p, q)-partition of G. Thus, in the remainder of the paper, we describe all minimal cograph obstructions for (2, 1)-partition.

We introduce the family of cographs \(\mathcal {F}\). The members of the family are:

  1. 1.

    \(K_{6}\)

  2. 2.

    \(K_{3,3,3,3}\)

  3. 3.

    \(K_{2,2,2} \oplus \overline{K_{1,2}}\)

  4. 4.

    \(K_{2,2,2,2} \oplus K_{1}\)

  5. 5.

    \(2K_{3} \oplus K_{2,2}\)

  6. 6.

    \(( K_{2,2} + K_{3}) \oplus K_{2,2}\)

  7. 7.

    \(2K_{2,2} \oplus K_{3,3}\)

  8. 8.

    \(2K_{2,2} \oplus 2K_{2,2}\)

  9. 9.

    \(( K_{4} + K_{3,3,3}) \oplus \overline{K_2}\)

Lemma 1

Each graph in \(\mathcal {F}\) is a minimal cograph obstruction to (2, 1)-partition.

Proof

It is clear from their descriptions that each graph in the \(\mathcal {F}\) family is a cograph. We claim that each of these graphs is a minimal obstruction for (2, 1)-partition.

Consider first \(K_{6}\): it does not have a (2, 1)-partition, because any forest in \(K_6\) can have at most two vertices, and hence two forests can have at most four vertices. This leaves at least two vertices, but no two vertices in \(K_6\) form an independent set. Moreover, when a vertex is removed we have \(K_{5}\), which has an obvious (2, 1)-partition where each forest is one edge and the independent set is a single vertex. Therefore \(K_{6}\) is a minimal obstruction.

For the graph \(G = K_{3,3,3,3}\), we observe that any induced forest in G has at most four vertices, and this happens only when the forest is a tree. Thus two forests can cover at most eight vertices, and since \(K_{3,3,3,3}\) has no independent set of size four, it does not have a (2, 1)-partition. When a vertex is removed, we obtain \(K_{2,3,3,3}\), where we can take one independent set consisting of a part with three vertices, and cover the vertices of the remaining two parts of size three by stars centered at the remaining two vertices. Hence \(K_{3,3,3,3}\) is also a minimal obstruction.

The proof for most of the remaining obstructions follows a similar approach, and we skip the details (which are included in the last section). We do include the proof for the last two obstructions on our list, which are more interesting.

Consider the graph \(2K_{2,2} \oplus 2K_{2,2}\) from 8. Any independent set must be on one side of the join, and include at most four vertices. The remaining vertices contain an induced \(2 \left( \overline{2 K_2}\right) \oplus \overline{K_3}\), which is one of the obstructions for (2, 0)-partition from Fig. 1. When a vertex is deleted, we obtain the graph \(((K_{1,2} + K_{2,2}) \oplus 2K_{2,2})\), which has the following (2, 1)-partition: one independent set of four vertices on the bigger side of the join, one forest consisting of \(2K_{1,2}\) on the smaller side of the join, and one forest which is a star on five vertices. Thus \(2K_{2,2} \oplus K_{2,2}\) is indeed a minimal cograph obstruction for (2, 1)-partition.

Finally, we prove that the graph \((K_{4} + K_{3,3,3}) \oplus \overline{K_2}\) is a minimal cograph obstruction for (2, 1)-partition. We consider what an independent set S must contain in order for none of the minimal cograph obstructions for (2, 0)-partition (from Fig. 1) to remain after S is removed. Note that our graph contains \(K_{2,3,3,3}\), while in Fig. 1 there is both a \(K_{3,3,3}\) and a \(K_{1,2,2,2}\). Moreover, when S is removed there must not remain a copy of \(K_5\). To satisfy just these restrictions, S must contain one vertex of the \(K_4\), and three vertices of one entire part of the \(K_{3,3,3}\). Since this is a maximal independent set, S must be this set; but then its removal results in a graph containing an induced \(\left( \overline{2 K_2} + K_3\right) \oplus \overline{K_2}\) (the last graph in Fig. 1). It remains to partition the graphs resulting from deleting a vertex from \((K_{4} + K_{3,3,3}) \oplus \overline{K_2}\). If a vertex in the \(K_4\) is deleted, then we obtain a (2, 1)-partition by taking the independent set S as above, and two stars centered at the two vertices of the \(\overline{K_2}\), each involving one 3-vertex part of the \(K_{3,3,3}\) and one vertex of the \(K_4\). If a vertex of the \(\overline{K_2}\) is deleted, we can take again the independent set S, one forest consisting of an edge from the \(K_4\) and one part of the \(K_{3,3,3}\), and one star centered at the other vertex of the \(\overline{K_2}\). If a vertex v in the \(K_{3,3,3}\) is deleted, we can take for the independent set the vertices in the \(\overline{K_2}\), and partition the remaining vertices into two forests each consisting of one edge of the \(K_4\) and one star on four vertices.

3 The Completeness of the List

We now prove that the list of minimal cograph obstructions for (2, 1)-partition given in Lemma 1 is complete.

Theorem 1

A cograph has a (2, 1)-partition if and only if it is does not contain an induced subgraph from \(\mathcal {F}\).

Proof

Let G be a cograph. It is easy to see that a disconnected cograph G admits a (2, 1)-partition if and only if each connected component of G admits a (2, 1)-partition. Thus we may assume G is a connected cograph which does not contain an induced subgraph from \(\mathcal {F}\), and proceed to prove it has a (2, 1)-partition.

For brevity, we shall say that a graph is F-free if it does not contain F as an induced subgraph, and \(\mathcal {F}\)-free, if it doesn’t contain any member of the family \(\mathcal {F}\) as an induced subgraph.

Since G is connected, there exist cographs \(G_{1}\) and \(G_{2}\) such that \(G = G_{1} \oplus G_{2}\). If \(G_{1}\) and \(G_{2}\) are forests, then G trivially has a (2, 1)-partition. So, at least one of \(G_{1}\), \(G_{2}\) must contain an induced cycle. Without loss of generality, assume that at least \(G_{1}\) has an induced cycle; since \(G_{1}\) is a cograph, the only cycles possible are \(C_{3}\) or \(C_{4}\).

1. Assume \(G_{1}\) is \(C_{3}\)-free. In this case \(G_{1}\) has an induced \(C_4\); moreover, \(G_{1}\) is a bipartite graph. We will take a concrete bipartition and refer to (XY) as the parts. If \(G_{2}\) is a forest, then we have a trivial (2, 1)-partition with two independent sets and a forest. Thus we may assume that \(G_{2}\) also has a cycle. We have the following two subcases:

(a) Both \(G_{1}\) and \(G_{2}\) are \(C_{3}\) free. This implies that both cographs \(G_{1}\) and \(G_{2}\) are bipartite, and each has an induced \(C_4\). Both \(G_{1}\) and \(G_{2}\) cannot have more than one connected component with \(C_4\) because G is \(2K_{2,2} \oplus 2K_{2,2}\)-free. Hence without loss of generality we may assume that \(G_{2}\) has exactly one component, say A, with a \(C_4\), and the other components are trees. Note that A must be a complete bipartite graph since \(G_2\) has no induced \(P_4\). The graph \(G_{1}\) must also contain at least one connected component, say B, which is a complete bipartite graph. If \(G_{1}\) has other components with an induced \(C_4\), then one of the parts of A in \(G_2\) has exactly two vertices, because G is \(2K_{2,2} \oplus K_{3,3}\)-free. If the other connected components of \(G_1\) are trees, then one of the subgraphs A or B has a bipartition with one of the parts having exactly two vertices, since G is \(K_{3,3,3,3}\)-free. In either case, we can obtain a (2, 1)-partition of G as follows. Suppose the connected component A of the graph \(G_{2}\) has a bipartition (XY), where X has exactly two vertices. The first forest is obtained by taking one vertex from X, the entire other part Y, and the remaining tree components of \(G_{2}\). Since graph \(G_{1}\) is also bipartite, another forest can be obtained by taking one of the parts of \(G_{1}\) and the remaining vertex in X. The remaining vertices form an independent set in \(G_{1}\).

(b) \(G_{1}\) is \(C_{3}\) free but \(G_{2}\) contains a \(C_3\). Since \(G_{1}\) contains a \(K_{2,2}\) and since G is \(2K_{3} \oplus K_{2,2}\)-free and \(( K_{2,2} + K_{3}) \oplus K_{2,2}\)-free, there is exactly one component of \(G_{2}\) with a \(C_3\), and the other components of \(G_{2}\) are forests. Let the set \({(v_{1},v_{2},v_{3})}\) induce a \(C_3\) in \(G_{2}\), and let B be the component of \(G_{2}\) containing it. Since B is a connected cograph, we have \(B = B_{1} \oplus B_{2}\) for cographs \(B_{1}\), \(B_{2}\). The component B cannot contain an induced \(K_{4}\) and hence none of the graphs \(B_{1}\) and \(B_{2}\) have a \(C_3\). So, we assume without loss of generality that \(v_{1}, v_{2} \in V(B_{1})\), and \(v_{3} \in V(B_{2})\); moreover, \(B_{2}\) must be an independent set since G is \(K_6\)-free. If \(B_{2}\) has at least two elements, then \(B_{1}\) must be a \(K_2\), since G is \(K_{2,2,2} \oplus \overline{K_{1,2}}\)-free and \(K_{2,2,2,2} \oplus K_{1}\)-free. Hence either \(B_{1}\) is a \(K_2\) or \(B_{2}\) is a \(K_1\). We construct a (2, 1)-partition in both the cases.

When \(B_{1} = K_2\), then taking one of the parts of the bipartite graph \(G_{1}\) along with one vertex in \(B_{1}\) we obtain one first forest in our partition. To construct the second forest we include \(B_{2}\) along with the remaining vertex in \(B_{1}\) and the remaining tree components of \(G_{2}\). The remainder in \(G_{1}\) is the independent set in the partition.

When \(B_{2}\) consists of a single vertex, then taking this vertex with one of the parts of the bipartite graph \(G_{1}\) yields the first forest in the partition. The remaining parts of \(G_{2}\) form a forest which becomes the second forest in the partition. The remaining part of \(G_{1}\) is our independent set in the (2, 1)-partition.

This concludes the first case.

2. Assume that \(G_{1}\) contains \(C_3\). Without loss of generality we can assume that \(G_{2}\) is a forest as otherwise we have a \(K_{6}\), or a situation symmetric to the case 1(b). We consider several possible cases, noting that in all the cases where \(G_2\) has at least one edge, \(G_{1}\) does not contain \(K_{4}\), since G is \(K_6\)-free.

(a) Suppose first that \(G_{2}\) has at least three vertices and at least one edge. Consider a copy of \(C_3\) on \(v_{1}, v_{2}, v_{3}\) in \(G_{1}\), and the component B of \(G_{1}\) containing it. Since B is a connected cograph, we have \(B = B_{1} \oplus B_{2}\) for cographs \(B_{1}\), \(B_{2}\). Since B does not contain a \(K_{4}\), neither \(B_{1}\) nor \(B_{2}\) can contain a \(C_3\). So, we assume without loss of generality that \(v_{1}, v_{2} \in V(B_{1})\), and \(v_{3} \in V(B_{2})\); moreover, \(B_{2}\) is an independent set. If \(B_{1}\) has an induced \(C_4\), then \(B_{2}\) will be just a single vertex because G is \(K_{2,2,2} \oplus \overline{K_{1,2}}\)-free and \(K_{2,2,2,2} \oplus K_{1}\)-free. (Note that \(G_2\) contains a copy of \(\overline{K_{1,2}}\) or \(K_{1,2}\).) In conclusion, each component \(B = B_{1} \oplus B_{2}\) of \(G_1\) which contains a \(C_3\) either has a single vertex in \(B_2\) and a bipartite \(B_1\), or an independent set \(B_2\) and a forest \(B_1\). Each component of \(G_1\) without a \(C_3\) is bipartite.

We find a (2, 1)-partition of the graph G as follows. One forest will be formed by the vertices in \(G_2\). We partition \(G_1\) into a forest and an independent set; it suffices to partition each component B of \(G_1\) separately. A component \(B = B_{1} \oplus B_{2}\) with \(C_3\) which has a single vertex v in \(B_2\) yields a star centered at v and using one part of the bipartition of \(B_1\), with the other part of the bipartition yielding an independent set. In a component \(B = B_{1} \oplus B_{2}\) with \(C_3\) where \(B_2\) is an independent set and \(B_1\) is a forest, we trivially have a desired partition. Finally, each remaining component B is bipartite and one part can be taken as a forest and the other part as an independent set.

(b) Assume \(G_{2}\) has exactly two vertices, which are adjacent. Since \(G_{1}\) does not contain \(K_4\), it is is three colourable. One of the colour classes along with one vertex of \(G_{2}\) forms one forest of the partition. Another colour class with the other vertex of \(G_{2}\) yields another forest. The remainder is a single colour class which forms the independent set of the partition.

(c) Assume \(G_{2}\) has exactly two vertices, which are not adjacent. If \(G_{1}\) does not contain an induced \(K_{4}\), we obtain a partition of G as in case 2(b); so we assume that \(G_{1}\) has a \(K_{4}\). Note that we may take \(G_2\) for the independent set of a (2, 1)-partition, and it remains to find a partition of \(G_1\) into two forests (a (2, 0)-partition). Clearly, it suffices to find such a partition for each component B of \(G_1\) separately.

Note that while at least one component of \(G_1\) has a \(K_{4}\), there could be other components B of \(G_1\) without a \(K_4\). Such components B must have a (2, 0)-partition because otherwise \(G_{1}\) contains a minimal cograph obstruction for (2, 0)-partition from the family \(\mathcal {A}_2\), and adding the independent set \(G_2\) would yield a member of \(\mathcal {F}\). (This can be easily seen by comparing the two families.)

Now we consider components \(B = B_1 \oplus B_2\) of \(G_1\) which do contain a \(K_4\).

Suppose first that both \(B_1, B_2\) are bipartite. Note that both \(B_1\) and \(B_2\) cannot contain an induced a \(C_4\) since G is \(K_{2,2,2,2} \oplus K_{1}\)-free. If both \(B_1\) and \(B_2\) are forests, then we have a trivial partition of B into two forests. Hence, say, \(B_{1}\) has a \(C_4\) and \(B_2\) is a forest. In fact, \(B_{2}\) must be just an edge, say uv, because G is \(K_{2,2,2,2} \oplus K_{1}\)-free and \(K_{2,2,2} \oplus \overline{K_{1,2}}\)-free. In this case a (2, 0)-partition of B is formed by taking one star centered at u with one part of the bipartition of \(B_1\), and one star centered at v with the other part of \(B_1\).

Thus we may assume that one of \(B_1, B_2\), say \(B_1\), contains a \(C_3\). Since G is \(K_6\)-free, B is \(K_{5}\)-free, and so \(B_2\) must an independent set. Now we further consider each component \(D = D_1 \oplus D_2\) of \(B_{1}\). At least one such component \(D'\) must contain a \(C_3\), but there could also be bipartite components D; all must be \(K_4\)-free.

If \(B_{2}\) has at least two vertices, then exactly one component, namely \(D'\), of \(B_{1}\) has a cycle (specifically a \(C_3\)). Bipartite components D cannot have a cycle (i.e., a \(C_4\)), because G is \((K_{3} + K_{2,2}) \oplus K_{2,2}\)-free. Moreover no other component \(D \ne D'\) can have a \(C_3\), because G is \(2K_{3} \oplus K_{2,2}\)-free. Hence if \(B_{2}\) has at least two vertices then all the components D of \(B_{1}\), other than \(D'\), are forests.

Suppose that \(v_{1}, v_{2}, v_{3}\) form a \(C_3\) in D. Since \(D = D_1 \oplus D_2\) is \(K_{4}\)-free, neither of the graphs \(D_{1}, D_{2}\) has a \(C_3\). So we may assume \(v_{1}, v_{2} \in V(D_{1})\) and \(v_{3} \in V(D_{2})\); moreover we may assume \(D_{1}\) is a bipartite graph and \(D_{2}\) is an independent set.

If the bipartite graph \(D_{1}\) contains a \(C_4\), then both \(D_{2}\) and \(B_{2}\) must consist of a single vertex because G is \(K_{2,2,2,2} \oplus K_{1}\)-free.

If \(D_{1}\) is a forest with more than the two vertices \(v_{1}, v_{2}\), then it contains an induced \(K_{1,2}\) or \(\overline{K_{1,2}}\), Therefore, at least one of \(D_{2}, B_{2}\) must be a single vertex, since G is \(K_{2,2,2,2} \oplus K_{1}\)-free and \(K_{2,2,2} \oplus \overline{K_{1,2}}\)-free.

Otherwise \(D_{1}\) is just the edge \(v_1v_2\).

Finally, if there is no \(C_3\) in D, i.e., D is bipartite, then \(D_1\) is an independent set.

We now describe a (2, 0)-partition of \(B = B_1 \cup B_2\). Recall that \(B_2\) is an independent set, and \(B_1\) consists of components \(D = D_1 \oplus D_2\) where each \(D_2\) is an independent set and each \(D_1\) is bipartite, with the following four possibilities: (i) \(D_1\) contains a \(C_4\), in which case \(D_2\), as well as \(B_2\), has a single vertex; (ii) \(D_1\) is a forest of more than two vertices, in which case \(D_2\) or \(B_2\) has a single vertex; (iii) \(D_1\) is an edge \(v_1v_2\); or (iv) \(D_1\) is an independent set. Moreover, in cases (ii–iv), if \(B_2\) has more than one vertex, then all but one component D of \(B_1\) are forests.

We first describe a (2, 0)-partition of \(B = B_1 \cup B_2\) when \(B_{2}\) has at least two vertices. In this case, there is one component \(D' = D'_1 \oplus D'_2\) of \(B_1\) with \(D'_1\) a forest with one or more vertices (cases (ii, iii)), and all other components D of B are forests themselves. We obtain a (2, 0)-partition of \(G_1\) as follows. If \(D'_1\) is just an edge, say xy, the first forest consists of a star centred at the vertex x covering the independent set \(D'_2\), along with the rest of the forest components of \(B'_1\). The second forest is a star centred at the remaining vertex v covering the independent set \(B_2\). If \(D'_1\) has at least two vertices, then \(D'_2\) is a single vertex u, and we can take \(D'_1\) together with all other components D as one forest; the other forest will be the star centered at u and covering \(B_2\).

Now consider a component \(B = B_1 \cup B_2\) of \(G_1\) when \(B_2\) has a single vertex, say v. We put together one forest for a (2, 0)-partition of B from the following forests in the various components \(D= D_1 \oplus D_2\) of B. From components D of type (i) we take the star centered at the single vertex of \(D_2\) and covering one part of the bipartition of \(D_1\); from components D of type (ii-iv) we take the forests \(D_1\). The other forest for a (2, 0)-partition of B will be formed by a star centered at v and covering all the remaining vertices. (These are the other parts of all \(D_1\) for components of type (i), as well as all \(D_2\) for components of type (ii-iv); note that this is an independent set of vertices.)

(d) Finally, we assume that \(G_{2}\) is just a single vertex, say v. The proof here is similar to the case 2(c), except that in the case (i), when \(D_1\) contains an induced \(C_4\), we can only claim that \(B_2\) or \(D_2\) is a single vertex, and in the case (ii), when \(D_1\) is a forest with more than two vertices, we cannot claim anything about the size of \(B_2\) or \(D_2\) (Fig. 2).

Nevertheless, there is a (2, 1)-partition of the entire G. (Since \(G_2\) is a single vertex v, we may use v to form a star for the forests of the partition, and we no longer use \(G_2\) as the independent set.) Before describing the partition, recall that G consists of a vertex v adjacent to all other vertices, and \(G {\setminus } v\) has components \(B = B_1 \oplus B_2\) of two kinds, either \(B_2\) is a single vertex, or \(B_2\) is an independent set with at least two vertices. For components \(B' = B'_1 \oplus B'_2\) of the first kind (where \(B'_2\) is a single vertex w), we only note that \(B'_1\) consists of bipartite components D. For the components B of the second kind (where \(B_2\) is a larger independent set), we distinguish components \(D' = D'_1 \oplus D'_2\) in which \(D'_2\) consists of a single vertex z, and other components \(D = D_1 \oplus D_2\) where \(D_2\) is a larger independent set and \(D_1\) is a forest. We now describe the first forest of a (2, 1)-partition of G. It is a star centered at v and covering the sets \(D_2\) of all components D of \(B'_1\) for the components \(B'\) of the first kind (where \(B'_2\) is a single vertex), as well as the sets \(B_2\) of all components B of the second kind. The second forest of the partition contains, for each component \(B'\) of the first kind (where \(B'_2\) is a single vertex w), a star centered at w and covering all first parts of the bipartitions of all \(D_1\) of the components D of \(B'_1\). It also contains, for each component B of the second kind, and each component \(D'\) in which \(D'_2\) consists of a single vertex z, a star centered at z and covering the first part of the bipartition of \(D'_1\), and containing \(D_1\) for each component D in which \(D_1\) is a forest. The remaining vertices are easily seen to form an independent set which we take for the desired (2, 1)-partition of G.

Fig. 2.
figure 2

An illustration of the case 2(d): one forest is indicated by large filled circles, the other forest by double circles, the remainder is independent

4 Conclusions

Theorem 1 implies that any cograph that is not (2, 1)-partitionable must have a member of \(\mathcal {F}\) as an induced subgraph. In [8] there is a linear-time dynamic programming algorithm to recognize (2, 1)-partitionable cographs. It computes for each cograph G the set of all triples (pqr) such that \(p+q+r \le 3, p \le 2, q \le 1\), and G has a set R with r vertices such that \(G {\setminus } R\) is (pq)-partitionable. The cograph G is (2, 1)-partitionable if and only if (2, 1, 0) is included in this set of triples. To compute these triples is trivial when G has one vertex, and explicit formulas are given for computing them when \(G = G_1 + G_2\) and when \(G = G_1 \oplus G_2\). Thus a bottom-up calculation on the cotree of G (a data structure that captures the description of the recursive construction of G) allows us to compute the triples for G. If the triple (2, 1, 0) is not present, we can apply a top-down process to actually recover a forbidden induced subgraph from the family \(\mathcal {F}\). We can identify in the cotree a cograph \(G'\), subgraph of G, which does not have a (2, 1)-partition, but all of whose descendants have a (2, 1)-partition. Clearly, this means that \(G'\) was obtained by a join operation, and we may assume \(G' = G_1 \oplus G_2\). Reading the proof of Theorem 1, we see that the relevant information we need includes whether or not \(G_1, G_2\) contain an induced \(C_3\) and where (or whether they are bipartite), and similarly for \(C_4\), or \(K_4\); we would also like to keep track of how many vertices they contain. Moreover, if \(G_1\) or \(G_2\) are themselves obtained by a disjoint union operation, we need similar information about their descendants. It is easy to see all this information can be computed during the construction of the cotree, so we assume we have it available for \(G'\) and its descendants. Then the proof of Theorem 1 directly specifies how to find a forbidden induced subgraph, since \(G'\) is known to not be (2, 1)-partitionable. For example, if \(G_1\) and \(G_2\) are both bipartite and both are joins of two bipartite cographs each of which contains a \(C_4\), then case 1(a) of the proof explains we can identify (from those \(C_4\)’s) an induced copy of \(2K_{2,2}\, \oplus \, 2K_{2,2}\). The remaining cases are similar, with the exception of components B without \(K_4\) in case 2(c). In this case we rely on the corresponding results of [8], which identify forbidden induced subgraphs for a (2, 0)-partition, to which we need to add one or both vertices of \(G_2\). It is not difficult to implement all this in linear time. A detailed implementation will be presented in the third author’s M.Sc. thesis.

5 The Remaining Proofs for Lemma 1

For the graph \(G = K_{2,2,2} \oplus \overline{K_{1,2}}\), we note that any subgraph of G on at least four vertices contains an induced cycle. Hence, one forest in the partition can cover at most three vertices and two forest can cover at most six vertices, and since G has no independent set of size three, \(K_{2,2,2} \oplus \overline{K_{1,2}}\) is an obstruction. For \(H = K_{1,2,2} \oplus \overline{K_{1,2}}\), one of the two forests will be \(\overline{K_{1,2}}\), and removing another forest on three vertices, the remainder is an independent set on two vertices, yielding a required (2, 1)-partition. For \(H = K_{2,2,2} \oplus {K_2}\), take one of the vertices of \(K_{2}\) with one of the parts in \(K_{2,2,2}\) to obtain one forest. We obtain the other forest in similar way and the remainder is just an independent set of size two. Hence, \(K_{2,2,2} \oplus \overline{K_{1,2}}\) is a minimal obstruction.

To prove that \( G = K_{2,2,2,2} \oplus K_{1}\), is an obstruction, note that any forest must be a tree and hence can have at most three vertices. Two forests can cover at most six vertices, and the remaining three vertices will contain an edge, and hence not be independent. To prove that G is indeed minimal, note that both \(H_{1} = K_{2,2,2,2} \) and \(H_{2} = K_{1,2,2,2} \oplus K_{1}\) have a (2, 1)-partition in which each forest is a tree on three vertices and the independent set has two vertices.

For \(G =2K_{3} \oplus K_{2,2}\), one of the two forests can cover at most four vertices and the other forest can cover at most three vertices. Hence, two forests can cover at most seven vertices and there is no independent set of size at least three in G. Hence, G does not have a (2, 1)-partition. Now we will show that \(H_{1} = (K_{2} + K_{3}) + \oplus K_{2,2}\) and \(2K_{3} \oplus K_{1,2}\) have a (2, 1)-partition. For \(H_{1}\), the partition consists of one forest that is \(2K_{2}\) and has four vertices. The other forest is a tree on three vertices and the remainder is just an independent set on two vertices. In \(H_{2}\), the first forest consists of the middle vertex in \(K_{1,2}\) along with one vertex in the each of the \(K_{3}\). The other forest has four vertices consisting of \(2K_{2}\) each. The remainder is an independent set on two vertices. Thus \(G =2K_{3} \oplus K_{2,2}\) is indeed minimal.

Similarly, for \(G = ( K_{2,2} + K_{3})\,\oplus \,K_{2,2}\), one of the two forests in G can have at most five vertices, and then the other forest can have at most three vertices. The remainder will have at least 3 vertices. Since G does not have an independent set of size three, G does not have a (2, 1)-partition. We will prove that all the graphs obtained from deleting one vertex from G have a (2, 1)-partition. That is, \(H_{1} = (K_{1,2} + K_{3}) \oplus K_{2,2} \), \(H_{2} = (K_{2,2} + K_{2}) \oplus K_{2,2}\) and \(H_{3} = (K_{2,2} + K_{3}) \oplus K_{1,2}\), each have a (2, 1)-partition. For the graph \(H_{1}\), the partition has one forest on five vertices consisting of \(K_{1,2}\) and \(K_{2,}\), and the other forest is just a \(K_{1,2}\), leaving an independent set on two vertices.

For \(G = 2K_{2,2} \oplus K_{3,3}\), two forests can cover at most ten vertices. Either there is only one forest on six vertices and the other forest then can have at most four vertices, or one can obtain two forest on five vertices each. There is no independent set on four vertices., so G does not admit a (2, 1)-partition. To see that G is indeed minimal, note that both \(H_{1} = (K_{2,2} + K_{1,2}) \oplus K_{3,3}\) and \(H_{2} = 2K_{2,2}\,\oplus \,K_{2,3}\) have a (2, 1)-partition. For \(H_{1}\) one such partition has one forest consisting of two copies of \(K_{1,2}\) and other forest is a \(K_{1,3}\), leaving an independent set of three vertices. For \(H_{2}\), a partition can be obtained with two forests which are stars on five vertices each, and the remainder is just an independent set on three vertices.