Editing to a Graph of Given Degrees
aa r X i v : . [ c s . D S ] D ec Editing to a Graph of Given Degrees ∗ Petr A. Golovach † Abstract
We consider the
Editing to a Graph of Given Degrees prob-lem that asks for a graph G , non-negative integers d, k and a function δ : V ( G ) → { , . . . , d } , whether it is possible to obtain a graph G ′ from G such that the degree of v is δ ( v ) for any vertex v by at most k vertexor edge deletions or edge additions. We construct an FPT-algorithmfor Editing to a Graph of Given Degrees parameterized by d + k .We complement this result by showing that the problem has no poly-nomial kernel unless NP ⊆ coNP / poly. The aim of graph editing or modification problems is to change a given graphby applying a bounded number of specified operations in order to satisfy acertain property. Many basic problems like
Clique , Independent Set or Feedback (Edge or Vertex) Set can be seen as graph editing problems.It is common to allow combinations of vertex deletions, edge deletions andedge additions, but other operations, like edge contractions, are consideredas well.The systematic study of the vertex deletion problems was initiated byLewis and Yannakakis [16]. They considered hereditary non-trivial prop-erties. A property is hereditary if it holds for any induced subgraph of agraph that satisfy the property, and a property is non-trivial if it is truefor infinitely many graphs and false for infinitely many graphs. Lewis andYannakakis [16] proved that for any non-trivial hereditary property, the cor-responding vertex deletion problem is NP-hard, and for trivial propertiesthe problem can be solved in polynomial time. The edge deletion prob-lems were considered by Yannakakis [23], Alon, Shapira and Sudakov [1].The case when edge additions and deletions are allowed and the property is ∗ The research leading to these results has received funding from the European Re-search Council under the European Union’s Seventh Framework Programme (FP/2007-2013)/ERC Grant Agreement n. 267959. Preliminary version of the paper appeared inthe proceeding of IPEC 2014. † Department of Informatics, University of Bergen, PB 7803, 5020 Bergen, Norway.E-mail: [email protected] ? ] for related results).In particular, Mathieson and Szeider [17] considered different variants ofthe following problem: Editing to a Graph of Given Degrees
Instance:
A graph G , non-negative integers d, k and a function δ : V ( G ) → { , . . . , d } . Parameter 1: d . Parameter 2: k . Question:
Is it possible to obtain a graph G ′ from G such that d G ′ ( v ) = δ ( v ) for each v ∈ V ( G ′ ) by at most k operations from the set S ?They classified the parameterized complexity of the problem for S ⊆ { vertex deletion , edge deletion , edge addition } . They showed that
Editing to a Graph of Given Degrees is W[1]-hard when parameterized by k and the unparameterized version is NP-complete if vertex deletion is in S . If S ⊆ { edge deletion , edge addition } ,then the problem can be solved in polynomial time. For { vertex deletion } ⊆ S ⊆ { vertex deletion , edge deletion , edge addition } , they proved that Edit-ing to a Graph of Given Degrees is Fixed Parameter Tractable (FPT)when parameterized by d + k . Moreover, the FPT result holds for a moregeneral version of the problem where vertices and edges have costs and thedegree constraints are relaxed: for each v ∈ V ( G ′ ), d G ′ ( v ) should be in agiven set δ ( v ) ⊆ { , . . . , d } . The proof given by Mathieson and Szeider [17]uses a logic-based approach that does not provide practically feasible algo-rithms. They used the observation that Editing to a Graph of GivenDegrees can be reduced to the instances with graphs whose degrees are2ounded by a function of k and d . By a result of Seese [22], the problem ofdeciding any property that can be expressed in first-order logic is FPT forgraphs of bounded degree when parameterized by the length of the sentencedefining the property. In particular, to obtain their FPT-result, Mathiesonand Szeider constructed a non-trivial first-order logic formula that expressesthe property that a graph with vertices of given degrees can be obtained by atmost k editing operations. For the case S ⊆ { vertex deletion , edge deletion } ,they improved the aforementioned result by showing that Editing to aGraph of Given Degrees has a polynomial kernel when parameterizedby d + k . Some further results were recently obtained by Froese, Nichterleinand Niedermeier [ ? ].In Section 3 we construct an FPT-algorithm for Editing to a Graphof Given Degrees parameterized by k + d for the case when S includesvertex deletion and edge addition that runs in time 2 O ( kd + k log k ) · poly ( n )for n -vertex graphs, i.e., we give the first constructive algorithm for theproblem. Our algorithm is based on the random separation techniquesintroduced by Cai, Chan and Chan [8]. We complement this result byshowing in Section 4 that Editing to a Graph of Given Degrees pa-rameterized by k + d has no polynomial kernel unless NP ⊆ coNP / polyif { vertex deletion , edge addition } ⊆ S . This resolves an open problem byMathieson and Szeider [17]. The proof uses the cross-composition frameworkintroduced by Bodlaender, Jansen and Kratsch [ ? ]. Graphs.
We consider only finite undirected graphs without loops or mul-tiple edges. The vertex set of a graph G is denoted by V ( G ) and the edgeset is denoted by E ( G ).For a set of vertices U ⊆ V ( G ), G [ U ] denotes the subgraph of G inducedby U , and by G − U we denote the graph obtained form G by the removalof all the vertices of U , i.e., the subgraph of G induced by V ( G ) \ U . If U = { u } , we write G − u instead of G − { u } . Respectively, for a set of edges L ⊆ E ( G ), G [ L ] is a subgraph of G induced by L , i.e, the vertex set of G [ L ]is the set of vetices of G incident to the edges of L and L is the set of edgesof G [ L ]. For a non-empty set U , (cid:0) U (cid:1) is the set of unordered pairs of elementsof U . For a set of edges L , by G − L we denote the graph obtained from G by the removal of all the edges of L . Respectively, for L ⊆ (cid:0) V ( G )2 (cid:1) , G + L isthe graph obtained from G by the addition of the edges that are elementsof L . If L = { a } , then for simplicity, we write G − a or G + a .For a vertex v , we denote by N G ( v ) its (open) neighborhood , that is, theset of vertices which are adjacent to v , and for a set U ⊆ V ( G ), N G ( U ) =( ∪ v ∈ U N G ( v )) \ U . The closed neighborhood N G [ v ] = N G ( v ) ∪ { v } , and fora positive integer r , N rG [ v ] is the set of vertices at distance at most r from3 . For a set U ⊆ V ( G ) and a positive integer r , N rG [ U ] = ∪ v ∈ U N rG [ v ]. The degree of a vertex v is denoted by d G ( v ) = | N G ( v ) | .A walk in G is a sequence P = v , e , v , e , . . . , e s , v s of vertices andedges of G such that v , . . . , v s ∈ V ( G ), e , . . . , e s ∈ E ( G ), and for i ∈ { , . . . , s } , e i = v i − v i ; v , v s are the end-vertices of the walk, and v , . . . , v s − are the internal vertices. A walk is closed if v = v s . Some-times we write P = v , . . . , v s to denote a walk P = v , e , . . . , e s , v s omittingedges. A walk is a trail if e a , . . . , e s are pairwise distinct, and a trail is a path if v , . . . , v s are pairwise distinct except maybe v , v s . Parameterized Complexity.
Parameterized complexity is a two dimen-sional framework for studying the computational complexity of a problem.One dimension is the input size n and another one is a parameter k . It issaid that a problem is fixed parameter tractable (or FPT), if it can be solvedin time f ( k ) · n O (1) for some function f . A kernelization for a parameterizedproblem is a polynomial algorithm that maps each instance ( x, k ) with theinput x and the parameter k to an instance ( x ′ , k ′ ) such that i) ( x, k ) is aYES-instance if and only if ( x ′ , k ′ ) is a YES-instance of the problem, and ii)the size of x ′ is bounded by f ( k ) for a computable function f . The output( x ′ , k ′ ) is called a kernel . The function f is said to be a size of a kernel.Respectively, a kernel is polynomial if f is polynomial. We refer to the booksof Downey and Fellows [11], Flum and Grohe [12], and Niedermeier [21] fordetailed introductions to parameterized complexity. Solutions of Editing to a Graph of Given Degrees.
Let (
G, δ, d, k ) bean instance of
Editing to a Graph of Given Degrees . Let U ⊂ V ( G ), D ⊆ E ( G − U ) and A ⊆ (cid:0) V ( G ) \ U (cid:1) . If the vertex deletion, edge deletionor edge addition is not in S , then it is assumed that U = ∅ , D = ∅ or A = ∅ respectively. We say that ( U, D, A ) is a solution for (
G, δ, d, k ), if | U | + | D | + | A | ≤ k , and for the graph G ′ = G − U − D + A , d G ′ ( v ) = δ ( v )for v ∈ V ( G ′ ). We also say that G ′ is obtained by editing with respect to( U, D, A ). FPT -algorithm for Editing to a Graph of GivenDegrees
Throughout this section we assume that S = { vertex deletion , edge deletion , edge addition } , i.e., the all three editing operations are allowed, unless weexplicitly specify the set of allowed operations. We prove the followingtheorem. Theorem 1.
Editing to a Graph of Given Degrees can be solved intime O ( kd + k log k ) · poly ( n ) for n -vertex graphs. .1 Preliminaries We need the following corollary of the results by Mathieson and Szeiderin [17].
Lemma 1.
Editing to a Graph of Given Degrees can be solved intime O ∗ (2 n ) for n -vertex graphs.Proof. Mathieson and Szeider in [17] proved that
Editing to a Graph ofGiven Degrees can be solved in polynomial time if only edge deletion andedge additions are allowed. Since the set of deleted vertices of a hypotheticalsolution (
U, D, A ) of
Editing to a Graph of Given Degrees can beguessed by brute force and we have at most 2 n possibilities to choose thisset, we can reduce Editing to a Graph of Given Degrees to the casewhen only edge deletion and edge additions are allowed by choosing anddeleting U , and then solve the problem in polynomial time.We also need some structural results about solutions of Editing to aGraph of Given Degrees when only edge deletion and edge additionsare used.We say that a solution (
U, D, A ) of
Editing to a Graph of GivenDegrees is minimal if there is no solution ( U ′ , D ′ , A ′ ) = ( U, D, A ) suchthat U ′ ⊆ U , D ′ ⊆ D and A ′ ⊆ A .Let ( G, δ, d, k ) be an instance of
Editing to a Graph of Given De-grees such that for every v ∈ V ( G ), d G ( v ) ≤ δ ( v ). Let also ( U, D, A ) bea solution for (
G, δ, d, k ) such that U = ∅ , and let G ′ = G − D + A . Wesay that a trail P = v , e , v , e , . . . , e s , v s in G ′ is ( D, A ) -alternating if e , . . . , e s ⊆ D ∪ A , and for any i ∈ { , . . . , s } , either e i − ∈ D, e i ∈ A or e i − ∈ A, e i ∈ D . We also say that P is a degree increasing trail if e , e s ∈ A .Let H ( D, A ) be the graph with the edge set D ∪ A , and the vertex set of H consists of the vertices of G incident to the edges of D ∪ A . Lemma 2.
Let ( G, δ, d, k ) be an instance of Editing to a Graph ofGiven Degrees such that for every v ∈ V ( G ) , d G ( v ) ≤ δ ( v ) , and let Z = { v ∈ V ( G ) | d G ( v ) = δ ( v ) } . For any minimal solution ( U, D, A ) for ( G, δ, d, k ) such that U = ∅ , the graph H ( D, A ) can be covered by a familyof edge-disjoint degree increasing ( D, A ) -alternating trails T (i.e., each edgeof D ∪ A is in the unique trail of T ) with their end-vertices in Z .Proof. Observe that because for v ∈ V ( G ) \ Z , d G ( v ) = δ ( v ), we havethat |{ e ∈ D | e is incident to v }| = |{ e ∈ A | e is incident to v }| for each v ∈ V ( H ( D, A )) \ Z . It implies that H ( D, A ) can be covered by a family ofof edge-disjoint (
D, A )-alternating trails T such that for every vertex of v ∈ V ( H ( D, A )) \ Z , each trails enters v exactly the same number times asit leaves v . Assume that T is chosen in such a way that the number of trailsis minimum. If T contains a trail P such that V ( P ) ∩ Z = ∅ , then P has5ven length, and if we delete the edges of P from D and A respectively, weobtain another solution for ( G, δ, d, k ), but this contradicts the minimalityof (
U, D, A ). Hence, we can assume that each trail has its end-vertices in Z . Suppose that for v ∈ Z , there is a trail P ∈ T such that the first orlast edge e of P is incident to v and e ∈ D . Because d G ( v ) < δ ( v ), there isanother trail P ′ ∈ T such that P ′ starts or ends in v , and respectively thefirst or lase edge e ′ of P is in A . If P = P ′ , then again we have that P haseven length, and the deletion of the edges of P from D and A gives anothersolution for ( G, δ, d, k ) contradicting the minimality of (
U, D, A ). We havethat P = P ′ , but then we replace P and P ′ in T by their concatenation via v and cover H ( D, A ) by |T | − T .Therefore, for each P ∈ T , the first and last edges of P are in A , i.e., P isa degree increasing ( D, A )-alternating trail.Using this lemma we obtain the following structural result.
Lemma 3.
Let ( G, δ, d, k ) be an instance of Editing to a Graph ofGiven Degrees such that for every v ∈ V ( G ) , d G ( v ) ≤ δ ( v ) , and let Z = { v ∈ V ( G ) | d G ( v ) = δ ( v ) } . Suppose that G has r = ⌊ k ⌋ distinct edges x y , . . . , x r y r that form a matching such that all x , . . . , x r and y , . . . , y r are distinct from the vertices of Z and not adjacent to the vertices of Z . Ifthere is a solution for ( G, δ, d, k ) with the empty set of deleted vertices, thenthe instance has a solution ( U, D, A ) such thati) U = ∅ ,ii) either D = ∅ or D = { x y , . . . , x h y h } for some h ∈ { , . . . , r } ,iii) for every uv ∈ A , either u, v ∈ Z or uv joins Z with some vertex of { x , . . . , x h } ∪ { y , . . . , y h } ,iv) for every i ∈ { , . . . , h } , A has the unique edges ux i , vy i such that u, v ∈ Z .Proof. Consider a minimal solution (
U, D, A ) for (
G, δ, d, k ) such that U = ∅ .By Lemma 2, H ( D, A ) can be covered by a family of edge-disjoint degreeincreasing (
D, A )-alternating trails T with their end-vertices in Z . Let P , . . . , P h be the trails that have at least one edge from D . Because each P i has at least three edges, h ≤ r . For each P i , denote by u i , v i ∈ Z itsend-vertices. For i ∈ { , . . . , h } , we replace P i by u i x i y i v i . Notice that u i x i , y i v i / ∈ E ( G ) and x i y i ∈ E ( G ). Respectively, we replace the edges of P i in A by u i x i , y i v i , and the edges of P i in D by x i y i . It remains to observethat this replacement gives us the solution that satisfies i)-iv).6 .2 The algorithm We construct an FPT-algorithm for
Editing to a Graph of Given De-grees parameterized by k + d . The algorithm is based on the randomseparation techniques introduced by Cai, Chan and Chan [8] (see also [2]).Let ( G, δ, d, k ) be an instance of
Editing to a Graph of Given De-grees , and let n = | V ( G ) | . Preprocessing.
At this stage of the algorithm our main goal is to reducethe original instance of the problem to a bounded number of instances withthe property that for any vertex v , the degree of v is at most δ ( v ).First , we make the following observation. Lemma 4.
Let ( U, D, A ) be a solution for ( G, δ, d, k ) . If d G ( v ) > δ ( v ) + k for v ∈ V ( G ) , then v ∈ U .Proof. Suppose that v / ∈ U . Then to obtain a graph G ′ with d G ′ ( v ) = δ ,for at least k + 1 neighbors u of v , we should either delete u or delete uv .Because the number of editing operations is at most k , we immediatelyobtain a contradiction that proves the lemma.By Lemmas 4, we apply the following rule. Vertex deletion rule. If G has a vertex v with d G ( v ) > δ ( v ) + k , thendelete v and set k = k −
1. If k <
0, then stop and return a NO-answer.We exhaustively apply the rule until we either stop and return a NO-answer or obtain an instance of the problem such that the degree of anyvertex v is at most δ ( v ) + k . In the last case it is sufficient to solve theproblem for the obtained instance, and if it has a solution ( U, D, A ), thenthe solution for the initial instance can be obtained by adding the deletedvertices to U . From now we assume that we do not stop while applyingthe rule, and to simplify notations, assume that ( G, δ, d, k ) is the obtainedinstance. Notice that for any v ∈ V ( G ), d G ( v ) ≤ δ ( v ) + k ≤ d + k . Supposethat v ∈ V ( G ) and d G ( v ) > δ ( v ). Then if the considered instance has asolution, either v or at least one of its neighbors should be deleted or atleast one of incident to v edges have to be deleted. It implies that we canbranch as follows. Branching rule. If G has a vertex v with d G ( v ) > δ ( v ), then stop andreturn a NO-answer if k = 0, otherwise branch as follows. • For each u ∈ N G [ v ], solve the problem for ( G − u, δ, d, k − U, D, A ), then stop and return ( U ∪ { u } , D, A ). • For each u ∈ N G ( v ), solve the problem for ( G − uv, δ, d, k − U, D, A ), then stop and return (
U, D ∪ { uv } , A ).7f none of the instances have a solution, then return a NO-answer.It is straightforward to observe that by the exhaustive application of therule we either solve the problem or obtain at most (2( k + d )+1) k instances ofthe problem such that the original instance has a solution if and only if oneof the new instances has a solution, and for each of the obtained instances,the degree of any vertex v is upper bounded by δ ( v ). Now it is sufficient toexplain how to solve Editing to a Graph of Given Degrees for suchinstances.To simplify notations, from now we assume that for (
G, δ, d, k ), d G ( v ) ≤ δ ( v ) for v ∈ V ( G ). Let Z = { v ∈ V ( G ) | d G ( v ) < δ ( v ) } . Before we move tothe next stage of the algorithm, we use the following lemmas. Lemma 5. If | Z | > k , then the instance ( G, δ, d, k ) has no solution.Proof. Suppose that (
G, δ, d, k ) has a solution (
U, D, A ). If d G ( v ) < δ ( v ) fora vertex v , then either v ∈ U or vu ∈ A for some u ∈ V ( G ). It follows that | Z | ≤ | U | + 2 | A | ≤ k . Lemma 6.
Let n ≥ . If v ∈ V ( G ) and d G ( v ) = δ ( v ) = 0 , then ( G − v, δ, d, k ) has a solution if and only if ( G, δ, d, k ) has a solution, and anysolution for ( G − v, δ, d, k ) is a solution for ( G, δ, d, k ) .Proof. Let d G ( v ) = δ ( v ) = 0. It is straightforward to see that if ( U, D, A ) isa solution for ( G − v, δ, d, k ), then it is a solution for ( G, δ, d, k ). Suppose that(
U, D, A ) is a solution for (
G, δ, d, k ). Because v is isolated and d G ( v ) = δ ( v ),the vertex v is not incident to any edge of D , and we can assume that v / ∈ U as otherwise ( U \ { v } , D, A ) is a solution for ( G, δ, d, k ) as well. Notice thatno edge of A is incident to v , because otherwise some edge of D should beincident to v since d G ( v ) = δ ( v ). We conclude that ( U, D, A ) is a solutionfor ( G − v, δ, d, k ).Using Lemma 5 and straightforward observations, we apply the followingrule. Stopping rule. If | Z | > k , then stop and return a NO-answer. If Z = ∅ ,then stop and return the trivial solution ( ∅ , ∅ , ∅ ). If Z = ∅ and k = 0, thenstop and return a NO-answer.Then we exhaustively apply the next rule. Isolates removing rule. If G has a vertex v with d G ( v ) = δ ( v ) = 0, thendelete v .Finally on this stage, we solve small instances. Small instance rule. If G has at most 3 kd − Editingto a Graph of Given Degrees using Lemma 1; notice that after the8xhaustive application of the previous rule, G has at most | Z | ≤ k isolatedvertices, i.e., G has at most 6 kd − k vertices.From now we assume that we do not stop at this stage of the algorithmand, as before, denote by ( G, δ, d, k ) the obtained instance and assume that n = | V ( G ) | . We have that G has at least 3 kd edges, | Z | ≤ k , Z = ∅ , k ≥
1, and for any isolated vertex v , δ ( v ) = 0, i.e., v ∈ Z . Notice that since Z = ∅ , d ≥ Random separation.
Now we apply the random separation technique.We start with constructing a true-biased Monte-Carlo algorithm and thenexplain how it can be derandomized.We color the vertices of G independently and uniformly at random bytwo colors. In other words, we partition V ( G ) into two sets R and B . Wesay that the vertices of R are red , and the vertices of B are blue .Let P = v , . . . , v s be a walk in G . We say that P is an R -connecting walk if either s ≤ i ∈ { , . . . , s − } , { v i , v i +1 , v i +2 } ∩ R = ∅ ,i.e., for any three consecutive vertices of P , at least one of them is red. Wealso say that two vertices x, y are R -equivalent if there is an R -connectingwalk that joins them. Clearly, R -equivalence is an equivalence relation on R . Therefore, it defines the corresponding partition of R into equivalenceclasses. Denote by R the set of red vertices that can be joined with somevertex of Z by an R -connecting walk. Notice that R is a union of someequivalence classes. Denote by R , . . . , R t the remaining classes, i.e., it isa partition of R \ R such that any two vertices x, y are in the same set ifand only if x and y are R -connected; notice that it can happen that t = 0.Observe that for any distinct i, j ∈ { , . . . , t } , N G [ R i ] ∩ R j = ∅ becauseany two vertices of R at distance at most 3 in G are R -equivalent. For i ∈ { , . . . , t } , let r i = | R i | .The partition R , . . . , R t can be constructed in polynomial time. Toconstruct R , we consider the set of red vertices at distance at most twofrom Z and include them in R . Then we iteratively include in R the redvertices at distance at most two from the vertices included in R in theprevious iteration. The sets R , . . . , R k are constructed in a similar way.Our aim is to find a solution ( U, D, A ) for (
G, δ, d, k ) such that • U ∩ B = ∅ , • R ⊆ U , • for any i ∈ { , . . . , t } , either R i ⊆ U or R i ∩ U = ∅ , • the edges of D are not incident to the vertices of N G ( U );i.e., U is a union of equivalence classes of R that contains the vertices of R .We call such a solution colorful . 9et B = ( Z ∩ B ) ∪ N G ( R ), and for i ∈ { , . . . , t } , let B i = N G ( R i ).Notice that each B i ⊆ B , and for distinct i, j ∈ { , . . . , t } , the distancebetween any u ∈ B i and v ∈ B j is at least two, i.e., u = v and uv / ∈ E ( G ).For a vertex v ∈ V ( G ) \ R , denote by def ( v ) = δ ( v ) − d G − R ( v ). Recallthat d G ( v ) ≤ δ ( v ). Therefore, def ( v ) ≥
0. Notice also that def ( v ) couldbe positive only for vertices of the sets B , . . . , B t . For each i ∈ { , . . . , t } ,if v ∈ B i , then either v ∈ Z or v is adjacent to a vertex of R i . Hence, def ( v ) > B , . . . , B t . For a set A ⊆ (cid:0) V ( G )2 (cid:1) \ E ( G ),denote by d G,A ( v ) the number of elements of A incident to v for v ∈ V ( G ).We construct a dynamic programming algorithm that consecutively for i = 0 , . . . , t , constructs the table T i that is either empty, or contains theunique zero element, or contains lists of all the sequences ( d , . . . , d p ) ofpositive integers, d ≤ . . . ≤ d p , such thati) there is a set U ⊆ R ∪ . . . ∪ R i , R ⊆ U , and for any j ∈ { , . . . , i } ,either R j ⊆ U or R j ∩ U = ∅ ,ii) there is a set A ⊆ (cid:0) V ( G )2 (cid:1) \ E ( G ) of pairs of vertices of B ∪ . . . ∪ B i ,iii) d + . . . + d p + | U | + | A | ≤ k ,and the graph G ′ = G − U + A has the following properties:iv) d G ′ ( v ) ≤ δ ( v ) for v ∈ V ( G ′ ), and d G ′ ( v ) < δ ( v ) for exactly p vertices v = v , . . . , v p ,v) δ ( v j ) − d G ′ ( v j ) = d i for j ∈ { , . . . , p } .For each sequence ( d , . . . , d p ), the algorithm also keeps the sets U, A forwhich i)–v) are fulfilled and | U | + | A | is minimum. The table contains theunique zero element ifvi) there is a set U ⊆ R ∪ . . . ∪ R i , R ⊆ U i , and for any j ∈ { , . . . , i } ,either R j ⊆ U or R j ∩ U = ∅ ,vii) there is a set A ⊆ (cid:0) V ( G )2 (cid:1) \ E ( G ) of pairs of vertices of B ∪ . . . ∪ B i ,viii) | U | + | A | ≤ k , andix) for the graph G ′ = G − U + A , d G ′ ( v ) = δ ( v ) for v ∈ V ( G ′ ).For the zero element, the table stores the corresponding sets U and A forwhich vi)–ix) are fulfilled.Now we explain how we construct the tables for i ∈ { , . . . , t } . Construction of T . Initially we set T = ∅ . If P v ∈ B def ( v ) > k −| R | ),then we stop, i.e., T = ∅ . Otherwise, we consider the auxiliary graph H = G [ B ]. For all sets A ⊆ (cid:0) V ( H )2 (cid:1) \ E ( H ) such that for any v ∈ V ( H ),10 H ,A ( v ) ≤ def ( v ), and P v ∈ B def ( v ) − | A | + | R | ≤ k , we construct thecollection of positive integers Q = { def ( v ) − d H ,A ( v ) | v ∈ B and def ( v ) − d H ,A ( v ) > } (notice that some elements of Q could be the same). If Q = ∅ ,then we arrange the elements of Q in increasing order and put the obtainedsequence ( d , . . . , d p ) of positive integers together with U = R and A in T .If there is A such that Q = ∅ , then we put the zero element in T togetherwith U = R and A , delete all other elements of T and then stop, i.e., T contains the unique zero element in this case. Construction of T i for i ≥ . We assume that T i − is already constructed.Initially we set T i = T i − . If T i = ∅ or T i contains the unique zero element,then we stop. Otherwise, we consecutively consider all sequences ( d , . . . , d p )from T i − with the corresponding sets U, A . If P v ∈ B i def ( v ) + P pj =1 d i > k − | R i | − | U | − | A | ), then we stop considering ( d , . . . , d p ). Otherwise, let G ′ = G − U + A , and let u , . . . , u p be the vertices of G ′ with d j = δ ( u j ) − d G ′ ( u j ) for j ∈ { , . . . , p } . We consider an auxiliary graph H i obtainedfrom G [ B i ] by the addition of p pairwise adjacent vertices u , . . . , u p . Weset def ( u j ) = d j for j ∈ { , . . . , p } . For all sets A ′ ⊆ (cid:0) V ( H i )2 (cid:1) \ E ( H i ) suchthat for any v ∈ V ( H i ), d H i ,A ′ ( v ) ≤ def ( v ), and P v ∈ V ( H i ) def ( v ) − | A ′ | + | R i | + | A | + | U | ≤ k , we construct the collection of positive integers Q = { def ( v ) − d H i ,A ′ ( v ) | v ∈ V ( H i ) and def ( v ) − d H i ,A ′ ( v ) > } . If Q = ∅ , thenwe arrange the elements of Q in increasing order and obtain the sequence( d ′ , . . . , d ′ q ) of positive integers together with U ′′ = U ∪ R i and A ′′ = A ∪ A ′ .If ( d ′ , . . . , d ′ q ) is not in T i , then we add it in T i together with U ′′ , A ′′ . If( d ′ , . . . , d ′ q ) is already in T i together with some sets U ′′′ , A ′′′ , we replace U ′′′ and A ′′′ by U ′′ and A ′′ respectively if | U ′′ | + | A ′′ | < | U ′′′ | + | A ′′′ | . If thereis A ′ such that Q = ∅ , then we put the zero element in T i together with U ′′ = U ∪ U i and A ′′ = A ∪ A ′ , delete all other elements of T i and then stop,i.e., T i contains the unique zero element in this case.The properties of the algorithm are summarized in the following lemma. Lemma 7.
The algorithm constructs the tables T i with at most O ( √ k ) records each in time O ( k log k ) · poly ( n ) for i ∈ { , . . . , t } , and each T i hasthe following properties.1. If T i = ∅ , then ( G, δ, d, k ) has no colorful solution.2. The table T i contains the zero element if and only if ( G, δ, d, k ) has acolorful solution ( U, D, A ) with R j ∩ U = ∅ for j ∈ { i + 1 , . . . , t } and D = ∅ . Moreover, if T i contains the zero element with sets U, A , then ( U, ∅ , A ) is a colorful solution for ( G, δ, d, k ) .3. The table T i contains a sequence ( d , . . . , d p ) of positive integers, d ≤ . . . ≤ d p , if and only if there are sets U, A that satisfy the conditionsi)–v) given above. Moreover, if T i contains ( d , . . . , d p ) together with , A , then U, A are sets with minimum value of | U | + | A | that satisfyi)–v).Proof. The proof is inductive.First, we show 1)–3) for i = 0. Recall that for any colorful solution( U, D, A ), R ⊆ U . If P v ∈ B def ( v ) > k −| R | ), then because the additionof any edge increases the degrees of its end-vertices by one, we immediatelyconclude that there is no colored solution in this case. Suppose that ( U, D, A )is a colorful solution. Let A ′ = { uv ∈ A | u, v ∈ B } and A ′′ = { uv ∈ A | u ∈ B , v / ∈ B } . Then k ≥ | U | + | D | + | A | ≥ | R | + | A ′ | + | A ′′ | . Also eachedge of A ′ increases the degrees of two its end-vertices in B by one, andeach edge of A ′′ increases the degree of its single end-vertex in B . Hence, P v ∈ B def ( v ) ≤ | A ′ | + | A ′′ | and P v ∈ B def ( v ) − | A ′ | + | R | ≤ | A ′ | + | A ′′ | + | R | ≤ | A | + | U | ≤ k . Because for the colorful solution ( U, D, A ), the edgesof D are not incident to the vertices of R , d H ,A ′ ( v ) ≤ def ( v ) for v ∈ B .Therefore, if a colorful solution exists, then T = ∅ . The claims 2 and 3follows directly from the description of the construction of T ; it is sufficientto observe that we try all possibilities to select the set A .Suppose that i ≥ T i − satisfies 1)–3). Notice that T i = ∅ if and only if T i − = . . . = T = ∅ , and we already proved that if T = ∅ , then ( G, δ, d, k ) has no colorful solution.Now we prove the second claim.Suppose that T i has the zero element. Then T i − = ∅ . If T i − has thezero element, then by the inductive assumption, ( G, δ, d, k ) has a colorfulsolution (
U, D, A ) with R j ∩ U = ∅ for j ∈ { i, . . . , t } and D = ∅ . Clearly,it is a colorful solution with R j ∩ U = ∅ for j ∈ { i + 1 , . . . , t } and D = ∅ .Moreover, if U, A are the sets that are in T i − , then they are in T i and( U, ∅ , A ) is a colorful solution. Suppose now that T i − does not contain thezero element. Then there is ( d , . . . , d p ) from T i − with the correspondingsets U, A such that we obtain the zero element when considering this record.Let G ′ = G − U + A , and let u , . . . , u p be the vertices of G ′ with d j = δ ( u j ) − d G ′ ( u j ) for j ∈ { , . . . , p } . Also we have a set A ′ ⊆ (cid:0) V ( H i )2 (cid:1) \ E ( H i )such that for any v ∈ V ( H i ), d H i ,A ( v ) ≤ def ( v ), P v ∈ V ( H i ) def ( v ) − | A ′ | + | R i | + | A | + | U | ≤ k , and the collection of positive integers Q = { def ( v ) − d H i ,A ′ ( v ) | v ∈ V ( H i ) and def ( v ) − d H i ,A ′ ( v ) > } = ∅ . Notice that u , . . . , u p are at distance at least two from the vertices of B i . Hence, A ′ ⊆ (cid:0) V ( G ′ ) \ R i (cid:1) and A ′′ = A ∪ A ′ ⊆ (cid:0) V ( G ) \ ( U ∪ R i )2 (cid:1) . Let G ′′ = G − U ′′ + A ′′ where U ′′ = U ∪ R i .By the construction, d G ′′ ( v ) ≤ δ ( v ) for v ∈ V ( G ′′ ). Observe that because Q is empty, P v ∈ V ( H i ) def ( v ) = 2 | A ′ | . Then, | U ′′ | + | A ′′ | = | A ′ | + | R i | + | A | + | U | = P v ∈ V ( H i ) def ( v ) − | A ′ | + | R i | + | A | + | U | ≤ k . We conclude that( U ′′ , ∅ , A ′′ ) is a solution for ( G, δ, d, k ). By the construction, R j ∩ U ′′ = ∅ for j ∈ { i + 1 , . . . , t } .Suppose that ( G, δ, d, k ) has a colorful solution ( U, ∅ , A ) with R j ∩ U = ∅ for j ∈ { i, . . . , t } and D = ∅ . Then by the inductive assumption, T i − has12he zero element, and we have that T i contains the same element. Supposenow that ( G, δ, d, k ) has no such a solution, but it has a colorful solution( U ′′ , ∅ , A ′′ ) with R j ∩ U ′′ = ∅ for j ∈ { i + 1 , . . . , t } . Then R i ⊆ U ′′ . Also wehave that R ⊆ U ′′ \ R i ⊆ R ∪ . . . ∪ R i − . Consider the partition A , A , A (some sets can be empty) of A ′′ such that the edges of A join vertices B i ,the edges of A join B i with vertices of B ∪ . . . ∪ B i − , and the edges of A join verices of B ∪ . . . ∪ B i − . Let w , . . . , w p be the end-vertices of theedges of A in B ∪ . . . ∪ B i − , d j = d F,A ( w j ) for j ∈ { , . . . , p } where F = G − U ′′ , and assume that d ≤ . . . ≤ d p . Consider F ′ = G − ( U ′′ \ R i ) + A .Then { w , . . . , w p } = { v ∈ V ( F ′ ) | δ ( v ) > d F ′ ( v ) } and d j = δ ( w j ) − d F ′ ( w j )for j ∈ { , . . . , p } . Therefore, T i − contains the record with the sequence( d , . . . , d p ) and some sets U, A . Let G ′ = G − U + A and let u , . . . , u p be the vertices of G ′ with d j = δ ( u j ) − d G ′ ( u j ) for j ∈ { , . . . , p } . Noticethat u , . . . , u p are at distance at least two from the vertices of B i . Weconstruct A ′ by replacing each edge vw j by vu j for j ∈ { , . . . , p } . Let A ′ = A ∪ A ′ . We have that A ′ ⊆ (cid:0) V ( H i )2 (cid:1) \ E ( H i ), for any v ∈ V ( H i ), d H i ,A ′ ( v ) ≤ def ( v ), and P v ∈ V ( H i ) def ( v ) − | A ′ | = 0. Also because U, A are chosen in such a way that | U | + | A | has minimum size for ( d , . . . , d p ), P v ∈ V ( H i ) def ( v ) − | A ′ | + | R i | + | A | + | U | = P v ∈ V ( H i ) def ( v ) − | A ′ | + | A | + | A | + | A | + | R i | + | U | ≤ | A | + | A | + | A | + | U ′′ | ≤ k . Then for A ′ , weconstruct Q = { def ( v ) − d H i ,A ′ ( v ) | v ∈ V ( H i ) and def ( v ) − d H i ,A ′ ( v ) > } ,and because Q = ∅ , we put the zero element in T together with U ∪ U i and A ∪ A ′ , delete all other elements of T i and then stop, i.e., T i contains theunique zero element in this case.The third claim is proved by similar arguments.Suppose T i contains ( d ′ , . . . , d ′ q ). If ( d ′ , . . . , d ′ q ) is in T i − , then by theinductive assumption, there are sets U ′′ , A ′′ that satisfy the conditions i)–v) given above. Suppose that ( d ′ , . . . , d ′ q ) is not in T i − . Then there is asequence ( d , . . . , d p ) in T i − with the corresponding sets U, A such that weobtain the sequence ( d ′ , . . . , d ′ q ) when considering this record. Also for thegraph H i , we have A ′ ⊆ (cid:0) V ( H i )2 (cid:1) \ E ( H i ) such that we obtain ( d ′ , . . . , d ′ q ) byorderning Q = { def ( v ) − d H i ,A ′ ( v ) | v ∈ V ( H i ) and def ( v ) − d H i ,A ′ ( v ) > } .Then it is straightforward to verify that U ′′ = U ∪ R i and A ′′ = A ∪ A ′ satisfy i)–v).We have that if ( d ′ , . . . , d ′ q ) is in T i together with U ′′ , A ′′ then i)–v) arefulfilled. Assume that | U ′′ | + | A ′′ | is not minimal, i.e., there are other setsˆ U , ˆ A such that | ˆ U | + | ˆ A | < | U ′′ | + | A ′′ | and i)–v) are fulfilled for these sets. Ifˆ U ∩ R i = ∅ , then we have that ( d ′ , . . . , d ′ q ) together with some ˆ U ′ , ˆ A ′ such that | ˆ U ′ | + | ˆ A ′ | ≤ | ˆ U | + | ˆ A | , and ( d ′ , . . . , d ′ q ) with ˆ U ′ , ˆ A ′ instead of U ′′ , A ′′ shouldbe in T i − , but the records of T i − are included in T i in the beginning andwe have a contradiction. Hence, R i ⊆ ˆ U . Consider the partition A , A , A (some sets can be empty) of ˆ A such that the edges of A join vertices B i ,the edges of A join B i with vertices of B ∪ . . . ∪ B i − , and the edges of13 join verices of B ∪ . . . ∪ B i − . Let w , . . . , w p be the end-vertices ofthe edges of A in B ∪ . . . ∪ B i − , d j = d F,A ( w j ) for j ∈ { , . . . , p } where F = G − ˆ U and assume that d ≤ . . . ≤ d p . Consider F ′ = G − ( ˆ U \ R i ) + A .Then { w , . . . , w p } = { v ∈ V ( F ′ ) | δ ( v ) > d F ′ ( v ) } and d j = δ ( w j ) − d F ′ ( w j )for j ∈ { , . . . , p } . Therefore, T i − contains the record with the sequence( d , . . . , d p ) and some sets U, A . Let G ′ = G − U + A , and let u , . . . , u p be the vertices of G ′ with d j = δ ( u j ) − d G ′ ( u j ) for j ∈ { , . . . , p } . Noticethat u , . . . , u p are at distance at least two from the vertices of B i . Weconstruct A ′ by replacing each edge vw j by vu j for j ∈ { , . . . , p } . Let A ′ = A ∪ A ′ . We have that A ′ ⊆ (cid:0) V ( H i )2 (cid:1) \ E ( H i ), for any v ∈ V ( H i ), d H i ,A ′ ( v ) ≤ def ( v ), and P v ∈ V ( H i ) def ( v ) − | A ′ | ≥
0. Also because
U, A are chosen in such a way that | U | + | A | has minimum size for ( d , . . . , d p ), P v ∈ V ( H i ) def ( v ) − | A ′ | + | R i | + | A | + | U | ≤ P v ∈ V ( H i ) def ( v ) − | A | − | A | + | R i | + | A | + | ˆ U | ≤ k . Then for A ′ , we construct Q = { def ( v ) − d H i ,A ′ ( v ) | v ∈ V ( H i ) and def ( v ) − d H i ,A ′ ( v ) > } , and because Q = { d ′ , . . . , d ′ q } , we obtain( d ′ , . . . , d ′ q ) with U ∪ R i and A ∪ A ′ , but since | U ∪ R i | + | A ∪ A ′ | ≤ | ˆ U | + | ˆ A | ,we should put these sets in T i instead of U ′′ , A ′′ ; a contradiction.Suppose now that T i contains ( d ′ , . . . , d ′ q ) with U ′′ , A ′′ that satisfy i)–v). If R i ∩ U ′′ = ∅ , then ( d ′ , . . . , d ′ q ) is in T i − by the inductive assumption.Therefore, the sequence is in T i as well. Suppose that R i ⊆ U ′′ . Consider thepartition A , A , A (some sets can be empty) of A ′′ such that the edges of A join vertices B i , the edges of A join B i with vertices of B ∪ . . . ∪ B i − ,and the edges of A join verices of B ∪ . . . ∪ B i − . Let w , . . . , w p bethe end-vertices of the edges of A in B ∪ . . . ∪ B i − , d j = d F,A ( w j ) for j ∈ { , . . . , p } where F = G − ˆ U , and assume that d ≤ . . . ≤ d p . Consider F ′ = G − ( ˆ U \ R i ) + A . Then { w , . . . , w p } = { v ∈ V ( F ′ ) | δ ( v ) > d F ′ ( v ) } and d j = δ ( w j ) − d F ′ ( w j ) for j ∈ { , . . . , p } . Therefore, T i − containsthe record with the sequence ( d , . . . , d p ) and some sets U, A . Let G ′ = G − U + A , and let u , . . . , u p be the vertices of G ′ with d j = δ ( u j ) − d G ′ ( u j )for j ∈ { , . . . , p } . Notice that u , . . . , u p are at distance at least two fromthe vertices of B i . We construct A ′ by replacing each edge vw j by vu j for j ∈ { , . . . , p } . It remains to observe that we include ( d ′ , . . . , d ′ q ) in T i whenwe consider ( d , . . . , d p ) from T i − and the set A ′ = A ∪ A ′ ⊆ (cid:0) V ( H i )2 (cid:1) \ E ( H i ).It remains to obtain the upper bound for the number of elements in eachtable and evaluate the running time.For a positive integer ℓ , a sequence of positive integers ( ℓ , . . . , ℓ s ), ℓ ≤ . . . ≤ ℓ s , is a partition of ℓ if ℓ = ℓ + . . . + ℓ s . To obtain an upper bound forthe number of partitions π ( ℓ ), we can use the asymptotic formula obtainedby Hardy and Ramanujan in 1918 and independently by Uspensky in 1920(see, e.g., the book of Andrews [3]): π ( ℓ ) ∼ √ ℓ e π √ ℓ/ . d , . . . , d p ) in a table, d + . . . + d p ≤ k , the total number of sequences in each table is upper bounded by kπ ( k ).Hence, by the asymptotic formula of Hardy and Ramanujan, the number ofrecords in each table is 2 O ( √ k ) .Notice that to construct T i , we consider the graphs H i that has at most2 k vertices. Hence, H i have at most 2 k pairs of non-adjacent vertices.Among these pairs we choose at most k pairs. Hence, for each H i , we haveat most 2 O ( k log k ) possibilities. For i ≥
1, we construct H i for each elementof T i − . Therefore, the each table is constructed in time 2 O ( k log k ) O ( √ k ) · poly ( n ). Because the number of tables is at most n , we have that thealgorithm runs in time 2 O ( k log k ) · poly ( n ).We use the final table T t to find a colorful solution for ( G, δ, d, k ) if itexists. • If T r contains the zero element with U, A , then ( U, ∅ , A ) is a colorfulsolution. • If T r contains a sequence ( d , . . . , d p ) with U, A such that 3( d + . . . + d p ) / | U | + | A | ≤ k and r = d + . . . + d p is even, then let G ′ = G − U + A and find the vertices u , . . . , u p of G ′ such that δ ( u i ) − d G ′ ( u i ) = d i for i ∈ { , . . . , p } . Then greedily find a matching D in G ′ with h = r/ x y , . . . , x h y h such that x , . . . , x h and y , . . . , y h are distinct from the vertices of { u , . . . , u p }∪ N G ( U ) and not adjacentto u , . . . , u p . Then we construct the set A ′ as follows. Initially A ′ = ∅ .Then for each i ∈ { , . . . , r } , we consecutively select next d i vertices w , . . . , w d i ∈ { x , . . . , x h , y , . . . , y h } in such a way that each vertex isselected exactly once and add in A ′ the pairs u w , . . . , u i w d i . Thenwe output the solution ( U, D, A ∪ A ′ ). • In all other cases we have a NO-answer.
Lemma 8.
The described algorithm finds a colorful solution for ( G, δ, d, k ) if it exists, and it returns a NO-answer otherwise.Proof. If T r contains the zero element with U, A , then ( U, ∅ , A ) is a colorfulsolution by Lemma 7.Suppose T r contains a sequence ( d , . . . , d p ) with U, A such that 3( d + . . . + d p ) / | U | + | A | ≤ k and r = d + . . . + d p is even. Observe that if D and A ′ exist, then ( U, D, A ∪ A ′ ) is a solution. The graph G ′ = G − U + A has p vertices u , . . . , u p such that δ ( u i ) − d G ′ ( u i ) = d i for i ∈ { , . . . , p } ,and for any other vertex v , d G ′ ( v ) = δ ( v ). Observe that p ≤ k − | U | . Also atmost | U | d edges are incident to the vertices of N G ( U ). Recall that G hasat least 3 kd edges. Therefore, G ′ has at least 3 kd − pd − | U | d ≥ kd edges that are not incident to { u , . . . , u p } ∪ N G ( U ) and the vertices that areadjacent to u , . . . , u p . Then h ≤ k/ D can be selected greedily by15he consecutive arbitrary choice of x i y i and the deletion of at most 2 d − x i , y i . Because 2 h = r = d + . . . + d p , we always can join u , . . . , u p with x , . . . , x h , y , . . . , y h by edges as prescribed.Now we show that if ( G, δ, d, k ) has a colorful solution (
U, D, A ), thenthe algorithm outputs some colorful solution.Consider the graph G ′ = G − U and let k ′ = k − | U | . Clearly, ( G ′ , δ, d, k ′ )is an instance of Editing to a Graph of Given Degrees such that forevery v ∈ V ( G ′ ), d G ′ ( v ) ≤ δ ( v ) ≤ d , and it has a solution with the emptyset of deleted vertices. Let Z ′ = { v ∈ V ( G ′ ) | d G ′ ( v ) < δ ( v ) } . By Lemma 5, | Z ′ | ≤ k ′ . Then at most 2 k ′ d edges of G ′ are incident to the vertices of Z ′ and the vertices that are adjacent to them. Also at most | U | d edges areincident to the vertices of U in G . Because G has at least 3 kd edges, G ′ hasat least 3 kd − k − | U | ) d − | U | d ≥ kd edges that are not incident to thevertices of Z ′ and the vertices that are adjacent to them. Then a matchingwith at least ⌊ k/ ⌋ edges x y , . . . , x s y s with their end-vertices at distanceat least two from Z ′ can be selected greedily. By Lemma 3, ( G ′ , δ, d, k ′ ) hasa solution ( U, D ′ , A ′ ) such thati) U = ∅ ,ii) either D ′ = ∅ or D ′ = { x y , . . . , x h y h } for some h ∈ { , . . . , s } ,iii) for every uv ∈ A ′ , either u, v ∈ Z ′ or uv joins Z ′ with some vertex of { x , . . . , x h } ∪ { y , . . . , y h } ,iv) for every i ∈ { , . . . , h } , A ′ has the unique edges ux i , vy i such that u, v ∈ Z .Let A ′′ = { uv ∈ A ′ | u, v ∈ Z ′ } . Consider G ′′ = G − U + A ′′ . Let u , . . . , u p be the vertices of G ′′ such that d G ′′ ( u i ) < δ ( u i ) for i ∈ { , . . . , p } . Let d i = δ ( u i ) − d G ′′ ( u i ) and assume that d ≤ . . . ≤ d p . Notice that 3( d + . . . + d p ) / | U | + | A ′′ | ≤ k . We have that T t contains ( d , . . . , d p ) with some sets U ′′′ , A ′′′ and | U ′′′ | + | A ′′′ | ≤ | U | + | A ′′ | . Then 3( d + . . . + d p ) / | U ′′′ | + | A ′′′ | ≤ k and the algorithm finds a colorful solution for the instance ( G, δ, d, k ).The described algorithm finds a colorful solution if it exists. To find asolution, we run the randomized algorithm N times. If we find a solutionafter some run, we return it and stop. If we do not obtain a solution after N runs, we return a NO-answer. The next lemma shows that it is sufficientto run the algorithm N = 2 O ( dk ) times. Lemma 9.
If after N = 2 kd executions the randomized algorithm doesnot find a solution for ( G, δ, d, k ) , then it does not exists with a positiveprobability p such that p does not depend on the instance. roof. Suppose that (
G, δ, d, k ) has a solution (
U, D, A ). The algorithmcolors the vertices of G independently and uniformly at random by twocolors.We find a lower bound for the probability that the vertices of N G [ Z ] ∪ N G [ U ] are colored correctly with respect to the solution, i.e., the verticesof U are red and all other vertices are blue. Recall that d G ( v ) ≤ d for v ∈ V ( G ) and d G ( v ) ≤ d − v ∈ Z . Recall also that | Z | ≤ k . Hence, | N G [ Z ] | ≤ kd − kd + 2 k ≤ kd − k . The set U has at most k vertices.Because for each v ∈ N G ( U ), its degree in G − U is at most d G ( v ) − < δ ( v ),by Lemma 5, | N G ( U ) | ≤ k . Therefore, N G [ U ] ≤ kd + 2 k . We havethat | N G [ Z ] ∪ N G [ U ] | ≤ kd . Hence, we color the set correctly with theprobability at least 2 − kd .Assume that the random coloring colored N G [ Z ] ∪ N G [ U ] correctly withrespect to the solution ( U, D, A ). Recall R is the set of red vertices thatcan be joined with some vertex of Z by an R -connecting walk. Because thevertices of N G [ Z ] and the vertices of N G [ U ] are colored correctly, we havethat R contains only red vertices from U . Also for other sets R , . . . , R t ofthe partition of R , we have that each R i ⊆ U or R i ∩ U = ∅ . It follows, thatthe problem has a colorful solution in this case, and the algorithm finds it.The probability that the vertices of N G [ Z ] ∪ N G [ U ] are not colored cor-rectly with respect to ( U, D, A ) is at most (1 − − kd ), and the probabilitythat these vertices are non colored correctly with respect to the solution forneither of N = 2 kd random colorings is at most (1 − − kd ) kd , and theclaim follows.The algorithm can be derandomized by standard techniques (see [2,8]) because random colorings can be replaced by the colorings induced by universal sets . Let n and r be positive integers, r ≤ n . An ( n, r ) -universalset is a collection of binary vectors of length n such that for each indexsubset of size r , each of the 2 r possible combinations of values appearsin some vector of the set. It is known that an ( n, r )-universal set can beconstructed in FPT-time with the parameter r . The best construction is dueto Naor, Schulman and Srinivasan [19]. They obtained an ( n, r )-universalset of size 2 r · r O (log r ) log n , and proved that the elements of the sets can belisted in time that is linear in the size of the set.To apply this technique in our case, we construct an ( n, r )-universal set U for r = min { kd , n } . Then we let V ( G ) = { v , . . . , v n } and for eachelement of U , i.e., a binary vector x = ( x , . . . , x n ), we consider the coloringof G induced by x ; a vertex v i is colored red if x i = 1, and v i is blueotherwise. Then if ( G, δ, d, k ) has a solution (
U, D, A ), then for one of thesecolorings, the vertices of N G [ Z ] ∪ N G [ U ] are colored correctly with respectto the solution, i.e., the vertices of U are red and all other vertices of the setare blue. In this case the instance has a colorful solution, and our algorithmfinds it. 17 unning time. We conclude the proof of Theorem 1 by the running timeanalysis.Clearly, the vertex deletion rule can be applied in polynomial time. Thebranching rule produces at most (2( k + d ) + 1) k instances of the problemand can be implemented in time 2 O ( k log( k + d ) · poly ( n ). Then the stoppingand isolates removing rules can be done in polynomial time. Whenever weapply the small instance rule, we have an instance with the graph with atmost 3 kd − k isolated vertices. Hence, the graph hasat most 2(3 kd −
1) + 2 k vertices. By Lemma 1, the problem can be solvedin time 2 O ( kd ) · poly ( n ). Hence, on the preprocessing stage we either solvethe problem or produce at most (2( k + d ) + 1) k new instances of the problemin time 2 O ( kd + k log k ) · poly ( n ).For each coloring of G , we can construct the partition R , . . . , R t of R in polynomial time. Then the dynamic programming algorithm producesthe table T t in time 2 O ( k log k ) · poly ( n ). Using the information in T t , wesolve the problem in time 2 O ( √ k ) · poly ( n ) because T t has at most 2 O ( √ k ) records. Hence, for each coloring the problem is solved time 2 O ( k log k ) · poly ( n ). We either consider at most N = 2 kd random colorings or at most2 r · r O (log r ) log n elements of an ( n, r )-universal set for r ≤ kd . In theboth cases we have that we can solve the problem in time 2 O ( kd + k log k ) · poly ( n ). Since we solve the problem for at most (2( k + d ) + 1) k instancesobtained on the preprocessing stage, we have that the total running time is2 O ( kd + k log k ) · poly ( n ). S = { vertex deletion , edge addition } We conclude the section by the observation that a simplified variant ofour algorithm solves
Editing to a Graph of Given Degrees for S = { vertex deletion , edge addition } . We have to modify the branchingrule to exclude edge deletions. Also on the preprocessing stage we don’tneed the small instance rule. On the random separation stage, we simplifythe algorithm by the observation that we have a colorful solution if and onlyif the table T t has the zero element. It gives us the following corollary. Corollary 1.
Editing to a Graph of Given Degrees can besolved in time O ( kd + k log k ) · poly ( n ) for n -vertex graphs for S = { vertex deletion , edge addition } . In this section we show that it is unlikely that
Editing to a Graphof Given Degrees parameterized by k + d has a polynomial kernel if { vertex deletion , edge addition } ⊆ S . The proof uses the cross-composition18echnique introduced by Bodlaender, Jansen and Kratsch [ ? ]. We need thefollowing definitions (see [ ? ]).Let Σ be a finite alphabet. An equivalence relation R on the set ofstrings Σ ∗ is called a polynomial equivalence relation if the following twoconditions hold:i) there is an algorithm that given two strings x, y ∈ Σ ∗ decides whether x and y belong to the same equivalence class in time polynomial in | x | + | y | ,ii) for any finite set S ⊆ Σ ∗ , the equivalence relation R partitions theelements of S into a number of classes that is polynomially boundedin the size of the largest element of S .Let L ⊆ Σ ∗ be a language, let R be a polynomial equivalence relationon Σ ∗ , and let Q ⊆ Σ ∗ × N be a parameterized problem. An OR-cross-composition of L into Q (with respect to R ) is an algorithm that, given t instances x , x , . . . , x t ∈ Σ ∗ of L belonging to the same equivalence classof R , takes time polynomial in P ti =1 | x i | and outputs an instance ( y, k ) ∈ Σ ∗ × N such that:i) the parameter value k is polynomially bounded in max {| x | , . . . , | x t |} +log t ,ii) the instance ( y, k ) is a YES-instance for Q if and only if at least oneinstance x i is a YES-instance for L for i ∈ { , . . . , t } .It is said that L OR-cross-composes into Q if a cross-composition algorithmexists for a suitable relation R .In particular, Bodlaender, Jansen and Kratsch [ ? ] proved the followingtheorem. Theorem 2 ([ ? ]) . If an NP -hard language L OR-cross-composes into theparameterized problem Q , then Q does not admit a polynomial kernelizationunless NP ⊆ coNP / poly . It is well-known that the
Clique problem is NP-complete for regulargraphs [13]. We need a special variant of
Clique for regular graphs wherea required clique is small with respect to the degree.
Small Clique in a Regular Graph
Instance:
Positive integers d and k , k ≥ k < d , and a d -regulargraph G . Question:
Is there a clique with k vertices in G ? Lemma 10.
Small Clique in a Regular Graph is NP -complete. roof. Recall that the
Clique problem asks for a graph G and a positiveinteger k , whether G has a clique with k vertices. Clique is known to beNP-complete for regular graphs [13] (it can be observed, e.g., that the dual
Independent Set problem is NP-complete for cubic graphs). To showNP-hardness of
Small Clique in a Regular Graph , we reduce from
Clique for regular graphs.Recall that the Cartesian product of graphs G and H is the graph G × H with the vertex set V ( G ) × V ( H ) such that ( u, v ) , ( u ′ , v ′ ) ∈ V ( G ) × V ( H )are adjacent in G × H if and only if u = u ′ and vv ′ ∈ E ( H ) or v = v ′ and uu ′ ∈ E ( G ).Let G be a d -regular graph, d ≥
1, and let k be a positive integer. Weconstruct H = G × K k ,k . For any v ∈ V ( H ), d H ( v ) = d + k , i.e., H is a d ′ = d + k -regular graph and d ′ > k . It remains to observe that H has aclique of size k if and only if H has a clique of size k .Now we are ready to prove the main result of the section. Theorem 3.
Editing to a Graph of Given Degrees parameter-ized by k + d has no polynomial kernel unless NP ⊆ coNP / poly if { vertex deletion , edge addition } ⊆ S .Proof. First, we consider the case when the all three editing operations areallowed, i.e., S = { vertex deletion , edge deletion , edge addition } .We show that Small Clique in a Regular Graph
OR-cross-composes into
Editing to a Graph of Given Degrees .We say that that two instances ( G , d , k ) and ( G , d , k ) of SmallClique in a Regular Graph are equivalent if | V ( G ) | = | V ( G ) | , d = d and k = k . Notice that this is a polynomial equivalence relation.Let ( G , d, k ) , . . . , ( G t , d, k ) be equivalent instances of Small Cliquein a Regular Graph , n = | V ( G i ) | for i ∈ { , . . . , t } . We construct theinstance ( G ′ , δ, d ′ , k ′ ) of Editing to a Graph of Given Degrees asfollows. • Construct copies of G , . . . , G t . • Construct p = k ( d − k + 1) pairwise adjacent vertices u , . . . , u p . • Construct k + 1 pairwise adjacent vertices w , . . . , w k and join each w j with each u h by an edge. • Set δ ( v ) = d for v ∈ V ( G ) ∪ . . . ∪ V ( G t ), δ ( u i ) = p + k + 1 for i ∈ { , . . . , p } , and δ ( w j ) = p + k for j ∈ { , . . . , k } . • Set d ′ = p + k + 1 and k ′ = k ( d − k + 2).Denote the obtained graph G ′ . 20learly, k ′ + d ′ = O ( n ), i.e., the parameter value is polynomiallybounded in n . We show that ( G ′ , δ, d ′ , k ′ ) is a YES-instance of Editingto a Graph of Given Degrees if and only if ( G i , k, d ) is a YES-instanceof Small Clique in a Regular Graph for some i ∈ { , . . . , t } .Suppose that ( G i , k, d ) is a YES-instance of Small Clique in a Reg-ular Graph for some i ∈ { , . . . , t } . Then G i has a clique K of size k . Let { v , . . . , v q } = N G i ( K ). For j ∈ { , . . . , q } , let d j = | N G i ( v j ) ∩ K | . Because G i is a d -regular graph, d + . . . + d q = k ( d − k + 1) = p . We constructthe solution ( U, D, A ) for ( G ′ , δ, d ′ , k ′ ) as follows. We set U = K in thecopy of G i , and let D = ∅ . Observe that to satisfy the degree conditions,we have to add d j edges incident to each v j in the copy of G i and add oneedge incident to each u h . To construct A , we consecutively consider thevertices v j in the copy of G i for j = 1 , . . . , q . For each v j , we greedily se-lect d j vertices x , . . . , x d j in { u , . . . , u p } that were not selected before andadd v j x , . . . , v j x d j to A . It is straightforward to verify that ( U, D, A ) is asolution and | U | + | D | + | A | = k + p = k ′ .Assume now that ( U, D, A ) is a solution for ( G ′ , δ, d ′ , k ′ ).We show that U ∩ ( { u , . . . , u p } ∪ { w , . . . , w k } ) = ∅ . To obtain a con-tradiction, assume that | U ∩ ( { u , . . . , u p } ∪ { w , . . . , w k } ) | = h >
0. Let X = ( { u , . . . , u p } ∪ { w , . . . , w k } ) \ U . Because { u , . . . , u p } ∪ { w , . . . , w k } has k ( d − k + 1) + k + 1 = k ′ + 1 vertices, X has k ′ + 1 − h > G ′′ = G ′ − U . Observe that for v ∈ X , δ ( v ) − d G ′′ ( v ) ≥ h . Because the ver-tices of X are pairwise adjacent, the set A has at least | X | h = ( k ′ + 1 − h ) h elements. But | A | ≤ k ′ − | U | ≤ k ′ − h . Because ( k ′ − h + 1) h > k ′ − h , weobtain a contradiction.Next, we claim that | U | = k and D = ∅ . Because U ∩ ( { u , . . . , u p } ∪{ w , . . . , w k } ) = ∅ , P pj =1 ( δ ( u j ) − d G ′ ( u j )) = p and the vertices u , . . . , u p arepairwise adjacent, A contains at least p elements. Moreover, A has at least p edges with one end-vertex in { u , . . . , u p } and another in V ( G ) ∪ . . . ∪ V ( G t )for the copies of G , . . . , G t in ( G ′ , δ, d ′ , k ′ ). Hence, | U | + | D | ≤ k ′ − | A | ≤ k ′ − p = k . Suppose that | U | = s < k and | D | = h . Let also D ′ = D ∩ ( E ( G ) ∪ . . . ∪ E ( G t )) and h ′ = | D ′ | . Let G ′′ = G ′ − U − D ′ . Because G , . . . , G t are d -regular, P v ∈ V ( G ′′ ) ( δ ( v ) − d G ′′ ( v )) ≤ sd + 2 h ′ ≤ sd + 2 h ≤ sd +2( k − s ). Therefore, A contains at most sd +2( k − s ) edges with one end-vertex in V ( G ) ∪ . . . ∪ V ( G t ). Notice that sd +2( k − s ) ≤ ( k − d +2 because d > k ≥
4. But p − ( k − d − k ( d − k +1) − ( k − d − d − k + k − > d > k , and we have no p edges with one end-vertex in { u , . . . , u p } andanother in V ( G ) ∪ . . . ∪ V ( G t ); a contradiction. Hence, | U | = k and D = ∅ .Now we show that U is a clique. Suppose that U has at least two non-adjacent vertices. Let G ′′ = G ′ − U . Because G , . . . , G t are d -regular, P v ∈ V ( G ′′ ) ( δ ( v ) − d G ′′ ( v )) ≥ k ( d − k + 1) + 2 = p + 2. Recall that A has atleast p edges with one end-vertex in { u , . . . , u p } and another in V ( G ) ∪ . . . ∪ V ( G t ). Because | U | = k and k ′ = p + k , A consists of p edges withone end-vertex in { u , . . . , u p } and another in V ( G ) ∪ . . . ∪ V ( G t ). But to21atisfy the degree restrictions for the vertices of V ( G ) ∪ . . . ∪ V ( G t ), weneed at least p + 2 such edges; a contradiction.We have that U ⊆ V ( G ) ∪ . . . ∪ V ( G t ) is a clique of size k . Because thecopies of G , . . . , G t in ( G ′ , δ, d ′ , k ′ ) are disjoint, U is a clique in some G i .It remains to apply Theorem 2. Because Small Clique in a RegularGraph is NP-complete by Lemma 10,
Editing to a Graph of GivenDegrees parameterized by k + d has no polynomial kernel unless NP ⊆ coNP / poly.To prove the theorem for S = { vertex deletion , edge addition } , it is suf-ficient to observe that for the constructed instance ( G ′ , δ, d ′ , k ′ ) of Editingto a Graph of Given Degrees , any solution (
U, D, A ) has D = ∅ , i.e.,edge deletions are not used. Hence, the same arguments prove the claim. We proved that
Editing to a Graph of Given Degrees is FPTwhen parameterized by k + d for { vertex deletion , edge addition } ⊆ S ⊆{ vertex deletion , edge deletion , edge addition } , but does not admit a poly-nomial kernel. Our algorithm runs in time 2 O ( kd + k log k ) · poly ( n ) for n -vertexgraph. Hence, it is natural to ask whether this running time could be im-proved. Another open question is whether the same random separationapproach could be applied for more general variants of the problem. Recallthat Mathieson and Szeider [17] proved that the problem is FPT for the casewhen vertices and edges have costs and the degree constraints are relaxed:for each v ∈ V ( G ′ ), d G ′ ( v ) should be in a given set δ ( v ) ⊆ { , . . . , d } . Itwould be interesting to construct a feasible algorithm for this case. Noticethat a solution ( U, D, A ) can have a more complicated structure if U = ∅ .In particular, we cannot claim that H ( D, A ) can be covered by (
D, A )-alternating trails. Some interesting results in this direction were recentlyobtained by Froese, Nichterlein and Niedermeier [ ? ]. References [1]
N. Alon, A. Shapira, and B. Sudakov , Additive approximationfor edge-deletion problems , in FOCS, IEEE Computer Society, 2005,pp. 419–428. pages[2]
N. Alon, R. Yuster, and U. Zwick , Color-coding , J. ACM, 42(1995), pp. 844–856. pages[3]
G. E. Andrews , The theory of partitions , Cambridge MathematicalLibrary, Cambridge University Press, Cambridge, 1998. Reprint of the1976 original. pages 224]
H. L. Bodlaender, B. M. P. Jansen, and S. Kratsch , Cross-composition: A new technique for kernelization lower bounds , inSTACS, vol. 9 of LIPIcs, Schloss Dagstuhl - Leibniz-Zentrum fuer In-formatik, 2011, pp. 165–176. pages[5] ,
Kernelization lower bounds by cross-composition , CoRR,abs/1206.5941 (2012). pages[6]
P. Burzyn, F. Bonomo, and G. Dur´an , Np-completeness results foredge modification problems , Discrete Applied Mathematics, 154 (2006),pp. 1824–1844. pages[7]
L. Cai , Fixed-parameter tractability of graph modification problems forhereditary properties , Inf. Process. Lett., 58 (1996), pp. 171–176. pages[8]
L. Cai, S. M. Chan, and S. O. Chan , Random separation: Anew method for solving fixed-cardinality optimization problems , in IW-PEC, vol. 4169 of Lecture Notes in Computer Science, Springer, 2006,pp. 239–250. pages[9]
L. Cai and B. Yang , Parameterized complexity of even/odd subgraphproblems , J. Discrete Algorithms, 9 (2011), pp. 231–240. pages[10]
M. Cygan, D. Marx, M. Pilipczuk, M. Pilipczuk, andI. Schlotter , Parameterized complexity of eulerian deletion problems ,in WG 2011, vol. 6986 of Lecture Notes in Computer Science, Springer,2011, pp. 131–142. pages[11]
R. G. Downey and M. R. Fellows , Parameterized complexity ,Monographs in Computer Science, Springer-Verlag, New York, 1999.pages[12]
J. Flum and M. Grohe , Parameterized complexity theory , Textsin Theoretical Computer Science. An EATCS Series, Springer-Verlag,Berlin, 2006. pages[13]
M. R. Garey and D. S. Johnson , Computers and Intractability: AGuide to the Theory of NP-Completeness , W. H. Freeman, 1979. pages[14]
P. A. Golovach , Editing to a connected graph of given degrees , CoRR,abs/1308.1802 (2013). pages[15]
S. Khot and V. Raman , Parameterized complexity of finding sub-graphs with hereditary properties , Theor. Comput. Sci., 289 (2002),pp. 997–1008. pages[16]
J. M. Lewis and M. Yannakakis , The node-deletion problem forhereditary properties is np-complete , J. Comput. Syst. Sci., 20 (1980),pp. 219–230. pages 2317]
L. Mathieson and S. Szeider , Editing graphs to satisfy degree con-straints: A parameterized approach , J. Comput. Syst. Sci., 78 (2012),pp. 179–191. pages[18]
H. Moser and D. M. Thilikos , Parameterized complexity of findingregular induced subgraphs , J. Discrete Algorithms, 7 (2009), pp. 181–190. pages[19]
M. Naor, L. Schulman, and A. Srinivasan , Splitters and near-optimal derandomization , in 36th Annual Symposium on Foundationsof Computer Science (FOCS 1995), IEEE, 1995, pp. 182–191. pages[20]
A. Natanzon, R. Shamir, and R. Sharan , Complexity classificationof some edge modification problems , Discrete Applied Mathematics, 113(2001), pp. 109–128. pages[21]
R. Niedermeier , Invitation to fixed-parameter algorithms , vol. 31 ofOxford Lecture Series in Mathematics and its Applications, OxfordUniversity Press, Oxford, 2006. pages[22]
D. Seese , Linear time computable problems and first-order descrip-tions , Mathematical Structures in Computer Science, 6 (1996), pp. 505–526. pages[23]