Journal of Graph Algorithms and Applications Vertex-coloring with Defects 314 Angelini Et Al. Vertex-coloring with Defects

Defective coloring is a variant of the traditional vertex-coloring in which adjacent vertices are allowed to have the same color, as long as the induced monochromatic components have a certain structure. Due to its important applications, as for example in the bipartisation of graphs, this type of coloring has been extensively studied, mainly with respect to the size, degree, diameter, and acyclicity of the monochromatic components. We focus on defective colorings with κ colors in which the monochro-matic components are acyclic and have small diameter, namely we consider (edge, κ)-colorings, in which the monochromatic components have diameter 1, and (star, κ)-colorings, in which they have diameter 2. We prove that the (edge, 3)-coloring problem remains NP-complete even for graphs with maximum vertex-degree 6, hence answering an open question posed by Cowen et al. [9], and for planar graphs with maximum vertex-degree 7, and we prove that the (star, 3)-coloring problem is NP-complete even for planar graphs with bounded maximum vertex-degree. On the other hand, we give linear-time algorithms for testing the existence of (edge, 2)-colorings and of (star, 2)-colorings of partial 2-trees. Finally, we prove that outerpaths, a notable subclass of outerplanar graphs, always admit (star, 2)-colorings.


Introduction
Graph coloring is a fundamental problem in graph theory, which has been extensively studied over the years (see, e.g., [6] for an overview).Most of the research in this area has been devoted to the vertex-coloring problem (or coloring problem, for short), which dates back to 1852 [27].In its general form, the κ-coloring problem asks to label the vertices of a graph with a given number κ of colors, so that no two adjacent vertices have the same color.In other words, a κ-coloring of a graph partitions its vertices into κ color classes, each determining an independent set.A central result in this area is the so-called four color theorem, according to which every planar graph admits a κ-coloring with κ ≤ 4; see e.g.[19].Note that the 3-coloring problem is NP-complete [17], even for graphs of maximum vertex-degree 4 [11].
Several variants of this problem have been proposed over the years; see, e.g., [31] for a survey.One of the most studied is the so-called defective coloring, independently introduced by Andrews and Jacobson [2], Harary and Jones [21], and Cowen et al. [9].In this problem, edges between vertices of the same color class are allowed as long as the monochromatic components, which are the connected components of the subgraphs induced by vertices of the same color, maintain some special structure.In this respect, one can regard the classical vertex-coloring as a defective one in which every monochromatic component is an isolated vertex, given that every color class determines an independent set.Besides its theoretical interest, the defective coloring problem has interesting applications.For example, it can be regarded as the scheduling problem [8] where vertices represent tasks and edges represent conflicts between tasks in terms of shared resources.Here, a defect means tolerating some threshold of conflict: for example, each user running a task may find the maximum slowdown incurred for executing its task with one conflicting other task acceptable, and with more than one conflicting task unacceptable.
In this work we focus on the latter two aspects, namely we study defective colorings in which each monochromatic component is acyclic and has small diameter.In particular, we consider the cases in which the diameter is at most 1 (hence each component is either a vertex or an edge) or at most 2 (hence each component is a star, i.e. a tree with a central vertex connected to any number of leaves; see Figure 1d).We hence call the two corresponding problems (edge, κ)-coloring and (star, κ)-coloring, respectively.Figures 1a-1c show a trade-off between number of colors and diameter of the monochromatic components.We present algorithmic and complexity results for these two problems when κ = 2 and κ = 3.
The model we study can be seen as a variant of the bipartisation of graphs, namely the problem of making a graph bipartite by removing a small number of elements (e.g, vertices or edges), which is a central graph problem with many applications [20,24].The bipartisation by removal of (a not-necessarily minimal number of) non-adjacent edges corresponds to the (edge, 2)-coloring problem.
On the other hand, a (star, 2)-coloring also determines a bipartisation, in which independent stars are removed instead of vertices.Note that we do not ask for the minimum number of removed edges or stars but for the existence of a solution.
We observe that the (edge, κ)-coloring setting also fits into the other models of defective colorings that have been studied so far.In fact, any monochromatic component with diameter at most 1 has also size at most 2 and vertex-degree at most 1.This observation implies that several results on the defective coloring with bounded maximum vertex-degree carry on to the (edge, κ)-coloring problem.More precisely, from a result of Lovász [26] it follows that all graphs of maximum vertex-degree 5 are (edge, 3)-colorable.However, Cowen et al. [9] prove that the (edge, 3)-coloring problem is already NP-complete for graphs of maximum vertex-degree 7 and for planar graphs 1 of maximum vertex-degree 10.In the same work, they prove that the (edge, 2)-coloring problem is NP-complete for graphs of maximum vertex-degree 4 and for planar graphs of maximum vertex-degree 5. Also, they prove that not all outerplanar graphs 2 are (edge, 2)-colorable, while Eaton and Hull [28] prove that all triangle-free outerplanar graphs are.
On the other hand, (star, κ)-colorings have no direct relationship with the other defective coloring models, since their monochromatic components may have both the size and the maximum vertex-degree unbounded.Results on the complexity of the (star, 2)-coloring problem have been provided by Dorbec et al. [13], who proved that this problem is NP-complete even for planar graphs of maximum vertex-degree 4 and for triangle-free planar graphs.
Our contributions are: • We prove that the (edge, 3)-coloring problem remains NP-complete for graphs with vertex-degree at most 6 (Section 2); this answers a question 1 In [9] no explicit bound is given on the maximum vertex-degree; however, their proof can be adapted to work for planar graphs with maximum degree 10 by using planar graphs with maximum degree 4 in the reduction 2 An outerplanar graph is a graph that admits a planar drawing in which all the vertices are on the same face posed by Cowen et al. [9] in 1997 (recall that graphs of maximum vertexdegree 5 always admit such colorings [26]).We also show that this problem is NP-complete even for planar graphs of vertex-degree at most 7, which was already known only for planar graphs of vertex-degree at most 10 [9].Also, we prove NP-completeness of the (star, 3)-colorings problem, even for (planar) graphs of bounded maximum vertex-degree, namely for graphs with vertex-degree at most 9 and for planar graphs with vertex-degree at most 16.
• We present efficient algorithms for testing the existence of (edge, 2)colorings and (star, 2)-colorings of subclasses of planar graphs (Section 3).
In particular, we describe linear-time algorithms for testing (edge, 2)colorability and (star, 2)-colorability of partial 2-trees.We remark that partial 2-trees are a meaningful subclass of planar graphs that is of interest in computational complexity theory, since many NP-complete graph problems are solvable in linear time on these graphs (see, e.g., [34]).
We also recall that the partial k-trees are those graphs with treewidth at most k, for any k ≥ 1. Intuitively, the treewidth [33] is a parameter that measures how much a graph is similar to a tree, and it has applications in parameterized complexity (see, e.g., [16]).Since both types of colorability are expressible in the monadic second-order logic (MSO logic), they are decidable in linear time for graphs of bounded treewidth, as a consequence of Courcelle's theorem [7].However, the use of MSO logic and Courcelle's theorem usually leads to algorithms having impractical running times, with high dependence on their parameters.This motivates the design of more efficient ad-hoc algorithms (see, e.g., [4,25]).
• We provide a subclass of outerplanar graphs that is always (star, 2)colorable, namely the class of outerpaths (Section 4).An outerpath is an outerplanar graph whose weak-dual3 is a path.Note that it is easy to construct an outerpath not admitting any (edge, 2)-coloring.

NP-completeness Results
In this section we study the computational complexity of the (edge, 3)-coloring and the (star, 3)-coloring problems.
As discussed above, problem (edge, 3)-coloring is NP-complete [9] for graphs of maximum vertex-degree 7, while graphs of maximum vertex-degree 5 always admit (edge, 3)-colorings [26].We close this gap by proving in Theorem 1 that the problem remains NP-complete even for graphs of maximum vertex-degree 6.Then, in Theorem 2 we prove that the NP-completeness result extends to planar graphs of maximum vertex-degree 7. We leave as an open question the complexity of the problem for planar graphs of maximum vertex-degree 6.
For the (star, 3)-coloring problem we prove NP-completeness for graphs of maximum vertex-degree 9 and for planar graphs of maximum vertex-degree 16.While the (star, 2)-coloring problem was already known to be NP-complete, even for restricted graph classes [13], to the best of our knowledge these are the first NP-completeness results for the (star, 3)-coloring problem.
From now on, given a defective coloring of a graph, we call colored edge an edge whose end-vertices have the same color.
Proof: Membership in NP is shown in [9].To prove the NP-hardness, we employ a reduction from the Not-All-Equal 3-SAT (nae3sat) problem [30, p.187].An instance of nae3sat consists of a 3-CNF formula φ with variables x 1 , . . ., x n and clauses C 1 , . . ., C m .The task is to find a truth assignment satisfying φ in which no clause has all its three literals equal in truth value (that is, not all are true).We show how to construct a graph G φ of maximum vertex-degree 6 admitting an (edge, 3)-coloring if and only if φ is satisfiable.
Consider the graph of Figure 2a, which we denote by G 4,5,5 , as it contains one vertex u 1 of degree 4, two distinct vertices u 2 and u 3 of degree 5 (white in Figure 2a), and four vertices v 1 , v 2 , v 3 , and v 4 (gray in Figure 2a) of degree 6, which form a K 4 .Each of u 1 , u 2 , u 3 is connected to each of v 1 , v 2 , v 3 , v 4 , and there exists an edge (u 2 , u 3 ).We claim that in any (edge, 3)-coloring of G 4,5,5 vertices u 1 , u 2 , and u 3 have the same color, even in the absence of edge (u 2 , u 3 ).We refer to this color as the color of G 4,5,5 .Suppose, for a contradiction, that u 1 and u 2 have different colors, say white and black.Since v 1 , v 2 , v 3 , and v 4 form a K 4 , at most two of them have the third color, say gray.Since u 1 (u 2 ) is incident to all v 1 , v 2 , v 3 , and v 4 , at most one of them can be white (black).So, exactly two out of v 1 , v 2 , v 3 , and v 4 are gray, one is white, and one is black.Further, each of them is incident to a colored edge.Since u 3 is adjacent to all of v 1 , v 2 , v 3 , and v 4 , one of them is incident to two colored edges, regardless of the color of vertex u 3 ; contradiction.A schematization of G 4,5,5 is given in Figure 2b.Now, consider the graph of Figure 2c denoted by G 3,3,5,5 , as it has two vertices s and t of degree 3, and two other vertices x and y of degree 5. Graph G 3,3,5,5 contains five copies G 0 , G 1 , G 1 , G 2 , and G 2 of G 4,5,5 , connected by edges e 1 , e 1 , e 2 , e 2 , e 3 , and e 3 .We claim that in any (edge, 3)-coloring of G 3,3,5,5 vertices s and t have the same color, say black, while one of x and y is white and the other one is gray.Namely, e 1 , e 2 , and e 3 guarantee that G 0 , G 1 , and G 2 have mutually different colors.Thus, x and y have different colors.Symmetrically, G 0 , G 1 , and G 2 have mutually different colors.Also, s and t are only incident to G 1 , G 1 , G 2 , and G 2 (dotted edges in Figure 2c).Hence, both of them have the color of G 0 , which is different from the ones of x and y, completing the proof of the claim.We schematize G 3,3,5,5 as in Figure 2d.
For k ≥ 1, we form a chain of length k, which contains 3k + 1 copies G 1 , . . ., G 3k+1 of G 3,3,5,5 connected to each other as follows (see Figure 2e).For i = 1, . . ., 3k + 1, let s i , t i , x i , y i be the vertices of G i .Then, for i = 1, . . ., 3k, we introduce between G i and G i+1 two vertices z i and z i which form a K 4 with t i and s i+1 , as well as edges (y i , z i ) and (z i , x i+1 ) (dotted in Figure 2e).Assume that in G i vertices s i and t i are black, x i is gray, and y i is white (see e.g.G 1 or G 4 in Figure 2e).Since t i and s i+1 are incident to colored edges in G i and G i+1 and are incident to each other due to edge (t i , s i+1 ), they have different colors.Hence, z i and z i have the third color.Since z i is incident to y i , the color of z i and z i is gray, and the one of s i+1 and t i+1 is white.Since z i is incident to x i+1 , the color of x i+1 is black and the one of y i+1 is gray.So, the coloring of G i uniquely determines the one of G i+1 .Note that z i and z i+3 have the same color, with 1 ≤ i ≤ 3k − 2, and that all vertices of the chain have degree 6, except for vertices z i and z i (which have degree 4), and for vertices x 1 and y 3k+1 (which have degree 5).We schematize a chain as in Figure 2f (for k = 2).Thus, the schematization of a chain C of length k is treated as a tripartite graph with partitions , referred to as global chain (topmost chain in Figure 3a).For each variable , where n i is the number of occurrences of x i in φ, 1 ≤ i ≤ m (variable-gadget; see Figure 3a).For i = 1, . . ., n, we connect a vertex with degree 4 of partition B[C] to a vertex in P [C xi ] and to a vertex in N [C xi ] (solid gray edges in Figure 3a).These connections ensure that if partition will act as the positive and negative partitions of chain C xi .For each clause contains a triplet of so-called clause-vertices that form a 3-cycle and so cannot have the same color (clause-gadget; see Figure 3a).We connect each clause-vertex of clause C i to a vertex of degree less than 6 of partition B[C] (dashed gray edges in Figure 3a).These connections guarantee that if partition B[C] is colored black, then no clause-vertex is also colored black.The length of the global chain guarantees that all connections can be made so that no vertex of partition B[C] has degree larger than 6.
If λ j is positive (negative), then we connect the clause-vertex corresponding to λ j in G φ to a vertex of degree smaller than 6 that belongs to the positive partition P [C xj ] (to the negative partition N [C xj ]) of chain C xj .Similarly, we create connections for literals λ k and λ ; see the solid-black edges leaving the triplets for clause C 1 and C 2 in Figure 3a.
The length of C xi , for i = 1, . . ., n guarantees that all connections are accomplished so that no vertex of P [C xi ] and N [C xi ] has degree larger than 6.Thus, G φ has maximum vertex-degree 6.Since G φ is linear in the size of φ, the construction can be done in O(n + m) time.
We show that G φ is (edge, 3)-colorable if and only if φ is satisfiable.First assume that φ is satisfiable.We color partitions P [C], N [C], and B[C] of C white, gray, and black, respectively.If x i is true (false), then we color P [C xi ] white (gray) and N [C xi ] gray (white), and B[C xi ] black.Hence, the tripartitions of C xi are of different colors, as required by the construction.Further, if x i is true (false), then we color gray (white) all the clause-vertices of G φ that correspond to positive literals of x i in φ and we color white (gray) those corresponding to negative literals.Thus, a clause-vertex of G φ cannot have the same color as its two neighbors at the variable-gadget of x i , with 1 ≤ i ≤ m.Since in the truth assignment of φ no clause has all three literals true, no three clause-vertices belonging to the same clause have the same color.
Suppose that G φ is (edge, 3)-colorable and, w.l.o.g., that partition B[C] of global chain C is black.Hence, P [C xi ] and N [C xi ] are white or gray, i = 1, . . ., n.If P [C xi ] is white, then we set x i = true; otherwise, we set x i = f alse.Assume, for a contradiction, that there is a clause of φ whose literals are all true or all false.By construction, the corresponding clause-vertices of G φ have the same color, which is a contradiction since they form a 3-cycle in G φ .
We now consider planar graphs of bounded vertex-degree.
Proof: NP membership is shown in [9].To prove NP-hardness, we employ a reduction from the 3-coloring problem, which is NP-complete even for planar graphs of maximum vertex-degree 4 [11].Let G be a graph of maximum vertexdegree 4; we construct a planar graph G of maximum vertex-degree 7 admitting an (edge, 3)-coloring if and only if G is 3-colorable.
Consider the (edge, 3)-colorable graph of Figure 3b, which we call attachment gadget, with a distinguished vertex v, which we call pole-vertex.We claim that, in any (edge, 3)-coloring of an attachment gadget, the pole-vertex is incident to exactly one colored edge.To prove this, we show that vertices v 1 , v 2 , and v 3 have different colors.Considering the symmetry of the vertices, w.l.o.g.assume, for a contradiction, that v 1 and v 2 have the same color, say gray.Then, each of vertices v 1,1 , v 1,2 , v 1,3 , v 3 , v 2,2 , v 2,3 must be colored either black or white, since each of them is incident to the gray edge (v 1 , v 2 ).However, the subgraph of the attachment gadget induced by these vertices has no (edge, 2)-coloring, as shown in [10], which is a contradiction.
Graph G is obtained from G by attaching a copy G u of the attachment gadget at each vertex u of G, identifying u with the pole-vertex of G u .Since u has three neighbors in the gadget and at most four in G, graph G has vertexdegree at most 7.In addition, since the size of G is linear in the one of G, the reduction can be performed in linear time.
If G admits a 3-coloring, then G admits a (edge, 3)-coloring in which each pole-vertex in G has the same color as the corresponding vertex of G, while the colors of the vertices in each attachment gadget are determined based on the color of its pole-vertex, as in Figure 3b.For the other direction it is sufficient to prove that, in any (edge, 3)-coloring of G , every two adjacent pole-vertices v and w of G have different colors, as in this case a 3-coloring of G can be obtained by coloring each vertex as the corresponding pole-vertex in G .Namely, since both v and w are incident to a colored-edge in their attachment gadgets, edge (v, w) cannot be colored.
We conclude the section presenting our results on problem (star, 3)-coloring.
Theorem 3 Problem (star, 3)-coloring is NP-complete for graphs of maximum vertex-degree 9 and for planar graphs of maximum vertex-degree 16.Proof: The problem clearly belongs to NP; a non-deterministic algorithm only needs to guess a color for each vertex of the graph and then check whether the graphs induced by each color-set are forests of stars, which can be done in linear time.To prove that the problem is NP-hard, we employ a reduction from the 3-coloring problem that is the same as the one of Theorem 2, up to the choice of the attachment gadget.
To prove the first part of the statement we use as attachment gadget the complete graph K 6 on six vertices, which is (star, 3)-colorable (see Figure 4a).The proof is based on the fact that in any (star, 3)-coloring of K 6 each vertex is incident to exactly one colored edge.This is due to the fact that, if three vertices had the same color, then they would form a cycle of colored edges, given that K 6 is a complete graph.Hence, if we attach a copy of K 6 to each vertex of the original instance G of the 3-coloring problem, using any of its six vertices as the pole-vertex, then we can prove as in Theorem 2 that G admits a 3-coloring if and only if the resulting graph (which has vertex-degree 9, since G has vertex-degree 4) admits a (star, 3)-coloring.
For the second part of the theorem, we use as attachment gadget the planar graph of Figure 4b, with its topmost vertex being the pole-vertex.Since the polevertex has degree 12, the resulting graph is planar and has vertex-degree 16.Also, it is possible to prove that in any (star, 3)-coloring of the attachment gadget the pole-vertex is adjacent to at least a colored edge.This completes the proof of the theorem.

Efficient Testing Algorithms
In this section we give linear-time algorithms for the (edge, 2)-coloring and for the (star, 2)-coloring problems, restricted to certain subclasses of planar graphs.We recall that both these problems are NP-complete, even for planar graphs of bounded vertex-degree [9,13].In particular, we consider (edge, 2)-colorings of partial 2-trees (i.e., graphs with treewidth at most 2 [29]) in Theorem 4 and (star, 2)-colorings of the same class of graphs in Theorem 5.
Both algorithms are based on an efficient dynamic programming technique that exploits the SP Q-tree data structure (formally recalled below).From a high-level perspective, an SP Q-tree T of a partial 2-tree G is a tree-like data structure such that each node µ corresponds to a subgraph G µ of G, and G µ can be obtained with one of two possible compositions (a "series" or a "parallel" composition) of the subgraphs corresponding to the children of µ in T .The leaves of T correspond to the edges of G.We traverse T bottom-up and, for each node µ, we compute a small set of representative solutions for G µ .These representative solutions for node µ are obtained by suitably merging the representative solutions associated with the children of µ.Since the graphs associated with the children of µ either all share a same separation pair of G µ or they are attached one another through cut vertices of G µ so to form a path, their corresponding solutions can be efficiently merged to obtain a new set of solutions for node µ.
Basic definitions.We first introduce some basic definitions and tools.Seriesparallel graphs are graphs with two special vertices, called their poles, inductively defined as follows.An edge (s, t) is a series-parallel graph with poles s and t.Let G 0 , G 1 , . . ., G k be a sequence of series-parallel graphs (k ≥ 1) and let s i and t i be the poles of G i (i = 0, . . ., k).A series composition of G 0 , G 1 , . . ., G k is a series-parallel graph with poles s = s 0 and t = t k , containing each G i as a subgraph, and such that t i and s i+1 have been identified An SP Q-tree T of a series-parallel graph G is a tree, rooted at some node, representing the series (S-nodes) and parallel (P -nodes) compositions of G, as well as the single edges of G (Q-nodes) [18].Figures 5a and 5b show a seriesparallel graph and a corresponding SP Q-tree.The pertinent graph G µ of a node µ of T , is the series-parallel subgraph of G such that the subtree of T rooted at µ is an SP Q-tree of G µ .We will denote by s µ and t µ the poles of G µ .
A 2-tree is a graph obtained by starting from an edge and iteratively attaching a new vertex per time to two already adjacent vertices.A partial 2-tree is any subgraph of a 2-tree.It is known that the class of 2-trees coincides with the class of maximal series-parallel graphs [23], i.e., the series-parallel graphs that cannot be augmented with any edge while remaining series-parallel.Also, a graph is a partial 2-tree if and only if all its biconnected components are series-parallel graphs [5].

Testing (edge, 2)-colorability of Partial 2-Trees
We first describe an algorithm, called SPColorer, to test in linear time whether a biconnected series-parallel graph G admits an (edge, 2)-coloring; the extension to the case in which G is not biconnected will be presented later.The idea is to incrementally compute such a coloring (if any) by visiting bottom-up an SP Qtree T of G. Since the number of all feasible colorings for a given subgraph of G may be exponential in the size of the subgraph, we define an equivalence relation on the set of these colorings, and keep track of only one representative solution in each equivalence class during the visit.The relation is based on the following definitions.
Let G be a biconnected series-parallel graph and assume an (edge, 2)-coloring C exists for G.Call white and black the two colors of C, and for each vertex v of G we denote by N (v) be the set of its neighbors.If v is white (black) and N (v) contains no white (black) vertices (i.e., v has no incident colored edges), we say that v is of type W 0 (type B 0 ).If v is white (black) and N (v) contains one white (black) vertex (i.e., v has one incident colored edge), v is of type W 1 (type B 1 ).Let T be an SP Q-tree of G rooted at an arbitrary Q-node ρ, and let µ be a node of T .We say that two (edge, 2)-colorings C 1 and C 2 of the pertinent G µ of µ are equivalent if pole s µ (pole t µ ) is of the same type in C 1 and C 2 .Since we have four possible types for a vertex, this relation yields up to 16 equivalence classes of (edge, 2)-colorings for G µ .Each of these classes is represented in the following as a pair (X, Y ), where X and Y are the types of s µ and of t µ , respectively.Each element (i.e., each (edge, 2)-coloring) of an equivalence class is called a solution for G µ .An equivalence class is feasible if it contains at least one solution.
It is immediate to see that if C is an (edge, 2)-coloring of G and if C 1 is the restriction of C to G µ (hence, C 1 is a solution for G µ ), then replacing C 1 in C with any equivalent solution C 2 for G µ yields a valid (edge, 2)-coloring of G. Exploiting this property, algorithm SPColorer visits T bottom-up and, for each visited node µ of T , efficiently computes a set, called the feasible bag of µ and denoted by b µ , containing one (representative) solution from each feasible equivalence class of (edge, 2)-colorings of G µ .Hence, b µ contains at most 16 solutions.If b µ is empty, the algorithm halts and returns false.If the algorithm reaches the root ρ of T and b ρ is not empty, then it returns true and one of these solutions as a witness.
To compute b µ , we will make use of the following operation.Let ν 1 and ν 2 be two children of µ, and suppose µ is a P -node.Recall that s µ = s ν1 = s ν2 , and t µ = t ν1 = t ν2 .Let C 1 and C 2 be a solution for G ν1 and G ν2 , respectively, such that s ν1 and s ν2 (t ν1 and t ν2 ) have the same color in C 1 and C 2 .Let G * be the (series-parallel) subgraph of G µ obtained by the parallel composition of G ν1 and G ν2 .The union operation of C 1 and C 2 returns a solution C * for G * , obtained by merging C 1 and C 2 , provided that neither s µ nor t µ becomes incident to two colored edges in G * .An analogous operation is defined if µ is an S-node; in this case, t 1 and s 2 (which are identified in the composition) must have the same color in C 1 and C 2 and, after the merging, t 1 = s 2 must not be incident to two colored edges.In both cases, the union operation can be easily performed in constant time by representing each solution as an SP Q-tree of the corresponding pertinent graph and storing the types of the two poles.
We now prove, for each type of node µ, that the feasible bag b µ can be computed efficiently.
Lemma 1 Let µ be a non-root Q-node of T .The feasible bag b µ of µ can be computed in O(1) time.
Proof: Node µ is a leaf of T and G µ is an edge between the poles s µ and t µ .All and only the following equivalence classes are feasible for G µ : (W 1 , W 1 ), (B 1 , B 1 ), (W 0 , B 0 ), (B 0 , W 0 ).Each of these classes has only one possible solution, thus b µ is unique and can be computed in constant time.
Lemma 2 Let µ be a P -node of T .Let ν 1 , . . ., ν k , be the k ≥ 2 children of µ in T , whose corresponding feasible bags have been already computed.A feasible bag b µ of µ can be computed in O(k) time.
We first determine whether an equivalence class is feasible for G µ , and then compute a solution for it.
We start with the equivalence classes where both poles s µ and t µ are not incident to colored edges.Let (X, Y ) ∈ {(W 0 , W 0 ), (W 0 , B 0 ), (B 0 , W 0 ), (B 0 , B 0 )} be any of these classes.Clearly, (X, Y ) is feasible for G µ if and only if it is feasible for each G νi (i = 1, . . ., k).Also, if (X, Y ) is feasible for G νi (i = 1, . . ., k), then the union operation on the corresponding solutions provides a solution for G µ in class (X, Y ).
Consider now the equivalence classes in which there is only one pole (not both) incident to a colored edge.Assume that s µ is the pole incident to a colored edge (the other case is symmetric).It is easy to see that (X, Y ), with X ∈ {W 1 , B 1 } and Y ∈ {W 0 , B 0 }, is feasible for G µ if and only if there exists one bag b νi such that bag b νi contains a solution in class (X, Y ) and every bag different from b νi contains a solution in (W 0 , Y ), if X = W 1 , or in (B 0 , Y ), if X = B 1 .Again, if the condition is satisfied, the union operation on the corresponding solutions provides a solution for G µ in class (X, Y ).
Finally, consider the equivalence classes with both poles incident to a colored edge.Consider the class (W 1 , W 1 ); analogous arguments hold for the others.Class (W 1 , W 1 ) is feasible for G µ if and only if there exist either one bag b νi , with 1 ≤ i ≤ k, such that (i) bag b νi contains a solution in class (W 1 , W 1 ) and (ii) every bag different from b νi contains a solution in (W 0 , W 0 ), or two bags b νi and b νj , with 1 ≤ i, j ≤ k, such that (i) bag b νi contains a solution in class (W 1 , W 0 ), (ii) bag b νj contains a solution in class (W 0 , W 1 ), and (iii) every bag different from b νi and b νj contains a solution in (W 0 , W 0 ).If one of the two conditions holds, the union operation on the corresponding solutions gives a solution for G µ in (W 1 , W 1 ).
Since for each of the 16 classes there are k bags to check (each containing at most 16 representative solutions), and since the union operation takes constant time, bag b µ is computed in O(k) time.
Lemma 3 Let µ be an S-node of T .Let ν 1 , . . ., ν k , be the k ≥ 2 children of µ in T , whose corresponding feasible bags have been already computed.A feasible bag b µ of µ can be computed in O(k) time.
For the illustration, consider the class (W 0 , W 0 ) (the argument is analogous for the other classes).Let G i denote the graph resulting from the series composition of G ν1 , G ν2 , . . ., G νi .
At step i, for 1 ≤ i ≤ k − 1, consider the graphs G i and G νi+1 .Let b i be a bag containing one solution for each class (W 0 , Y ) that is feasible for G i (where Y can be any type).Such a bag is computed in the previous step if i > 1, or it coincides with b ν1 if i = 1.Then, we compute a bag b i+1 containing one solution for each class that is feasible for G i+1 , as follows.A class (W 0 , Z) (where Z can be any type) is feasible for G i+1 if there exist a class (W 0 , Y ) that is feasible for G i and a class (X, Z) that is feasible for G νi+1 such that either X = W 0 and Y ∈ {W 0 , W 1 }, or Y = W 0 and X ∈ {W 0 , W 1 }, or X = B 0 and Y ∈ {B 0 , B 1 }, or Y = B 0 and X ∈ {B 0 , B 1 }, that is, X and Y are such that t νi and s νi+1 have the same color and at most one of them is incident to a colored edge.If (W 0 , Z) is decided as feasible, the union operation on the corresponding solutions gives a solution for G i in (W 0 , Z).
Finally, since G k corresponds to G µ , then (W 0 , W 0 ) is feasible for G µ if and only if b k contains a representative solution in (W 0 , W 0 ).Computing b k for each class takes O(k) time, and this computation is done 16 times.Hence, b µ is computed in O(k) time.
Lemma 4 Let ρ be the root of T .Let ξ be the (only) child of ρ in T , whose corresponding feasible bag has been computed.A feasible bag b ρ of ρ can be computed in O(1) time.
In all the other cases, do not add any class to b ρ .
Lemmas 1-4 and the fact that an SP Q-tree T of G has O(n) nodes imply the following result.
Lemma 5 Let G be an n-vertex biconnected series-parallel graph.There exists an O(n)-time algorithm that decides whether G admits an (edge, 2)-coloring.
Extension to non-biconnected graphs.In the following, we extend the result of Lemma 5 to every partial 2-tree G. Let B be the set of blocks (i.e., biconnected components) of G.As already pointed out, each block in B is a biconnected series-parallel graph.Let C be the set of cutvertices of G. Construct a tree T with vertex set B ∪ C in which the edges are defined as follows: c ∈ C is adjacent to b ∈ B if and only if the block b contains c.Tree T is called the block-cutvertex tree of G, or simply the BC-tree of G. Furthermore, observe that the union operation on two solutions can be naturally extended to the case when the two corresponding subgraphs G ν1 and G ν2 share only one (cut) vertex.
Theorem 4 Let G be an n-vertex partial 2-tree.There exists an O(n)-time algorithm that decides whether G admits an (edge, 2)-coloring.
Proof: If G is biconnected, then the statement follows by Lemma 5. Otherwise, let T be the BC-tree of G, rooted at an arbitrary cutvertex.We visit T bottomup and apply SPColorer to each block of G.In order to obtain a consistent and valid coloring for the cutvertices, we extend SPColorer so to handle additional inter-block constraints, as described below for the different types of nodes of T .
Let Every time a node µ of T b is visited such that one of the two poles is a cutvertex c i (1 ≤ i ≤ k), we need to ensure that c i receives a valid color with respect to all the other blocks attached to c i , as follows.
Assume that c i coincides with pole s µ , the other case is symmetric.For each class (X, Y ) such that the feasible bag b µ contains a solution in this class, we perform the following operation.Suppose that X = W 0 (that X = B 0 ).Remove the solution corresponding to (X, Y ) from b µ ; then, for each Z ∈ {W 0 , W 1 } (for each Z ∈ {B 0 , B 1 }), if the cutvertex bag B ci contains a solution in which c i is of type Z, then add to b µ a solution for class (Z, Y ), obtained by applying the union between the solution in which c i is of type Z and the one corresponding to (X, Y ).Suppose that X = W 1 (that X = B 1 ).Remove the solution corresponding to (X, Y ) from b µ ; then, if B ci contains a solution in which c i is of type W 0 , then add to b µ a solution for class (X, Y ), again obtained by applying the union between the corresponding solutions.At the end of this procedure there may exist two solutions that belong to the same class; we pick one arbitrarily.Again, if SPColorer returns false, then a solution does not exist for G as well.

Testing (star, 2)-colorability of Partial 2-Trees
We now turn our attention to the (star, 2)-coloring problem by extending the test for partial 2-trees provided in Section 3.1 to this problem.
Let T be an SP Q-tree of G rooted at an arbitrary Q-node ρ, and let µ be a node of T .We maintain the same definition of equivalence between two colorings of C 1 and C 2 of G µ as in the (edge, 2)-coloring case, with the only difference that the set of possible types of the poles has to be larger in this case, in order to encompass all the possible configurations that may arise in a (star, 2)-coloring.Namely a pole of µ, say s µ , in a (star, 2)-coloring can be of the following types: (i) W 0 : pole s µ is white and no vertex in N (s µ ) is white (the monochromatic component containing s µ is an isolated vertex) (ii) W 1 : pole s µ is white, there exists exactly one white vertex w in N (s µ ), and N (w) contains at least one white vertex different from s µ (the monochromatic component containing s µ is a star with center w, and s µ is one of its leaves) (iii) W 2 : pole s µ is white and either there exists more than one white vertex in N (s µ ) or there exists exactly one white vertex w in N (s µ ), which is not t µ and has no white neighbor different from s µ (the monochromatic component containing s µ is a star and s µ is its center) (iv) W 3 : pole s µ is white and the only white vertex in N (s µ ) is t µ , which has no white neighbor other than s µ (the monochromatic component containing s µ only consists of edge (s µ , t µ ), and it is still undecided which of them is the center).Types B 0 , . . ., B 3 are defined analogously, with color black instead of white.
Note that there exist eight possible types for a vertex; however, a pole is of type either W 3 or B 3 if and only if the other pole is of the same type.This implies that the total number of equivalence classes of (edge, 2)-colorings for G µ is 38.Recall that an equivalence class of a (star, 2)-coloring is represented by a pair (X, Y ), where X and Y are the types of s µ and t µ , respectively.In the following, a pair of the form (X, •) will be used to denote an equivalence class in which s µ is of type X, while t µ can be of any type.Pair (•, Y ) is defined analogously.
Based on the property that the number of equivalence classes is still bounded by a constant, we provide a linear-time algorithm to test the existence of a (edge, 2)-coloring of a partial 2-tree that works along the same lines as algorithm SPColorer.In the following we show how to compute in constant time the feasible bag b µ of µ of a node µ ∈ T starting from the feasible bags of the children of µ.
Lemma 6 Let µ be a non-root Q-node of T .The feasible bag b µ of µ can be computed in O(1) time.
Proof: Node µ is a leaf of T and G µ is an edge between the poles s µ and t µ .Only the following equivalence classes are feasible for G µ : (W 0 , B 0 ), (B 0 , W 0 ), (W 3 , W 3 ), (B 3 , B 3 ).Each of these classes has only one possible solution, thus b µ is unique and can be computed in constant time.
Lemma 7 Let µ be a P -node of T .Let ν 1 , . . ., ν k , be the k ≥ 2 children of µ in T , whose corresponding feasible bags have been already computed.A feasible bag b µ of µ can be computed in O(k) time.
We first determine whether an equivalence class is feasible for G µ , and then compute a solution for it.
In the following, we consider a pole of µ, say s µ , and for each possible type T 0 , . . ., T 3 , with T ∈ {W, B}, we discuss which are the conditions on the classes contained in the feasible bags of ν 1 , . . ., ν k that have to be satisfied in order for s µ to be of that type.Testing whether a certain equivalence class (X, Y ) is feasible for G µ can be done by combining the conditions that have to be satisfied in order for s µ to be type X and t µ to be type Y , in the same way as in the last part of the proof of Lemma 2.
• Pole s µ can be of type T 0 (that is, it is not incident to any colored edge) if and only if each bag b νi , with 1 ≤ i ≤ k, contains a solution in class (T 0 , •).
• Pole s µ can be of type T 1 (that is, it is a leaf of a colored star) if and only if at least one of the following conditions is satisfied: -there exists a child ν h of µ such that bag b ν h contains a solution in a class (T 1 , •) and each bag b νi , with 1 ≤ i = h ≤ k, contains a solution in a class (T 0 , •); or -there exist two children ν h and ν z of µ such that bag b ν h contains a solution in a class (T 3 , T 3 ), bag b νz contains a solution in class (T 0 , T 2 ), and each bag b νi , with 1 ≤ i = h, z ≤ k, contains a solution in a class either (T 0 , T 0 ) or (T 0 , T 2 ).
• Pole s µ can be of type T 2 (that is, it is the center of a colored star) if and only if at least one of the following conditions is satisfied: • Pole s µ can be of type T 3 (that is, it is still undecided whether it is a leaf or a center of a colored star) if and only if there exists a child ν h of µ such that bag b ν h contains a solution in a class (T 3 , T 3 ) and each bag b νi , with 1 ≤ i = h ≤ k, contains a solution in class (T 0 , T 0 ).
Once an equivalence class (X, Y ) has been positively tested by checking the corresponding conditions to hold at the same time for both the poles, the union operation on the solutions for the children of µ provides a solution for G µ in class (X, Y ).
Since for each of the 38 classes there are k bags to check (each containing at most 38 representative solutions), and since the union operation takes constant time, bag b µ is computed in O(k) time.Proof: Recall that s µ = s ν1 , t ν1 = s ν2 , . . ., t ν k−1 = s ν k , t ν k = t µ .We first determine whether an equivalence class is feasible for G µ , and then compute a solution for it.
For each equivalence class (X, Y ) we test whether it is feasible for G µ by selecting a class (X i , Y i ) in the feasible bag of each child ν i , with i = 1, . . ., k, such that: (A) X = X 1 .(B) Y = Y k .(C) For any two consecutive children µ i and µ i+1 , we have that t µi and s µi+1 have the same color and, if For any three consecutive children µ i−1 , µ i , and µ i+1 , we have that t µi−1 and s µi have the same color, t µi and s µi+1 have the same color, and if X i = Y i = W 3 , then at least one of Y i−1 and X i+1 is W 0 , while the other one is W 0 or W 2 or W 3 ; analogously, if X i = Y i = B 3 , then at least one of Y i−1 and X i+1 is B 0 , while the other one is B 0 or B 2 or B 3 .
Note that the first two conditions ensure that the coloring belongs to (X, Y ), while the other two ensure that it is a valid (star, 2)-coloring.The test can be performed in O(k) time using a technique similar to the one used in Lemma   Before describing the (star, 2)-coloring algorithm, we observe that it is easy to construct an outerpath not admitting any (edge, 2)-coloring.In fact, consider a graph G composed of a path P with six vertices and of an additional vertex v connected to all the vertices of P .Since the weak dual of G is a path with five vertices, G is an outerpath.Also, in any (edge, 2)-coloring of G there exists at most one vertex of P with the same color as v; hence, at least three consecutive vertices of P must have the same color, and hence G does not admit any (edge, 2)-coloring.
We now describe the (star, 2)-coloring algorithm.Let G be an outerpath.We assume that G is inner-triangulated.This is not a loss of generality, as any (star, 2)-coloring of a triangulated outerpath induces a (star, 2)-coloring of any of its subgraphs.We first give some definitions; refer to Figure 6b.We call spine vertices the vertices v 1 , v 2 , . . ., v m with degree at least 4 in G.We consider an additional spine vertex v m+1 , which is the (unique) neighbor of v m along the cycle delimiting the outer face that is not adjacent to v m−1 .Note that the spine vertices of G induce a path, that we call spine of G4 .The fan f i of a spine vertex v i consists of the set of neighbors of v i in G, except for v i−1 and for those following and preceding v i along the cycle delimiting the outer face5 ; note that |f i | ≥ 1 for each i = 1, . . ., m, while |f m+1 | = 0.For each i = 1, . . ., m + 1, we denote by G i the subgraph of G induced by the spine vertices v 1 , . . ., v i and by the fans f 1 , . . ., f i−1 .Note that G m+1 = G.We denote by c i the color assigned to spine vertex v i , and by c(G i ) a coloring of graph G i .Recall that an edge of G is called colored if its two endpoints have the same color.
Theorem 6 Every outerpath admits a (star, 2)-coloring, which can be computed in linear time.
Proof: Let G be an outerpath with spine v 1 , . . ., v k .We describe an algorithm  If the label contains two characters, the second one describes the cardinality of f i+1 .An edge between Q j and Q h with label x ∈ {1, e, o} (with label xy, where y ∈ {0, 1, e, o}) represents the fact that, if to compute a (star, 2)-coloring of G.At each step i = 1, . . ., k of the algorithm we consider the spine edge (v i−1 , v i ), assuming that a (star, 2)-coloring of G i has already been computed satisfying one of the following conditions (see Figure 7): is the center of a star with color c i−1 , and no colored edge is incident to v i ; is a leaf of a star with color c i−1 , and no colored edge is incident to v i ; is the center of a star with color c i−1 , and vertex v i is the center of a star with color c i ; further, i < k and |f i | > 1; is the center of a star with color c i−1 , and no colored edge other than Next, we color the vertices in f i in such a way that c(G i+1 ) is a (star, 2)coloring satisfying one of the conditions; refer to Figure 7 for a schematization of the case analysis.In the first step of the algorithm, we assign an arbitrary color to v 1 , and hence c(G 1 ) satisfies Q 0 .For i = 1, . . ., k we color f i depending on the condition satisfied by c(G i ).Coloring c(G i ) satisfies Q 0 : Independently of the cardinality of f i , we color its vertices with alternating colors so that c i+1 = c i .In this way, the only possible colored edges are incident to v i and not to v i+1 .So, c(G i+1 ) satisfies condition Q 1 .Coloring c(G i ) satisfies Q 1 : In this case we distinguish the following subcases, based on the cardinality of f i .
• If |f i | = 0, we have that i = k and hence G k = G.It follows that c(G k ) is a (star, 2)-coloring of G.
• If |f i | = 1 (that is, f i contains only v i+1 ; see Figure 8a), we set c i+1 = c i .Since the only neighbor of v i+1 in G i+1 different from v i is v i−1 , whose color is c i−1 = c i , and since v i has no neighbor with color c i other than v i+1 , by condition Q 1 , coloring c(G i+1 ) is a (star, 2)-coloring satisfying condition Q 2 .
• If |f i | > 1 (see Figure 8b), we color the vertices in f i with alternating colors so that c i+1 = c i .This implies that every colored edge of G i+1 not belonging to G i is incident either to v i , if its color is c i , or to v i−1 , if its color is c i−1 ; the latter case only happens if |f i | is odd.Thus, v i (resp.v i−1 ) is the center of a star of color c i (resp.c i−1 ) in G i+1 .Since v i has no neighbor with color c i in G i , while v i−1 is a center also in G i , coloring c(G i+1 ) is a (star, 2)-coloring.Finally, since v i+1 has no neighbors with color c i+1 = c i , by construction, c(G i+1 ) satisfies condition Q 1 .
Coloring c(G i ) satisfies Q 2 : We again distinguish subcases based on |f i |.
• If |f i | = 0, we have that i = k and hence c(G k ) is a (star, 2)-coloring of G = G k .
• If |f i | is odd, including the case |f i | = 1 (see Figure 8c), we color the vertices of f i with alternating colors in such a way that c i+1 = c i .By construction, c(G i+1 ) is a (star, 2)-coloring satisfying condition Q 1 .
• If |f i | is even and different from 0, instead, we have to consider the cardinality of f i+1 in order to decide the coloring of f i .We distinguish three subcases: |f i+1 | = 0 : Note that in this case i = k holds (see Figure 8d).We color the vertices of f i with alternating colors so that c i+1 = c i .Note that the unique neighbor of v i−1 in f i has color different from c i−1 , since |f i | is even.Hence, all the new colored edges are incident to v i , which implies that c(G i+1 ) is a (star, 2)-coloring satisfying condition Q 2 .
|f i+1 | = 1 : Note that i < k and f i+1 only contains v i+2 (see Figure 8e).We color the vertices of f i with alternating colors so that c i+1 = c i .Since (i) all the new colored edges are incident to v i , (ii) v i and v i−1 have no neighbor with their same color in G i (apart from each other), (iii) c i+1 = c i , and (iv) i < k, we have that c(G i+1 ) is a (star, 2)-coloring satisfying condition Q 5 .
|f i+1 | > 1 : Note that i < k (see Figure 8f).Independently of whether |f i+1 | is even or odd, we color the vertices of f i so that c i+1 = c i , the unique neighbor of v i+1 different from v i has also color c i+1 , and all the other vertices have alternating colors.Since each new colored edge is incident to either v i or v i+1 , since c i+1 = c i , and since i < k, coloring c(G i+1 ) is a (star, 2)-coloring satisfying condition Q 4 .
Coloring c(G i ) satisfies Q 3 : • If |f i | = 0, we have that i = k and hence c(G k ) is a (star, 2)-coloring of G = G k .
• If |f i | = 1 (that is, f i contains only v i+1 ; see Figure 9a), we set c i+1 = c i .As in the analogous case in which c(G i ) satisfies condition Q 1 , we can prove that c(G i+1 ) is a (star, 2)-coloring which satisfies condition Q 2 .
• If |f i | is even and different from 0 (see Figure 9b), we color the vertices of f i with alternating colors in such a way that c i+1 = c i .By construction, c(G i+1 ) is a (star, 2)-coloring which satisfies condition Q 1 .
• If |f i | is odd and different from 1, we again consider the cardinality of f i+1 in order to decide the coloring of f i .For the four possible classes of values of |f i+1 |, the coloring strategy and the condition satisfied by the resulting coloring c(G i+1 ) are the same as for the analogous case in which c(G i ) satisfies Q 2 and |f i | is even.

Figure 4 :
Figure 4: (a) The complete graph on six vertices K 6 .(b) The attachment gadget for the planar case.

Figure 5 :
Figure 5: (a) A series-parallel graph G. (b) The SP Q-tree T of G.Each S-and P -node is labeled with the poles of the corresponding subgraph.Each Q-node is labeled with the edge it represents.
b be a leaf of T (associated with a block of G) and let c b be the cutvertex corresponding to the parent of b in T .Root the SP Q-tree T b of b at a Q-node having c b as a pole, and apply SPColorer to b.If SPColorer returns false, then a solution does not exist for G as well.If SPColorer returns true, let the block bag B b of b coincide with the feasible bag associated with the root node of T b .Let c be a cutvertex of T and let b 1 , b 2 , . . ., b k be the k ≥ 1 blocks that are children of c in T .Let the cutvertex bag B c of c be a set of solutions computed as follows.If all the block bags B bi , for 1 ≤ i ≤ k, contain at least one solution where c is of type W 0 (resp., B 0 ), then apply the union operation on these solutions and add it to B c .If all the block bags B bi , for 1 ≤ i ≤ k, contain at least one solution where c is of type W 0 (resp., B 0 ), except for one block bag which contains a solution where c is of type W 1 (resp., B 1 ) then apply the union operation on these solutions and add it to B c .Clearly, B c contains at most four solutions.If B c is empty, then the algorithm halts and returns false.If c is the root of T and B c contains at least one solution C, then the algorithm returns true and C as a witness.Let b be a block of G that is not a leaf of T , and let c b be the cutvertex corresponding to the parent of b in T .Let c 1 , . . ., c k be the k ≥ 1 cutvertices that correspond to the children of b in T .Root the SP Q-tree T b of b at a Q-node having c b as a pole.We apply SPColorer to b with the following modification.
If SPColorer returns true, then let the block bag B b of b be the feasible bag of the root of T b .The time complexity of the algorithm is O(n), as for each block b with n b vertices we spend O(n b ) time to compute its block bag by Lemma 5 (including the operations at cutvertices); for each cutvertex c with n c children in T we spend O(n c ) time to compute its cutvertex bag; and ∀b∈B n b + ∀c∈C n c = O(n).
there exists a child ν h of µ such that bag b ν h contains a solution in class (T 2 , •) and each bag b νi , with 1 ≤ i = h ≤ k, contains a solution in a class either (T 0 , •) or (T 2 , •); or -there exist two children ν h and ν z of µ such that bag b ν h contains a solution in a class (T 3 , T 3 ), bag b νz contains a solution in class (T 2 , T 0 ), and each bag b νi , with 1 ≤ i = h, z ≤ k, contains a solution in a class either (T 0 , T 0 ) or (T 2 , T 0 ).

Lemma 8
Let µ be an S-node of T .Let ν 1 , . . ., ν k , be the k ≥ 2 children of µ in T , whose corresponding feasible bags have been already computed.A feasible bag b µ of µ can be computed in O(k) time.

Figure 6 :
Figure 6: (a) An outerplanar graph that is not (star, 2)-colorable.(b) An outerpath, whose spine edges are drawn as dashed segments.Dotted arcs highlighted in gray correspond to edges belonging to the fan of each spine vertex.Note that |f 6 | = 0.

Figure 7 :
Figure7: Schematization of the algorithm.Each node represents the (unique) condition satisfied by G i at some step 0 ≤ i ≤ k.An edge label 0, 1, e, o represents the fact that the cardinality of a fan f i is 0, 1, even = 0, or odd = 1.If the label contains two characters, the second one describes the cardinality of f i+1 .An edge between Q j and Q h with label x ∈ {1, e, o} (with label xy, where y ∈ {0, 1, e, o}) represents the fact that, ifG i satisfies condition Q j and |f i | = x (resp.|f i | = x and |f i+1 | = y), then f i is colored so that G i+1 satisfies Q h .

Figure 9 :
Figure 9: Graph G i+1 after coloring f i when c(G i ) satisfies: Q 3 and (a) |f i | = 1, or (b) |f i | = e; Q 4 (c); or Q 5 (d).Shaded regions represent G i .Bold edges connect vertices with the same color, while spine edges are dashed.
3.Repeating the test for all the 38 classes yields a total O(k) running time to compute b µ .