Recognizing Graphs Close to Bipartite Graphs with an Application to Colouring ReconfigurationThis paper received support from EPSRC (EP/K025090/1), London Mathematical Society (41536), the Leverhulme Trust (RPG-2016-258) and Fondation Sciences Mathématiques de Paris. An extended abstract of this paper appeared in the proceedings of MFCS 2017 .
We continue research into a well-studied family of problems that ask whether the vertices of a graph can be partitioned into sets and , where is an independent set and induces a graph from some specified graph class . We let be the class of -degenerate graphs. This problem is known to be polynomial-time solvable if (bipartite graphs) and NP-complete if (near-bipartite graphs) even for graphs of maximum degree . Yang and Yuan [DM, 2006] showed that the case is polynomial-time solvable for graphs of maximum degree . This also follows from a result of Catlin and Lai [DM, 1995]. We consider graphs of maximum degree on vertices. We show how to find and in time for , and in time for . Together, these results provide an algorithmic version of a result of Catlin [JCTB, 1979] and also provide an algorithmic version of a generalization of Brook’s Theorem, which was proven in a more general way by Borodin, Kostochka and Toft [DM, 2000] and Matamala [JGT, 2007]. Moreover, the two results enable us to complete the complexity classification of an open problem of Feghali et al. [JGT, 2016]: finding a path in the vertex colouring reconfiguration graph between two given -colourings of a graph of maximum degree .
The Colouring problem asks if a given graph is -colourable for some given integer , that is, if the vertices of the graph can be coloured with at most colours, such that no two adjacent vertices are coloured alike. This is a central problem in graph theory and well known to be NP-complete even if . A stronger property of a graph is that of being -degenerate, which is the case when every induced subgraph has a vertex of degree at most : every -degenerate graph is -colourable, but the converse is not true.
For an arbitrarily large integer , there exist -degenerate graphs that are not -degenerate but that can be decomposed into a -degenerate induced subgraph and a -degenerate induced subgraph for two small integers and . For example, if we take complete bipartite graphs of degree , then we can let . If a -degenerate graph is decomposable in this way, it is not only -colourable but even -colourable. This leads to the well-studied problem of identifying graphs whose vertex sets can be partitioned into two sets and such that and induce a -degenerate graph and -degenerate graph, respectively; see, for instance, . If a graph has such a partition with , then we can say that the graph is “robustly” -colourable. For the sake of example: every planar graph is -degenerate, which implies that it is -colourable, but we can improve this to -colourable by applying the result of Thomassen , which states that every planar graph can be decomposed into a -degenerate graph and a -degenerate graph, or another result of Thomassen , which states that every planar graph can be decomposed into a -degenerate graph and a -degenerate graph. So being -colourable is a “robust” property of planar graphs (in contrast to being -colourable; there is no and with such that we can guarantee a decomposition of a planar graph into a -degenerate graph and a -degenerate graph; see  for , and  for ).
We will apply the notion of “robust” -colourability to a central problem in the area of graph reconfiguration, that of finding a path between two given -colourings in the -colouring reconfiguration graph of a graph . The graph has as vertices the -colourings of and two -colourings are adjacent if and only if they differ on exactly one vertex of . This problem is PSPACE-hard even if and is planar bipartite . In its complexity classification for graphs of maximum degree  there is one open case left. As argued in , in order to solve this case we must answer the following research question:
1.1Known Existence Results
We note that in the above question we must find a partition for and . This is a different question than deciding whether such a partition exists. For the latter question, a number of different results exist in the literature. We will survey these results below, as they are very insightful for our question, although they do not solve it.
We first note that if , then we can take as a distance measure to control how “far” the graph is from being bipartite. As every -degenerate graph is an independent set of vertices, checking if the distance is is the same as checking bipartiteness, which can be solved in linear time. Graphs within distance from being bipartite are said to be near-bipartite. By definition, such a graph has a near-bipartite decomposition, that is, a partition of its vertex set, where is an independent set and induces a -degenerate graph, or equivalently, a forest. Deciding whether a graph is near-bipartite is NP-complete .
Yang and Yuan  proved that the problem remains NP-complete even for graphs of maximum degree , but becomes polynomial-time solvable for graphs of maximum degree . To prove the latter result, they showed that every connected graph of maximum degree at most is near-bipartite except (we let denote the complete graph on vertices). This characterization was also shown by Catlin and Lai, who proved that the independent set may even be assumed to be maximum.
Theorem ? generalizes the case of an earlier result of Catlin.
Matamala generalized both Theorem ? and Theorem ?.
Before Theorem ? appeared, Borodin, Kostochka and Toft proved a more general result, except that the property of the first set having maximum size is not assumed. We present a simpler version of their result and refer to  for full details.
Brooks’ Theorem  states that every graph with maximum degree is -colourable unless is a complete graph or an odd cycle. Recall that every -degenerate graph is -colourable. Hence Theorems ? and ?, together with the trivial case , generalize Brooks’ Theorem.
By choosing in Theorem ? we obtain the following special case, which implies that every connected graph of maximum degree except is within distance from being bipartite.
Theorem ? only guarantees that the existence of a desired partition can be tested in polynomial time. It does not tell us how to find such a partition. Obtaining an algorithmic version of Theorem ? corresponds to our research question. We cannot hope to keep the condition that is a maximum independent set, as this would require solving an NP-complete problem: Independent Set for connected cubic graphs . Before giving our results we first survey some other algorithmic results.
1.2Known Algorithmic Results
As discussed, Yang and Yuan  proved that recognizing near-bipartite graphs is polynomial-time solvable for graphs of maximum degree when and NP-complete when . They also proved that recognizing near-bipartite graphs of diameter is polynomial-time solvable when and NP-complete when . Recently, we solved their missing case by proving that the problem is NP-complete for graphs of diameter . Brandstädt et al.  proved that recognizing near-bipartite perfect graphs is NP-complete. We also proved that recognizing near-bipartite graphs is NP-complete for line graphs of maximum degree .
Borodin and Glebov  showed that every planar graph of girth at least is near-bipartite (see  for an extension of this result). Dross, Montassier and Pinlou  asked whether every triangle-free planar graph is near-bipartite. In fact they proved that if this is not the case, then the problem of recognizing near-bipartite graphs is NP-complete for triangle-free planar graphs. Their construction can be easily modified to prove that the problem of recognizing near-bipartite graphs is NP-complete for planar graphs.
The problem of finding a decomposition into an independent set and a forest where the size of is minimum has also been studied. In this context is said to be an independent feedback vertex set. Computing a minimum independent feedback vertex set has been shown to be NP-hard even for planar bipartite graphs of maximum degree , but linear-time solvable for graphs of bounded treewidth, chordal graphs and -free graphs  (it was already known that near-bipartite -free graphs can be recognized in linear time ). Recently, we extended the polynomial-time result from  for -free graphs to -free graphs . We also gave a polynomial-time algorithm for computing a minimum independent feedback vertex set of a graph of diameter .
The problem of computing small independent feedback vertex sets has also been studied from the perspective of parameterized complexity. In this setting, the size of is taken as the parameter. Misra et al.  gave the first FPT algorithm for this problem, which was later improved by Agrawal et al. .
The Induced Forest -Partition problem is closely related to the problem of recognizing near-bipartite graphs. It asks whether the vertex set of a given graph can be decomposed into two disjoint sets and , where both and induce forests. Wu, Yuan and Zhao  proved that Induced Forest -Partition is NP-complete for graphs of maximum degree and polynomial-time solvable for graphs of maximum degree at most . The problem variant where the maximum degree of one of the two induced forests is bounded by some constant has also been studied, in particular from a structural point of view (see, for instance, ).
A similar problem, known as Dominating Induced Matching, asks whether the vertex set of a graph can be partitioned into an independent set and an induced matching (a set of isolated edges) and was shown by Grinstead et al.  to be NP-complete. Brandstädt, Le and Szymczak  proved NP-completeness of another closely related problem, that of deciding whether the vertex set of a given graph can be decomposed into an independent set and a tree. As trees, induced matchings and forests are -colourable, these two problems and that of recognizing near-bipartite graphs can be seen as restricted variants of the -Colouring problem. This problem is well known to be NP-complete . However, the NP-hardness result of Brandstädt et al.  for perfect graphs shows that there are hereditary graph classes on which the complexities of recognizing near-bipartite graphs and -Colouring do not coincide, as -Colouring (or even -Colouring with part of the input ) is polynomial-time solvable for perfect graphs.
A -colouring of a graph is acyclic if every two colour classes induce a forest. We observe that every graph with an acyclic -colouring is near-bipartite, but the reverse is not necessarily true. Kostochka  proved that the corresponding decision problem Acyclic -Colouring is NP-complete. Later, Ochem  showed that Acyclic -Colouring is NP-complete even for planar bipartite graphs of maximum degree . As every bipartite graph is near-bipartite, this result implies that there are hereditary graph classes on which the complexities of recognizing near-bipartite graphs and Acyclic -Colouring do not coincide.
For a fixed graph class (that is, is not part of the input), Brandstädt, Le and Szymczak  considered the following more general problem:
Note that Stable() is equivalent to -Colouring if we choose to be the class of bipartite graphs. If we choose to be the class of -degenerate graphs, then we obtain the decision version of the problem we consider in this paper.
If is the class of complete graphs, then Stable() is the problem of recognizing split graphs, and this problem can be solved in polynomial time. Brandstädt, Le and Szymczak  proved that Stable() is NP-complete when is the class of trees or the class of trivially perfect graphs, and polynomial-time solvable when is the class of co-bipartite graphs, the class of split graphs, or the class of threshold graphs. Moreover, Stable() has also been shown to be NP-complete when is the class of triangle-free graphs , the class of -free graphs , the class of graphs of maximum degree , or, more generally, a class of graphs that has any additive hereditary property not equal to or divisible by the property of being edgeless , whereas it is also polynomial-time solvable if is the class of complete bipartite graphs  (see  for a faster algorithm). The Stable() problem has also been studied for hereditary graph classes with subfactorial or factorial speed  (the speed of a graph class is the function that given an integer returns the number of labelled graphs on vertices in the class).
By relaxing the condition on the set being independent we obtain the more general problem of -Recognition, which asks whether the vertex set of a graph can be decomposed into disjoint sets and , such that induces a graph in and induces a graph in . For instance, if is the class of cliques and is the class of disjoint unions of cliques, then the -Recognition problem is equivalent to recognizing unipolar graphs (see  for a quadratic algorithm). Generalizing Stable() can also lead to a family of transversal problems, such as Feedback Vertex Set. However, such generalizations are beyond the scope of our paper.
In Section 2, we consider near-bipartite decompositions of subcubic graphs (that is, graphs of maximum degree at most ). Recall that by Theorem ? the only connected subcubic graph that is not near-bipartite is (see also ) and so near-bipartite subcubic graphs can be recognized in polynomial time. However, neither the proof of Theorem ? in  nor the proof of this fact in  leads to a linear-time algorithm for finding the desired partition . As mentioned, in the case of Theorem ?, this would in fact require solving an NP-complete problem: Independent Set for cubic graphs . We give an -time algorithm that finds a near-bipartite decomposition of any subcubic graph with no component isomorphic to .
We say a partition of the vertex set of a graph is a -degenerate decomposition if is independent and induces a -degenerate graph, so Section 2 is concerned with -degenerate decompositions of graphs of maximum degree . In Section 3, we consider, more generally, -degenerate decompositions of graphs of maximum degree at most for any . By Theorem ?, the only connected graph with maximum degree that does not have a -degenerate decomposition is . As mentioned, Theorem ? does not imply a polynomial-time algorithm for finding such a decomposition. We give an -time algorithm to find such a decomposition for any (in contrast with the -time algorithm in Section 2 for the special case when ).
In Section 4 we prove that the problem of deciding whether a graph of maximum degree has a -degenerate decomposition is NP-complete. We do this by adapting the proof of the aforementioned result of Yang and Yuan , which states that recognizing near-bipartite graphs of maximum degree is NP-complete (the case). In Section 5 we apply our algorithms from Sections Section 2 and Section 3 to completely settle the complexity classification of the graph colouring reconfiguration problem considered in . Finally, in Section 6, we give directions for future work.
2Linear Time for Graphs of Maximum Degree at Most
In this section we prove the following result.
We will repeatedly apply a set of rules to . Each rule takes constant time to apply and after each application of a rule, the resulting graph contains fewer vertices. The rules are applied until the empty graph is obtained. We then reconstruct from the empty graph by working through the rules applied in reverse order. As we rebuild in this way, we find a near-bipartite decomposition of each obtained graph. We do this by describing how to extend, in constant time, a near-bipartite decomposition of a graph before some rule is undone to a near-bipartite decomposition of the resulting graph after that rule is undone. If we can do this then we say that the rule is safe. We conclude that the total running time of the algorithm is . It only remains to describe the rules, show that it takes constant time to do and undo each of them and prove that they are safe.
We need the following terminology. The claw is the graph with vertices and edges , , ; the vertex is the centre of the claw (see Figure 2). The triangular prism is the graph obtained from two triangles on vertices and , respectively, by adding the edges for (see Figure 2). Two vertices are false twins if they have the same neighbourhood (note that such vertices must be non-adjacent).
=[circle,draw=black, fill=black, minimum size=5pt, inner sep=1pt] =[draw,-,black,>=triangle 90]
Let be an arbitrary vertex of . Our choice of as an arbitrary vertex implies that can be found in constant time. We then use the first of the following rules that is applicable.
If has degree at most , then remove .
If there is a vertex of degree at most that is at distance at most from , then remove .
If contains an induced diamond whose vertices are at distance at most from , then remove the vertices of .
If there is a pair of false twins , each at distance at most from , then remove , and their common neighbours (note that is possible).
If is in a connected component that is a triangular prism , then remove the vertices of .
If Rules ?– ? do not apply but is in a triangle , then the neighbours of the vertices in that are outside are pairwise distinct (since there is no induced diamond) and at least two them, which we denote by , , are non-adjacent (otherwise belongs to a triangular prism). Remove the vertices of and add an edge between and .
If is the centre of an induced claw but has a neighbour that belongs to a triangle, then apply one of the Rules ?– ? on .
If the graph induced by the vertices at distance at most from contains the graph , or , depicted in Figure 5, with the vertex in the position shown in the figure, then remove the vertices of this graph .
If Rules ?– ? do not apply but is the centre of an induced claw and its three neighbours , , are also centres of induced claws, then remove , , , and for add an edge joining the two neighbours of distinct from and denote it by ; we say that such an edge is new (note that such neighbours of two distinct and may overlap).
=[circle,draw=black, fill=black, minimum size=5pt, inner sep=1pt] =[draw,-,black,>=triangle 90]
Let us show that at least one of the rules is always applicable. Suppose that, on the contrary, there is a vertex of a subcubic graph for which no rule applies. Then and its neighbours each have degree (Rules ? and ?) and so each either belongs to a triangle or is the centre of an induced claw. By Rule ?, must be the centre of an induced claw and therefore, by Rule ?, the same is also true for each neighbour of . This implies that Rule ? applies, a contradiction.
Because is subcubic, each of these rules takes constant time to verify and process. In particular, in some rules we need to detect some induced subgraph of constant size that contains or replace by some other vertex . In all such cases we need to explore a set of vertices of distance at most from . As is subcubic, this set has size at most , so we can indeed do this in constant time.
It is clear that, as claimed, the application of a rule reduces the number of vertices and that if we repeatedly choose an arbitrary vertex and apply a rule, we eventually obtain the empty graph. We now consider undoing the applied rules in reverse order to rebuild . As this is done, we will irrevocably colour vertices with colour or in such a way that the vertices coloured will form an independent set and the vertices coloured will induce a forest. Thus a rule is safe if this colouring can be extended whenever that rule is undone. When we reach , the final colouring will correspond to the required near-bipartite decomposition.
We must prove each rule is safe. At each step of reconstructing , we refer to the graph before a rule is undone as the prior graph and to the graph after that rule is undone as the subsequent graph. Note that the application of any of the Rules ?– ? again yields a subcubic graph. By the result of Yang and Yuan , every connected subcubic graph is near-bipartite, apart from . So we need to ensure that an application of a rule does not create a . This cannot happen when we remove vertices, but we will need to consider it for Rules ? and ?.
=[circle,draw=black, fill=black, minimum size=5pt, inner sep=1pt] =[draw,-,black,>=triangle 90]
In Rules ?– ? we only delete vertices. Rule ? is safe since if both neighbours of are coloured , then can be coloured ; otherwise can be coloured . Similarly, we see that Rule ? is safe. To see that Rule ? is safe, let be the diamond with vertex labels as illustrated in Figure 7, where is one of . If and are coloured , we colour and with and and with . Otherwise we colour with and , and with . We now show that Rule ? is safe. Let and be false twins (at distance at most from ). As is subcubic, every vertex in with a neighbour in has no neighbours outside and every vertex in with no neighbour in has at most one neighbour not equal to or . Moreover, as is subcubic, contains no cycle. Hence we can always colour , with and the vertices of with regardless of the colours of vertices outside . Indeed, every vertex of will have at most one neighbour that is not coloured , so cannot be in a cycle of vertices coloured in the subsequent graph. Rule ? is also safe since is -regular and hence would be a component of our subsequent graph, so we can colour its vertices by assigning colour to exactly one vertex from each of the two triangles and colour to its other vertices (see Figure 2). This completes the proof of Claim ?.
First, let us demonstrate that Rule ? is safe. If and are contained in a of the prior graph, then the subsequent graph contains a diamond whose vertices are at distance at most from . This contradicts Rule ?. Let be the triangle with vertex labels as illustrated in Figure 7. Suppose , and are coloured . Then we colour with and and with . The vertices in the subsequent graph with colour still induce a forest, as we have replaced an edge in the forest by a path on four vertices. Suppose and are coloured and is coloured . Then we colour with , and and with . Otherwise, since and are joined by an edge in the prior graph, we may assume that has colour and has colour . In this case we can colour with , and and with . This completes the proof that Rule ? is safe. Since Rules ?– ? are safe, it follows that Rule ? is also safe. This completes the proof of Claim ?.
We now show that Rule ? is safe. Suppose is contained in . We use the vertex labels from Figure 5. As Rule ? could not be applied, we find that has a third neighbour distinct from and . Regardless of whether is coloured or , we colour , , , , with and , with to obtain a near-bipartite decomposition of . We can also readily colour the vertices of or should be contained in one of them (note that since and are -regular, these graphs can only appear as components in our subsequent graph). This completes the proof of Claim ?.
Suppose that the prior graph contains fewer than three new edges. Then we may assume without loss of generality that . Then and are false twins at distance from and we can apply Rule ?, a contradiction. So we may assume that the prior graph contains exactly three new edges.
We claim that the application of Rule ? does not yield a . For contradiction, suppose it does. Let be the created . Then at least one new edge is contained in . If exactly one new edge is contained in , then is a diamond in the subsequent graph. Then we could have applied Rule ?, a contradiction. If all three new edges are in , then they must induce either a path on four vertices or a triangle in the subsequent graph. In the first case the subsequent graph is and in the second case the subsequent graph is . In both cases we would have applied Rule ?, a contradiction. Finally, suppose that contains exactly two new edges, say and . If and do not share a vertex, then they cover the vertices of . Hence the end-vertices of are false twins (at distance from ) in the subsequent graph, since they are both adjacent to and to each end-vertex of . Then we could have applied Rule ?, a contradiction. If and share a vertex, say , then and are adjacent in the subsequent graph and the vertex is adjacent only to , and . Therefore Rule ? could have been applied, a contradiction.
Thus an application of Rule ? does not yield a , and we may colour , , with and with . Indeed note that since if two end-vertices of a new edge are coloured , then in the subsequent graph the vertices coloured will still induce a forest, in which such a new edge is replaced by a path of length . This completes the proof of Claim ? and therefore completes the proof of Theorem ?.
3Quadratic Time for Graphs of Maximum Degree at Least
Let be an integer. Recall that a graph has a -degenerate decomposition if its vertex set can be decomposed into sets and where is an independent set and induces a -degenerate graph. Note that -degenerate decompositions are near-bipartite decompositions. We give an algorithm for finding a -degenerate decomposition of a graph on vertices of maximum degree at most for every (note that for we can also use Theorem ?).
For , we say that an order of the vertices of a graph is -degenerate if for all , the vertex has at most neighbours in . It is clear that a graph is -degenerate if and only if it has a -degenerate order. If is a -degenerate order for and is a subset of the vertex set of , then we let be the restriction of to , and let be the subgraph of induced by . For a set of vertices , we denote the neighbourhood of by .
We need the following lemma, which is a refinement of Lemma 8 in  with the same proof. We include a sketch of the argument for completeness.
Let be . Consider the greedy algorithm that starts with two empty sets and , and, at step , assigns to unless has a neighbour of smaller index already in , in which case it assigns to . Clearly the set is an independent set and every vertex of has at least one neighbour in , so is a maximal independent set. At any step , if the vertex is assigned to , then it has a neighbour of smaller index that belongs to . This implies that has at most neighbours of smaller index that belong to .
A pair of non-adjacent vertices in a graph is strong if and have a common neighbour in each component of the graph . In particular, note that if and have a common neighbour and is connected, then is a strong pair.
Let be the graph obtained by identifying and into a new vertex with . For each component of , let be a vertex of that is adjacent to both and in . We find a -degenerate order of the vertices of as follows. Let be the first vertex in . Consider each component of in turn, and append to the vertices of in the reverse of the order they are found in a breadth-first search from (note that this can be done in time). Then is a -degenerate order as every vertex has a neighbour later in the order except for each vertex, which has degree . It follows from Lemma ? that we can find a -degenerate decomposition of with . Then is a -degenerate decomposition of as , and and are non-adjacent so is an independent set.
Let be a vertex in distinct from and . Let be the graph obtained from by deleting . Each of and has exactly one neighbour that does not belong to and all other vertices of have no neighbours outside . Let be the neighbour of not in , and let be the neighbour of not in . We may assume that is distinct from , otherwise we are done by Lemma ?. We can find a -degenerate order of in time by taking the vertices in the reverse of the order they are found in a breadth-first search from , and then, if and do not belong to the same component of , appending the vertices in the reverse of the order they are found in a breadth-first search from . By Lemma ?, we can compute a -degenerate decomposition of in time such that is a -degenerate order of . If both and belong to , let and and, since is a clique on vertices with no edge joining it to , if follows that is a -degenerate decomposition of . Assume now without loss of generality that (we make no assumption about whether is also in ). Then let and . Then is an independent set. Recall that is a -degenerate order of . We show that we can append the vertices of to obtain a -degenerate order of . First add , then the vertices of and finally . It is clear that no vertex has more than neighbours earlier in the order.
Let and be vertices not in such that for each vertex in , its unique neighbour not in is either or . Neither nor can be adjacent to every vertex in (as then the other would be adjacent to none, contradicting the premise that the neighbourhood has size ). Since , one of and has at least two neighbours in . Consider the graph obtained from by removing and adding the edge (if it does not already exist). Note that and each have degree at most in and at least one of them, say , has degree less than . Therefore, we can find a -degenerate order of in time by taking the vertices in the order they are found in a breadth-first search from . Thus we can obtain a -degenerate decomposition of by Lemma ?, such that is a -degenerate order of and is a maximal independent set. At least one of and must belong to . Assume without loss of generality that either , or both and belong to , and, in the latter case, assume that has at least two neighbours in . Consider a neighbour of in . We set and , and claim that is a -degenerate decomposition of . It is clear that is an independent set. Recall that is a -degenerate order for . We must amend it to find a -degenerate order for that also includes the vertices of . We consider two cases.
First suppose . Then append to first the neighbours of in and then the neighbours of . As the vertices of are adjacent to the only one that could have more than vertices before it in the order is the one that appears last, but this is also adjacent to so we do indeed have a -degenerate order.
Now suppose . Then has a neighbour in that belongs to (as is a maximal independent set). Hence has at most neighbours in . Append to the vertices of , ending with a neighbour of (we know there is at least one), then move to be the final vertex in the order. Again the only vertex of that could have more than neighbours before it in the order is the one that appears last, and by choosing it to be a neighbour of and putting later in the order we ensure that a -degenerate order is obtained.
Given a graph , five of its vertices and a set of vertices , we say that induces a -lock with special vertices if and , and both and are adjacent to , each vertex in is adjacent to precisely one vertex in , and contains all possible edges except for and . We say that is a lock if it is a -lock with special vertices for some choice of .
Since has two neighbours outside , it follows that is a clique on vertices. If and have the same neighbour in , say , then and so we are done by Lemma ?. We may therefore assume that and have distinct neighbours in . Let be the graph obtained from by deleting and note that is connected since is adjacent to both and . Note that both and have degree in . We can therefore find a -degenerate order of in time by taking the vertices in the reverse of the order they are found in a breadth-first search from . Furthermore, since the only neighbours of in are and , both of which have degree , by moving to the start of the order , we obtain a another -degenerate order . By Lemma ?, we can therefore find a -degenerate decomposition of such that is a -degenerate order on and . Thus both and belong to . We let and , and claim that is a -degenerate decomposition of . It is clear that is an independent set. We have the -degenerate order on . We obtain a -degenerate order on by appending to the vertices of beginning with . Indeed, the only neighbour of that is earlier in the order is its single neighbour in (and note that since ). Furthermore, since , every vertex in has only neighbours in .
A pair of non-adjacent vertices , in a graph is a good pair if and have a common neighbour. Note that if a good pair , is not strong, then must be disconnected. We are now ready to state and prove the following result.
We may assume that is connected, otherwise it can be considered componentwise. If is not -regular, then it has a vertex of degree at most , so we can find a -degenerate order of in time by taking the vertices in the reverse of the order they are found in a breadth-first search from . In this case, we are done by Lemma ?. For -regular graphs, we use the procedure shown in Algorithm ?. We note that if is biconnected then, by , there is always a good pair , such that is connected, but this does not aid us in finding an algorithm for general graphs.
Let us make a few comments on this procedure. As is regular, connected and not complete, we can initially choose any vertex as and find another vertex to form a good pair in time. If we perform a breadth-first search (which takes time) from a neighbour of that retreats from or whenever they are encountered, we discover a component of . If the component contains a common neighbour of and but is not equal to , we repeat starting from a neighbour of or that was not discovered. Thus we discover in time that either , is a strong pair (if we find all components of and they each contain a common neighbour of and ), or that it is not. We set to be one of the components of arbitrarily. By Lemma ?, we therefore conclude that Lines ? and ? take time. It is easy to check in time whether we apply Lemmas ?– ? on Lines ?– ? and applying these lemmas takes in each case. Now suppose that we do not apply any of these lemmas, in which case we reach Line ?. We will show that we can find , and, if necessary, in time. If we find , such that is connected, then is a strong pair, so after executing Line ?, the algorithm will stop on Line ?. In all other cases will be strictly smaller than . This means that we apply Line ? at most times, implying that we execute Lines ?– ? at most times. This will give an overall running time of . It remains to show that if execution reaches Line ? then we can find the required good pair and the component in time.
Let us first show that contains good pairs — that is, that it is not a clique. If is a clique, then it contains either or vertices (as each vertex has degree in and the only other possible neighbours of vertices in are and ). If has vertices, then each vertex of must be adjacent to both and and we would have applied Lemma ? on Line ?, a contradiction. If has vertices, then each vertex of is adjacent to exactly one of and (and neither nor can be adjacent to every vertex in , as this would form a , contradicting the fact that is connected), in which case we would have applied Lemma ? on Line ?, a contradiction. Therefore we may assume that is not a clique.
We need describe how to choose a good pair , in . If we can show that and are in the same component of (which must necessarily contain all of ), then we are done as either is connected or there is another component of which must be contained in (and note that in this case can be found in time using breadth-first search).
If and have a common neighbour outside or at least three common neighbours in , then any good pair in can be chosen as , (as and will then be in the same component of ). If and have exactly two common neighbours , that both belong to , then any good pair other than , can be chosen as , . If , is the only good pair in (so all other vertices in are adjacent), then is a clique minus an edge and must contain vertices (, and the neighbours of that are not in ). Considering degree, any vertex in other than or must be adjacent to exactly one of and . If every vertex in is adjacent to, say , then is a clique on vertices minus an edge and we would have applied Lemma ? on Line ?, a contradiction. We may therefore assume that at least one vertex in is adjacent to and at least one is adjacent to , so there is a path from to avoiding and , and is connected, so we are done.
Finally, suppose that and have exactly one common neighbour that belongs to . Then any good pair not including can be chosen as , , as then and will be in the same component of . Suppose, for contradiction, that no such pair exists. Then is a clique. The vertex has neighbours in . Since , let be one of those neighbours. Since is the only common neighbour of and , we have that can only be adjacent to at most one of and . Therefore, has a neighbour non-adjacent to , so must have a neighbour non-adjacent to , which we denote . As is also adjacent to at most one of and , it also has a neighbour that is a non-neighbour of (and cannot be itself). So contains at least vertices: the neighbours of plus and . As induces a clique, it must have exactly vertices, since cannot contain a . Thus the set forms a lock, and so we would have applied Lemma ? on Line ?. This contradiction completes the proof.
Theorems ? and ? provide an algorithmic version of Theorem ?. Moreover, Theorems ? and ? concern decompositions of the vertex set of a graph where is independent and induces a -degenerate graph. As therefore cannot be a clique on vertices, both theorems also provide an algorithmic version of Theorem ?.
4Hardness for Graphs of Large Maximum Degree
Recall that Yang and Yuan  showed that the problem of deciding whether a graph of maximum degree is near-bipartite, or equivalently, has a -degenerate decomposition is NP-complete. We show how their proof can be adapted to prove that for every the problem of deciding whether a graph of maximum degree has a -degenerate decomposition is NP-complete.
We start by explaining the proof of Yang and Yuan. They use a reduction from -in--Sat with positive literals only. That is, we are given a set of variables and a set of clauses such that each clause is of the form for some with , and the question is whether there exists a truth assignment that makes exactly one of the three variables in each clause true (and the other two false).
Given an instance of -in--Sat, Yang and Yuan construct a graph as follows. First, as a building block they introduce a graph that consists of five vertices with edges , , , , , , (see also ?). They define the graph recursively a follows:
For , construct and copies of , that is, for , construct . Next, for identify the vertices and and identify the vertices and .
See ? for the graph . Observe that the graph contains pairwise vertex-disjoint copies of that do not have their and vertices identified with vertices.
=[circle,draw=black, fill=black, minimum size=5pt, inner sep=1pt] =[draw,-,black,>=triangle 90]
=[circle,draw=black, fill=black, minimum size=5pt, inner sep=1pt] =[draw,-,black,>=triangle 90]
Yang and Yuan prove the following observations for :
the graph is near-bipartite;
in any near-bipartite decomposition of either all vertices and () belong to or they all belong to ;
in any near-bipartite decomposition of at least one of the vertices , () belongs to .
To finish off the construction of the graph , Yang and Yuan, take copies of the graph , where is chosen such that , so that each copy of corresponds to the variable . To distinguish variables in different copies of , we will refer, for example, to the copy of in as . For each clause they introduce a clause-triangle, that is, a triangle with vertices , , . If variable occurs in a clause , then they add an edge between and and an edge between and . Note that has maximum degree .
Next, Yang and Yang prove the following three observations in the case where is near-bipartite:
exactly one of the vertices of each clause-triangle belongs to ;
if a vertex belongs to , then every other also belongs to ; and
if a vertex belongs to , then every other also belongs to .
Observation ? holds by definition of . Observations ? and ? follow from combining observations ? and ?.
Finally, using properties ?– ?, it is straightforward to prove that there exists a truth assignment of that makes exactly one of the three variables in each clause true if and only if is near-bipartite; see also .
To prove that for the problem of deciding whether a graph of maximum degree has a -degenerate decomposition is NP-complete, we reduce from -in--SAT with positive literals only. This problem is readily seen to be NP-complete via a reduction from -in--SAT with positive literals only. We adjust the construction of Yang and Yuan in the following way:
Change the graph to the graph , where and are sets of vertices. To obtain this graph, replace the (adjacent) vertices and by a clique on the set and replace the (non-adjacent) vertices and by an independent set on the set . Make every vertex in adjacent to every vertex in (just as every vertex in was adjacent to every vertex in ).
Construct the graphs using the following modified construction:
For , construct and copies of , that is, for , construct . Next, for , and , identify the vertices and .
Take to be the vertex gadgets, where .
Change each clause gadget from a triangle into a complete graph on vertices (corresponding to the variables of that clause).
Replace the two edges going from each variable vertex in each clause gadget to the corresponding and vertices in the corresponding variable gadget by edges going to the vertices of the independent set replacing these and vertices.
The above adjustments in the construction of Yang and Yuan  increase the maximum degree from to . This can be seen as follows. First, each variable vertex in the clause gadget has neighbours in the corresponding variable gadget in addition to its neighbours in the clause gadget. Moreover, in each variable gadget, all but one of the vertices that correspond to the vertex in the graph have degree , as such vertices were adjacent to vertices and of two different subgraphs of type and have now been made adjacent to every vertex of two cliques of size . Every vertex in a clique that replaced a pair of vertices and also has neighbours, namely neighbours in that clique, one neighbour corresponding to and neighbours in the independent set that replaced and . Finally, each vertex in an independent set that replaced the vertices and , but that has not been identified with a vertex has neighbours in the clique that replaced and and at most one neighbour in a corresponding clause gadget, if one exists.
5Application: Reconfigurations of Vertex Colourings
Our interest in finding -degenerate decompositions stems from an open problem in the area of graph reconfigurations. For a graph and an integer , the -colouring reconfiguration graph has vertex set consisting of all possible -colourings of and two vertices of are adjacent if and only if the corresponding -colourings differ on exactly one vertex. The following problem has been the subject of much study; see e.g. :
Given a graph on vertices and two -colourings and of , find a path (if one exists) in between and .
In this section, we are concerned with determining, for every pair , the complexity of this problem on graphs with maximum degree . In Section 5.1 we will prove the following result using Theorem ?.
In , three of the authors of the current paper proved Proposition ? in all cases except where the input graph is -regular. Their argument used the fact that if has maximum degree , but is not -regular, then is -degenerate. In this case it is possible to translate a structural result of Mihók  (also proved by Wood ) into an -time algorithm, as shown in . However, this does not work if is -regular.
The following theorem and proof demonstrate that Proposition ? indeed fills the gap left by past work on this problem.
In , the problem was shown to be solvable in time on (general) graphs with vertices and edges for . An time algorithm for the case where , was presented in . In , PSPACE-hardness for , was proved. This leaves only the case where and , which follows from Proposition ?.
5.1The Proof of Proposition
It was already known  that for every connected graph on vertices with maximum degree , there is a path of length between any two given -colourings in unless one or both of the -colourings is an isolated vertex in . To prove Proposition ?, we have to show how to find such paths between colourings in in time. Apart from using Theorem ?, this requires us to replace several structural lemmas of  by their algorithmic counterparts. As we have also managed to simplify some of the arguments from , we present a self-contained proof of Proposition ? in this section.
At several places in the proof of Proposition ? we seek to show that from some given colouring of a graph , we can find a path in to another colouring with some specified property. Rather than explicitly referring to paths in , we think, equivalently, in terms of recolouring vertices of one by one in order to turn into the colouring we require.
We now define a number of terms that we will use to describe vertices of with respect to a -colouring . A vertex is locked by if distinct colours appear on its neighbours; note that in this case every neighbour of has a unique colour. A vertex that is not locked is free. Clearly a vertex can be recoloured only if it is free. A vertex is superfree if there is a colour such that neither nor any of its neighbours is coloured , that is, for any in the closed neighbourhood of . A vertex can be recoloured with a colour other than if and only if is superfree. For any two colours , a -component is a connected component in the subgraph of induced by the vertices coloured or . As we continually recolour, these terms should be assumed to be used with respect to the current colouring unless specified otherwise. We let denote the set of vertices with colour . We say that we compact if we determine a path in from to a -colouring of with . We say that has the lock-property if, for every and every , we have that is locked.
The following lemma is crucial.
We note that has edges as is a fixed constant. Let for some . We first prove a series of claims, which will enable us to deal with several special cases.
We prove Claim ? as follows. First suppose that is free. Let be a colour not used on . We can determine in time, as is a constant. Then we can recolour with colour . Now assume that is not free, that is, is locked. Then is a neighbour of . We determine a colour not used on in time such that . We recolour with colour , and now is free and can be recoloured with . Hence, we have compacted in time. This proves Claim ?.
We prove Claim ? as follows. We recolour all vertices of that have colour with colour . This yields a new -colouring, as none of these vertices has a neighbour in . We then recolour all vertices of that have colour with the colour . Again this is a valid operation as, by the choice of , all their neighbours that were given colour by are now coloured . We finally recolour all vertices of that were given colour by (and so have in the current colouring) with the colour . This yields the -colouring . Moreover, the running time of doing this is linear in the size of . This proves Claim ?.
Suppose that has the lock-property. For every and every , we denote the unique neighbour of coloured by . For every and every (), the graph is the -component containing . We note that and may or may not be equal. These definitions are with respect to unless stated otherwise. We will write, for example, if we need to specify the colouring.
We start with two observations. If a vertex has degree at least in , then has two neighbours with the same colour, so it is free. By the lock-property, for all , every vertex in is locked. Hence is not adjacent to a vertex in . If a vertex has degree at least in , then is also superfree.
As is in , by the lock-property, we find that is locked. Hence has degree in . We now perform a breadth-first search in starting from . This takes time, as is a constant. We stop if we find a superfree vertex or else if we have visited all vertices of .
First suppose that we found a superfree vertex . As all vertices closer to than in are not superfree, they must have degree and form a path from to . As the internal vertices of have degree in , they are free and so have no neighbour in by the lock-property. Since is superfree, there is some colour with which we can recolour . As colours and appear on , we find that . After we recolour with , we note that (defined with respect to this new colouring) is a -component where no vertex coloured has a neighbour in . We apply Claim ? and note that now has no neighbour coloured . We therefore recolour with and have compacted in time.
Now suppose that we found that no vertex in is superfree. Then no vertex of has degree more than . Hence is a path or cycle. Since has degree , we find that must be a path. Let be the end-vertex of other than . As no vertex of the path is superfree and is locked, must be free by the assumption of the claim. Hence, every vertex of apart from is free, which means that no vertex of with colour has a neighbour in by the lock-property. We apply Claim ?. Afterwards we can recolour with colour to compact in time. This proves Claim ?.
We prove Claim ? as follows. For contradiction, suppose that and intersect on a free vertex . Then is an internal vertex on each of and . Moreover, the two neighbours of in are disjoint from the two neighbours of in , otherwise , in which case , a contradiction. Thus has four neighbours that use only two colours between them. So has at most colours in its neighbourhood. This means that is superfree, a contradiction. This proves Claim ?.
We prove Claim ? as follows. Since