Splitting a graph into disjoint induced paths or cycles

A graph is an X-graph of Y-graphs (or two-level clustered graph) if its vertices can be partitioned into subsets (called clusters) such that each cluster induces a graph belonging to the given class Y and the graph of the clusters belongs to another given class X. Two-level clustered graphs are a useful and interesting concept in graph drawing. We consider the complexity of recognizing two-level clustered graphs. We prove that, for a given integer k>=2, it is NP-completeto decide whether or not a graph is a path of length k-1 of paths (cycles). This solves a problem posed by Schreiber, Skodinis and Brandenburg. Similar reductions show that it is NP-complete to decide whether or not a graph is a k-star/k-clique of paths (cycles). In contrast, we show that k-graphs of path (cycles) can be recognized in polynomial time when the inputs are restricted to graphs of bounded treewidth.