# Graph Editing to a Given Degree Sequence

## Abstract

We investigate the parameterized complexity of the graph editing problem called Editing to a Graph with a Given Degree Sequence where the aim is to obtain a graph with a given degree sequence \(\sigma \) by at most *k* vertex or edge deletions and edge additions. We show that the problem is W[1]-hard when parameterized by *k* for any combination of the allowed editing operations. From the positive side, we show that the problem can be solved in time \(2^{O(k(\varDelta +k)^2)}n^2\log n\) for *n*-vertex graphs, where \(\varDelta =\max \sigma \), i.e., the problem is FPT when parameterized by \(k+\varDelta \). We also show that Editing to a Graph with a Given Degree Sequence has a polynomial kernel when parameterized by \(k+\varDelta \) if only edge additions are allowed, and there is no polynomial kernel unless \(\mathrm{NP}\subseteq \mathrm{coNP}/\text {poly}\) for all other combinations of allowed editing operations.

## 1 Introduction

The aim of graph editing (or graph modification) problems is to modify a given graph by applying a bounded number of permitted operations in order to satisfy a certain property. Typically, vertex deletions, edge deletions and edge additions are the considered as the permitted editing operations, but in some cases other operations like edge contractions and vertex additions are also permitted.

We are interested in graph editing problems where the aim is to obtain a graph satisfying some given degree constraints. These problems usually turn out to be NP-hard (with rare exceptions). Hence, we are interested in the parameterized complexity of such problems. Before we state our results we briefly discuss the known related (parameterized) complexity results.

**Related Work.** The investigation of the parameterized complexity of the editing problems with degree constraints was initiated by Moser and Thilikos in [21] and Mathieson and Szeider [20]. In particular, Mathieson and Szeider [20] considered the Degree Constraint Editing problem that asks for a given graph *G*, nonnegative integers *d* and *k*, and a function \(\delta :V(G)\rightarrow 2^{\{0,\ldots ,d\}}\), whether *G* can be modified into a graph \(G'\) such that the degree \(d_{G'}(v)\in \delta (v)\) for each \(v\in V(G')\), by using at most *k* editing operations. They classified the (parameterized) complexity of the problem depending on the set of allowed editing operations. In particular, they proved that if only edge deletions and additions are permitted, then the problem can be solved in polynomial time for the case where the set of feasible degrees \(|\delta (v)|=1\) for \(v\in V(G)\). Without this restriction on the size of the sets of feasible degrees, the problem is NP-hard even on subcubic planar graphs whenever only edge deletions are allowed [9] and whenever only edge additions are allowed [15]. If vertex deletions can be used, then the problem becomes NP-complete and W[1]-hard with parameter *k*, even if the sets of feasible degrees have size one [20]. Mathieson and Szeider [20] showed that Degree Constraint Editing is FPT when parameterized by \(d+k\). They also proved that the problem has a polynomial kernel in the case where only vertex and edge deletions are allowed and the sets of feasible degrees have size one. Further kernelization results were obtained by Froese, Nichterlein and Niedermeier [15]. In particular, they proved that the problem with the parameter *d* admits a polynomial kernel if only edge additions are permitted. They also complemented these results by showing that there is no polynomial kernel unless \(\mathrm{NP}\subseteq \mathrm{coNP}/\text {poly}\) if only vertex or edge deletions are allowed. Golovach proved in [17] that, unless \(\mathrm{NP}\subseteq \mathrm{coNP}/\text {poly}\), the problem does not admit a polynomial kernel when parameterized by \(d+k\) if vertex deletion and edge addition are in the list of operations, even if the sets of feasible degrees have size one. The case where the input graph is planar was considered by Dabrowski et al. in [13]. Golovach [16] introduced a variant of Degree Constraint Editing in which, besides the degree restrictions, it is required that the graph obtained by editing should be connected. This variant for planar input graphs was also considered in [13].

Froese, Nichterlein and Niedermeier [15] also considered the \(\varPi \)-Degree Sequence Completion problem which, given a graph *G*, a nonnegative integer *k*, and a property \(\varPi \) of graph degree sequences, asks whether it is possible to obtain a graph \(G'\) from *G* by adding at most *k* edges such that the degree sequence of \(G'\) satisfies \(\varPi \). They gave some conditions when the problem is FPT/admits a polynomial kernel when parameterized by *k* and the maximum degree of *G*. There are numerous results (see, e.g., [4, 8, 11, 12]) about the graph editing problem where the aim is to obtain a (connected) graph whose vertices satisfy some parity restrictions on their degree. In particular, if the obtained graph is required to be a connected graph with vertices of even degree, we obtain the classical Editing to Eulerian Graph problem (see. [4, 12]).

Another variant of graph editing with degree restrictions is the Degree Anonymization problem, motivated by some privacy and social networks applications. A graph *G* is *h-anonymous* for a positive integer *h* if for any \(v\in V(G)\), there are at least \(h-1\) other vertices of the same degree. Degree Anonymization asks, given a graph *G*, a nonnegative *h*, and a positive integer *k*, whether it is possible to obtain an *h*-anonymous graph by at most *k* editing operations. The investigation of the parameterized complexity of Degree Anonymization was initiated by Hartung et al. [18] and Bredereck et al. [6] (see also [5, 19]). In particular, Hartung et al. [18] considered the case where only edge additions are allowed. They proved that the problem is W[1]-hard when parameterized by *k*, but it becomes FPT and has a polynomial kernel when parameterized by the maximum degree \(\varDelta \) of the input graph. Bredereck et al. [6] considered vertex deletions. They proved that the problem is W[1]-hard when parameterized by \(h+k\), but it is FPT when parameterized by \(\varDelta +h\) or by \(\varDelta +k\). Also the problem was investigated for the cases when vertex additions [5] and edge contractions [19] are the editing operations.

**Our Results.**Recall that the

*degree sequence*of a graph is the nonincreasing sequence of its vertex degrees. We consider the graph editing problem where the aim is to obtain a graph with a given

*degree sequence*by using the operations

*vertex deletion*,

*edge deletion*, and

*edge addition*, denoted by \({ vd}\), \({ ed}\), and \({ ea}\), respectively. Formally, the problem is stated as follows. Let \(S\subseteq \{{ vd},{ ed},{ ea}\}\).

It is worth highlighting here the difference between this problem and the Editing to a Graph of Given Degrees problem studied in [15, 17, 20]. In Editing to a Graph of Given Degrees, a function \(\delta :V(G)\rightarrow \{1,\ldots ,d\}\) is given along with the input and, in the target graph \(G'\), every vertex *v* is required to have the *specific* degree \(\delta (v)\). In contrast, in the Editing to a Graph with a Given Degree Sequence, only a degree sequence is given with the input and the requirement is that the target graph \(G'\) has this degree sequence, without specifying which specific vertex has which specific degree. To some extend, this problem can be seen as a generalization of the Degree Anonymization problem [5, 6, 18, 19], as one can specify (as a special case) the target degree sequence in such a way that every degree appears at least *h* times in it.

In practical applications with respect to privacy and social networks, we might want to appropriately “smoothen” the degree sequence of a given graph in such a way that it becomes difficult to distinguish between two vertices with (initially) similar degrees. In such a setting, it does not seem very natural to specify in advance a *specific* desired degree to every *specific* vertex of the target graph. Furthermore, for anonymization purposes in the case of a social network, where the degree distribution often follows a so-called power law distribution [2], it seems more natural to identify a smaller number of vertices having all the same “high” degree, and a greater number of vertices having all the same “small” degree, in contrast to the more modest *h*-anonymization requirement where *every* different degree must be shared among at least *h* identified vertices in the target graph.

In Sect. 2, we observe that for any nonempty \(S\subseteq \{{ vd},{ ed},{ ea}\}\), Editing to a Graph with a Given Degree Sequence is NP-complete and W[1]-hard when parameterized by *k*. Therefore, we consider a stronger parameterization by \(k+\varDelta \), where \(\varDelta =\max \sigma \). In Sect. 3, we show that Editing to a Graph with a Given Degree Sequence is FPT when parameterized by \(k+\varDelta \). In fact, we obtain this result for the more general variant of the problem, where we ask whether we can obtain a graph \(G'\) with the degree sequence \(\sigma \) from the input graph *G* by at most \(k_{vd}\) vertex deletions, \(k_{ed}\) edge deletions and \(k_{ea}\) edge additions. We show that the problem can be solved in time \(2^{O(k(\varDelta +k)^2)}n^2\log n\) for *n*-vertex graphs, where \(k=k_{vd}+k_{ed}+k_{ea}\). The algorithm uses the random separation techniques introduced by Cai, Chan and Chan [7] (see also [1]). First, we construct a true biased Monte Carlo algorithm, that is, a randomized algorithm whose running time is deterministic and that always returns a correct answer when it returns a yes-answer but can return a false negative answer with a certain (small) probability. Then we explain how it can be derandomized. In Sect. 4, we show that Editing to a Graph with a Given Degree Sequence has a polynomial kernel when parameterized by \(k+\varDelta \) if \(S=\{ea\}\), but for all other nonempty \(S\subseteq \{{ vd},{ ed},{ ea}\}\), there is no polynomial kernel unless \(\mathrm{NP}\subseteq \mathrm{coNP}/\text {poly}\).

## 2 Basic Definitions and Preliminaries

**Graphs.** We consider only finite undirected graphs without loops or multiple edges. The vertex set of a graph *G* is denoted by *V*(*G*) and the edge set is denoted by *E*(*G*).

For a set of vertices \(U\subseteq V(G)\), *G*[*U*] denotes the subgraph of *G* induced by *U*, and by \(G-U\) we denote the graph obtained from *G* by the removal of all the vertices of *U*, i.e., the subgraph of *G* induced by \(V(G)\setminus U\). If \(U=\{u\}\), we write \(G-u\) instead of \(G-\{u\}\). Respectively, for a set of edges \(L\subseteq E(G)\), *G*[*L*] is a subgraph of *G* induced by *L*, i.e., the vertex set of *G*[*L*] is the set of vertices of *G* incident to the edges of *L*, and *L* is the set of edges of *G*[*L*]. For a nonempty set *U*, \(\left( {\begin{array}{c}U\\ 2\end{array}}\right) \) is the set of unordered pairs of elements of *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\subseteq \left( {\begin{array}{c}V(G)\\ 2\end{array}}\right) \), \(G+L\) is the graph obtained from *G* by the addition of the edges that are elements of *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, the set of vertices which are adjacent to *v*, and for a set \(U\subseteq V(G)\), \(N_G(U)=(\bigcup _{v\in U}N_G(v))\setminus U\). The *closed neighborhood*\(N_G[v]=N_G(v)\cup \{v\}\), and for a positive integer *r*, \(N_G^r[v]\) is the set of vertices at distance at most *r* from *v*. For a set \(U\subseteq V(G)\) and a positive integer *r*, \(N_G^r[U]=\bigcup _{v\in U}N_G^r[v]\). The *degree* of a vertex *v* is denoted by \(d_G(v)=|N_G(v)|\). The *maximum degree*\(\varDelta (G)=\max \{d_G(v)\mid v\in V(G)\}\).

For a graph *G*, we denote by \(\sigma (G)\) its degree sequence. Notice that \(\sigma (G)\) can be represented by the vector \(\delta (G)=(\delta _0,\ldots ,\delta _{\varDelta (G)})\), where \(\delta _i=|\{v\in V(G)\mid d_G(v)=i\}|\) for \(i\in \{0,\ldots ,\varDelta (G)\}\). We call \(\delta (G)\) the *degree vector* of *G*. For a sequence \(\sigma =(\sigma _1,\ldots ,\sigma _n)\), we define \(\delta (\sigma )=(\delta _0,\ldots ,\delta _r)\), where \(r=\max \sigma \) and \(\delta _i=|\{\sigma _j\mid \sigma _j=i\}|\) for \(i\in \{0,\ldots ,r\}\). Clearly, \(\delta (G)=\delta (\sigma (G))\), and the degree vector can be easily constructed from the degree sequence and vice versa. Slightly abusing notation, we write for two vectors of nonnegative integers, that \((\delta _0,\ldots ,\delta _r)=(\delta _0',\ldots ,\delta _{r'}')\) for \(r\le r'\) if \(\delta _i=\delta _i'\) for \(i\in \{0,\ldots ,r\}\) and \(\delta _i'=0\) for \(i\in \{r+1,\ldots ,r'\}\).

**Parameterized Complexity.** Parameterized complexity is a two dimensional framework for studying the computational complexity of a problem. One dimension is the input size *n* and another one is a parameter *k*. It is said that a problem is *fixed parameter tractable* (or FPT), if it can be solved in time \(f(k)\cdot n^{O(1)}\) for some function *f*. A *kernelization* for a parameterized problem is a polynomial algorithm that maps each instance (*x*, *k*) with the input *x* and the parameter *k* to an instance \((x',k')\) such that (i) (*x*, *k*) is a YES-instance if and only if \((x',k')\) is a YES-instance of the problem, and (ii) \(|x'|+k'\) 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. A decidable parameterized problem is FPT if and only if it has a kernel, but it is widely believed that not all FPT problems have polynomial kernels. In particular, Bodlaender et al. [3] introduced techniques that allow to show that a parameterized problem has no polynomial kernel unless \(\mathrm{NP}\subseteq \mathrm{coNP}/\text {poly}\). We refer to the recent books of Cygan et al. [10] and Downey and Fellows [14] for detailed introductions to parameterized complexity.

**Solutions of Editing to a Graph with a Given Degree Sequence.** Let \((G,\sigma ,k)\) be an instance of Editing to a Graph of Given Degree Sequence. Let \(U\subset V(G)\), \(D\subseteq E(G-U)\) and \(A\subseteq \left( {\begin{array}{c}V(G)\setminus U\\ 2\end{array}}\right) \). We say that (*U*, *D*, *A*) is a *solution* for \((G,\sigma ,k)\), if \(|U|+|D|+|A|\le k\), and the graph \(G'=G-U-D+A\) has the degree sequence \(\sigma \). We also say that \(G'\) is obtained by editing with respect to (*U*, *D*, *A*). If \({ vd}\), \({ ed}\) or \({ ea}\) is not in *S*, then it is assumed that \(U=\emptyset \), \(D=\emptyset \) or \(A=\emptyset \) respectively. If \(S=\{{ ea}\}\), then instead of \((\emptyset ,\emptyset ,A)\) we simply write *A*.

We conclude this section by observing that Editing to a Graph with a Given Degree Sequence is hard when parameterized by *k*.

**Theorem 1**

For any nonempty \(S\subseteq \{{ vd},{ ed},{ ea}\}\), Editing to a Graph with a Given Degree Sequence is NP-complete and W[1]-hard when parameterized by *k*.

## 3 FPT-algorithm for Editing to a Graph with a Given Degree Sequence

Notice that we can solve Editing to a Graph with a Given Degree Sequence using an algorithm for Extended Editing to a Graph with a Given Degree Sequence by trying all possible values of \(k_{vd}\), \(k_{ed}\) and \(k_{ea}\) with \(k_{vd}+k_{ed}+k_{ea}=k\).

**Theorem 2**

Extended Editing to a Graph with a Given Degree Sequence can be solved in time \(2^{O(k(\varDelta +k)^2)}n^2\log n\) for *n*-vertex graphs, where \(\varDelta =\max \sigma \) and \(k=k_{vd}+k_{ed}+k_{ea}\).

*Proof*

First, we construct a randomized true biased Monte Carlo FPT-algorithm for Extended Editing to a Graph with a Given Degree Sequence parameterized by \(k+\varDelta \) based on the random separation techniques introduced by Cai, Chan and Chan [7] (see also [1]). Then we explain how this algorithm can be derandomized. \(\square \)

Let \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) be an instance of Extended Editing to a Graph with a Given Degree Sequence, \(n=|V(G)|\).

On the first stage of the algorithm we preprocess the instance to get rid of vertices of high degree or solve the problem if we have a trivial no-instance by the following reduction rule.

**Vertex Deletion Rule.** If *G* has a vertex *v* with \(d_G(v)> \varDelta +k_{vd}+k_{ed}\), then delete *v* and set \(k_{vd}=k_{vd}-1\). If \(k_{vd}<0\), then stop and return a NO-answer.

To show that the rule is *safe*, i.e., by the application of the rule we either correctly solve the problem or obtain an equivalent instance, assume that \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) is a yes-instance of Extended Editing to a Graph with a Given Degree Sequence. Let (*U*, *D*, *A*) be a solution. We show that if \(d_G(v)> \delta +k_{vd}+k_{ed}\), then \(v\in U\). To obtain a contradiction, assume that \(d_G(v)> \delta +k_{vd}+k_{ed}\) but \(v\notin U\). Then \(d_{G'}(v)\le \varDelta \), where \(G'=G-U-D+A\). It remains to observe that to decrease the degree of *v* by at least \(k_{vd}+k_{ed}+1\), we need at least \(k_{vd}+k_{ed}+1\) vertex or edge deletion operations; a contradiction. We conclude that if \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) is a yes-instance, then the instance obtained by the application of the rule is also a yes-instance. It is straightforward to see that if \((G',\sigma ,k_{vd}',k_{ed},k_{ea})\) is a yes-instance of Extended Editing to a Graph with a Given Degree Sequence obtained by the deletion of a vertex *v* and (*U*, *D*, *A*) is a solution, then \((U\cup \{v\},D,A)\) is a solution for the original instance. Hence, the rule is safe.

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 any vertex *v* is at most \(\varDelta +k\). To simplify notations, we assume that \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) is such an instance.

On the next stage of the algorithm we apply the random separation technique. We color the vertices of *G* independently and uniformly at random by three colors. In other words, we partition *V*(*G*) into three sets \(R_v\), \(Y_v\) and \(B_v\) (some sets could be empty), and say that the vertices of \(R_v\) are *red*, the vertices of \(Y_v\) are *yellow* and the vertices of \(B_v\) are *blue*. Then the edges of *G* are colored independently and uniformly at random by either *red* or *blue*. We denote by \(R_e\) the set of red and by \(B_e\) the set of blue edges respectively.

We are looking for a solution (*U*, *D*, *A*) of \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) such that the vertices of *U* are colored red, the vertices incident to the edges of *A* are yellow and the edges of *D* are red. Moreover, if *X* and *Y* are the sets of vertices incident to the edges of *D* and *A* respectively, then the vertices of \((N_G^2[U]\cup N_G[X\cup Y])\setminus (U\cup Y)\) and the edges of \(E(G)\setminus D\) incident to the vertices of \(N_G[U]\cup X\cup Y\) should be blue. Informally speaking, the elements of a solution should be marked red in the case of deleted vertices and edges, and the end-vertices of added edges should be marked yellow. Then to separate the elements of a solution, we demand that the vertices and edges that are sufficiently close to it but not included in a solution should be blue. Formally, we say that a solution (*U*, *D*, *A*) of \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) is a *colorful* solution if there are \(R_v^*\subseteq R_v\), \(Y_v^*\subseteq Y_v\) and \(R_e^*\subseteq R_e\) such that the following holds.

- (i)
\(|R_v^*|\le k_{vd}\), \(|R_e^*|\le k_{ed}\) and \(|Y_v^*|\le 2k_{ea}\).

- (ii)
\(U=R_v^*\), \(D=R_e^*\), and for any \(uv\in A\), \(u,v\in Y_v^*\) and \(|A|\le k_{ea}\).

- (iii)
If \(u,v\in R_v\cup Y_v\) and \(uv\in E(G)\), then either \(u,v\in R_v^*\cup Y_v^*\) or \(u,v\notin R_v^*\cup Y_v^*\).

- (iv)
If \(u\in R_v\cup Y_v\) and \(uv\in R_e\), then either \(u\in R_v^*\cup Y_v^*,uv\in R_e^*\) or \(u\notin R_v^*\cup Y_v^*,uv\notin R_e^*\).

- (v)
If \(uv,vw\in R_e\), then either \(uv,vw\in R_e^*\) or \(uv,vw\notin R_e^*\).

- (vi)
If distinct \(u,v\in R_v\) and \(N_G(u)\cap N_G(v)\ne \emptyset \), then either \(u,v\in R_v^*\) or \(u,v\notin R_v^*\).

- (vii)
If \(u\in R_v\) and \(vw\in R_e\) for \(v\in N_G(u)\), then either \(u\in R_v^*,vw\in R_e^*\) or \(u\notin R_v^*,vw\notin R_e^*\).

We also say that \((R_v^*,Y_v^*,R_e^*)\) is the *base* of (*U*, *D*, *A*).

Our aim is to find a colorful solution if it exists. We do is by a dynamic programming algorithm based on the following properties of colorful solutions.

*H*. Let \(R_v^i=V(H_i)\cap R_e\), \(Y_v^i=V(H_i)\cap Y_v\) and \(R_e^i=E(H_i)\cap R_e\) for \(i\in \{1,\ldots ,s\}\).

**Claim A.***If (U,D,A) is a colorful solution and*\((R_v^*,Y_v^*,R_e^*)\)*is its base, then if*\(H_i\)*has a vertex of *\(R_v^*\cup Y_v^*\)*or an edge of *\(R_e^*\), *then*\(R_v^i\subseteq R_v^*\), \(Y_v^i\subseteq Y_v^*\)*and *\(R_e^i\subseteq R_r^*\)*for *\(i\in \{1,\ldots ,s\}\).

*Proof*

*(of Claim A).* Suppose that \(H_i\) has \(u\in R_v^*\cup Y_v^*\) or \(e\in R_e^*\).

If \(v\in R_v^i\cup Y_v^i\), then \(H_i\) has a path \(P=x_0\ldots x_\ell \) such that \(u=x_0\) or \(e=x_0x_1\), and \(x_\ell =v\). By induction on \(\ell \), we show that \(v\in R_v^*\) or \(v\in Y_v^*\) respectively. If \(\ell =1\), then the statement follows from (iii) and (iv) of the definition of a colorful solution. Suppose that \(\ell >1\). We consider three cases.

**Case 1.**\(x_1\in R_v\cup Y_v\). By (iii) and (iv), \(x_1\in R_v^*\cup Y_v^*\) and, because the \((x_1,x_\ell )\)-subpath of *P* has length \(\ell -1\), we conclude that \(v\in R_v^*\) or \(v\in Y_v^*\) by induction.

Assume from now that \(x_1\notin R_v\cup Y_v\).

**Case 2.**\(x_0x_1\in R_e\). Clearly, if for the first edge *e* of *P*, \(e\in R_e^*\), then \(x_0x_1=e\in R_e^*\). Suppose that for the first vertex \(u=x_0\) of *P*, \(u\in R_v^*\cup Y_v^*\). Then by (iv), \(x_0x_1\in R_e^*\). If \(x_1x_2\in R_e\), then \(x_1x_2\in R_e^*\) by (v). Since \(x_1x_2\in R_e^*\) and the \((x_1,x_\ell )\)-subpath of *P* has length \(\ell -1\), we have that \(v\in R_v^*\) or \(v\in Y_v^*\) by induction. Suppose that \(x_1x_2\notin R_e\). Then because \(x_1x_2\in L\), \(x_2\in R_v\) and by (vii), \(x_2\in R_v^*\). If \(\ell =2\), then \(x_\ell \in R_v^*\). Otherwise, as the \((x_2,x_\ell )\)-subpath of *P* has length \(\ell -2\), we have that \(v\in R_v^*\) or \(v\in Y_v^*\) by induction.

**Case 3.**\(x_0x_1\notin R_e\). Then \(u=x_0\in R_v^*\cup Y_v^*\). Because \(x_0x_1\in L\), \(x_0\in R_v^*\). If \(x_1x_2\in R_e\), then \(x_1x_2\in R_e^*\) by (vii). Since \(x_1x_2\in R_e^*\) and the \((x_1,x_\ell )\)-subpath of *P* has length \(\ell -1\), we have that \(v\in R_v^*\) or \(v\in Y_v^*\) by induction. Suppose that \(x_1x_2\notin R_e\). Then because \(x_1x_2\in L\), \(x_2\in R_v\) and by (vi), \(x_2\in R_v^*\). If \(\ell =2\), then \(x_\ell \in R_v^*\). Otherwise, as the \((x_2,x_\ell )\)-subpath of *P* has length \(\ell -2\), we have that \(v\in R_v^*\) or \(v\in Y_v^*\) by induction.

Suppose that \(e'\in R_e^i\). Then \(H_i\) has a path \(P=x_0\ldots x_\ell \) such that \(u=x_0\) or \(e=x_0x_1\), and \(x_{\ell -1}x_\ell =e'\). Using the same inductive arguments as before, we obtain that \(e'\in R_e^*\). \(\blacksquare \)

By Claim A, we have that if there is a colorful solution (*U*, *D*, *A*), then for its base \((R_v^*,Y_v^*,R_e^*)\), \(R_v^*=\bigcup _{i\in I}R_v^i\), \(Y_v^*=\bigcup _{i\in I}Y_v^i\) and \(R_e^*=\bigcup _{i\in I}R_e^i\) for some set of indices \(I\subseteq \{1,\ldots ,s\}\).

The next property is a straightforward corollary of the definition of *H*.

**Claim B.***For distinct *\(i,j\in \{1,\ldots ,s\}\), *if *\(u\in V(H_i)\)*and *\(v\in V(H_j)\)*are adjacent in **G*,*then either *\(u,v\in B_v\)*or (*\(u\in Y_v^i\)*and *\(v\in B_v\)*) or (*\(u\in B_v\)*and *\(v\in Y_v^j\)*)*.

- (i)
\(t_{vd}\le k_{vd}\), \(t_{ed}\le k_{ed}\) and \(t_{ea}\le k_{ea}\),

- (ii)
\(X=\{d_1,\ldots ,d_h\}\) is a collection (multiset) of integers, where \(h\in \{1,\ldots ,2t_{ea}\}\) and \(d_i\in \{0,\ldots ,\varDelta \}\) for \(i\in \{1,\ldots ,h\}\),

- (iii)
\(\delta =(\delta _0,\ldots ,\delta _{r})\), where \(r=\max \{\varDelta ,\varDelta (G)\}\) and \(\delta _i\) is a nonnegative integer for \(i\in \{0,\ldots ,r\}\),

*U*,

*D*,

*A*) is a

*partial solution*with the base \((R_v^*,Y_v^*,R_e^*)\) defined by \(I\subseteq \{1,\ldots ,i\}\) with the following properties.

- (iv)
\(R_v^*=\bigcup _{i\in I}R_v^i\), \(Y_v^*=\bigcup _{i\in I}Y_v^i\) and \(R_e^*=\bigcup _{i\in I}R_e^i\), and \(t_{vd}=|R_v^*|\) and \(t_{ed}=|R_e^*|\).

- (v)
\(U=R_v^*\), \(D=R_e^*\), \(|A|=t_{ea}\) and for any \(uv\in A\), \(u,v\in Y_v^*\).

- (vi)
The multiset \(\{d_{G'}(y)\mid y\in Y_v^* \}=X\), where \(G'=G-U-D+A\).

- (vii)
\(\delta (G')=\delta \).

In other words, \(t_{vd}\) ,\(t_{ed}\) and \(t_{ea}\) are the numbers of deleted vertices, deleted edges and added edges respectively, *X* is the multiset of degrees of yellow vertices in the base of a partial solution, and \(\delta \) is the degree vector of the graph obtained from *G* by the editing with respect to a partial solution. Notice that the values of \(\gamma \) are defined only for some \(t_{vd},t_{ed},t_{ea},X,\delta \) that satisfy (i)–(iii), as a partial solution with the properties (iv)–(vii) not necessarily exists, and we only keep records corresponding to the arguments \(t_{vd},t_{ed},t_{ea},X,\delta \) for which \(\gamma \) is defined.

Now we explain how we construct the tables for \(i\in \{0,\ldots ,s\}\).

**Construction of**\(T_0\). The table \(T_0\) contains the unique record \((0,0,0,\emptyset ,\delta )=(\emptyset ,\emptyset ,\emptyset ,\emptyset )\), where \(\delta =\delta (G)\) (notice that the length of \(\delta \) can be bigger than the length of \(\delta (G)\)).

**Construction of **\(T_i\)**for **\(i\ge 1\). We assume that \(T_{i-1}\) is already constructed. Initially we set \(T_i=T_{i-1}\). Then for each record \(\gamma (t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\) in \(T_{i-1}\), we construct new records \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U',D',A')\) and put them in \(T_i\) unless \(T_i\) already contains the value \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')\). In the last case we keep the old value.

Let \((t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\) in \(T_{i-1}\).

If \(t_{vd}+|R_v^i|>k_{vd}\) or \(t_{ed}+|R_e^i|>k_{ed}\) or \(t_{ea}+2|Y_v^i|>k_{ea}\), then stop considering the record. Otherwise, let \(t_{vd}'=t_{vd}+|R_v^i|\) and \(t_{ed}'=t_{ed}+|R_e^i|\).

Let \(F=G-U-D+A-R_v^i-R_e^i\).

Let \(\bigcup _{j\in I}Y_v^j=\{x_1,\ldots ,x_h\}\), \(d_F(x_f)=d_f\) for \(f\in \{1,\ldots ,h\}\). Let \(Y_v^i=\{y_1,\ldots ,y_{\ell }\}\). Consider every \(E_1\subseteq \left( {\begin{array}{c}Y_v^i\\ 2\end{array}}\right) \setminus E(F[Y_v^i])\) and \(E_2\subseteq \{x_fy_i\mid 1\le f\le h,1\le j\le \ell \}\) such that \(|E_1|+|E_2|\le k_{ea}-t_{ea}\), and set \(\alpha _f=|\{x_fy_j\mid x_fy_j\in E_2,1\le j\le \ell \}|\) for \(f\in \{1,\ldots ,h\}\) and set \(\beta _j=|\{e\mid e\in E_1,e\text { is incident to }y_j\}|+|\{x_fy_j\mid x_fy_j\in E_2,1\le f\le h\}|\) for \(j\in \{1,\ldots ,\ell \}\).

If \(d_f+\alpha _f>\varDelta \) for some \(f\in \{1,\ldots ,h\}\) or \(d_{F}(y_j)+\beta _j>\varDelta \) for some \(j\in \{1,\ldots ,\ell \}\), then stop considering the pair \((E_1,E_2)\).

Set \(t_{ea}'=t_{ea}+|E_1|+|E_2|\), \(X'=\{d_1+\alpha _1,\ldots ,d_h+\alpha _h,d_F(y_1)+\beta _1,\ldots ,d_F(y_\ell )+\beta _\ell \}\).

Let \(F'=F+E_1+E_2\). Construct \(\delta '=(\delta _0',\ldots ,\delta _{r}')=\delta (F')\).

Set \(U'=U\cup R_v^i\), \(D'=D\cup R_e^i\), \(A'=A\cup E_1\cup E_2\), \(I'=I\cup \{i\}\), set \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U',D',A',I')\) and put the record in \(T_i\).

We consecutively construct \(T_1,\ldots ,T_s\). The algorithm returns a YES-answer if \(T_s\) contains a record \((t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\) for \(\delta =\delta (\sigma )\) and (*U*, *D*, *A*) is a colorful solution in this case. Otherwise, the algorithm returns a NO-answer.

The correctness of the algorithm follows from the next claim.

**Claim C.***For each *\(i\in \{1,\ldots ,s\}\), *the table *\(T_i\)*contains a record *\(\gamma (t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\), *if and only if there are *\(t_{vd},t_{ed},t_{ea},X,\delta \)*satisfying (i)-(iii) such that there is a partial solution *\((U^*,D^*,A^*)\)*and *\(I^*\subseteq \{1,\ldots ,i\}\)*that satisfy (iv)-(vii). In particular *\(t_{vd},t_{ed},t_{ea},X,\delta \), (*U*, *D*, *A*) *and **I**satisfy (i)–(vii) if *\(\gamma (t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\)*is in *\(T_i\).

*Proof*

*(of Claim C).* We prove the claim by induction on *i*. It is straightforward to see that it holds for \(i=0\). Assume that \(i>0\) and the claim is fulfilled for \(T_{i-1}\).

Suppose that a record \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U',D',A',I')\) was added in \(T_i\). Then ether \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U',D',A',I')\) was in \(T_{i-1}\) or it was constructed for some record \((t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\) from \(T_{i-1}\). In the first case, \(t_{vd}',t_{ed}',t_{ea}',X',Q'\), \((U',D',A')\) and \(I'\subseteq \{1,\ldots ,i\}\) satisfy (i)–(vii) by induction. Assume that \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U',D',A',I')\) was constructed for some record \((t_{vd},t_{ed},t_{ea},X,Q)=(U,D,A,I)\) from \(T_{i-1}\). Notice that \(i\in I'\) in this case. Let \(I=I'\setminus \{i\}\). Consider \(\bigcup _{j\in I}Y_v^j=\{x_1,\ldots ,x_h\}\) and \(Y_v^i=\{y_1,\ldots ,y_{\ell }\}\). By Claim B, \(x_f\) and \(y_j\) are not adjacent for \(f\in \{1,\ldots ,h\}\) and \(j\in \{1,\ldots ,\ell \}\). Then it immediately follows from the description of the algorithm that \(t_{vd}',t_{ed}',t_{ea}',X',\delta '\), \((U',D',A')\) and \(I'\) satisfy (i)–(vii).

Suppose that there are \(t_{vd},t_{ed},t_{ea},X,\delta \) satisfying (i)-(iii) such that there is a partial solution \((U^*,D^*,A^*)\) and \(I^*\subseteq \{1,\ldots ,i\}\) that satisfy (iv)-(vii). Suppose that \(i\notin I^*\). Then \(T_{i-1}\) contains a record \(\gamma (t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\) by induction and, therefore, this record is in \(T_i\). Assume from now that \(i\in I^*\). Let \(I'=I^*\setminus \{i\}\). Consider \(R_v'=\bigcup _{j\in I'}R_v^j\) and \(Y_v'=\bigcup _{j\in I'}Y_v^j\). Let \(E_1=\{uv\in A\mid u,v\in T_v^i\}\) and \(E_2=\{uv\in A\mid u\in Y_v',v\in Y_v^i\}\). Define \(U'=U\setminus R_v^i\), \(D'=D\setminus R_e^i\) and \(A'=A\setminus (E_1\cup E_2)\). Let \(t_{vd}'=|U'|\), \(t_{ed}=|D'|\) and \(t_{ea}=|A'|\). Consider the multiset of integers \(X'=\{d_F(v)\mid v\in Y_v'\}\) and the sequence \(\delta '=(\delta _1',\ldots ,\delta _r')=\delta (F)\) for \(F=G-U'-D'+A'\). We obtain that \(t_{vd}',t_{ed}',t_{ea}',X',\delta '\), \((U',D',A')\) and \(I'\subseteq \{1,\ldots ,i-1\}\) satisfy (i)-(vii). By induction, \(T_{i-1}\) contains a record \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U'',D'',A'',I'')\). Let \(Y_v'=\{x_1,\ldots ,x_h\}\), \(\bigcup _{j\in I''}Y_v^j=\{x_1',\ldots ,x_h'\}\) and assume that \(d_F(x_f)=d_{F'}(x_f')\) for \(f\in \{1,\ldots ,h\}\), where \(F'=G-U''-D''+A''\). Consider \(E_2'\) obtained from \(E_2\) by the replacement of every edge \(x_fv\) by \(x_f'v\) for \(f\in \{1,\ldots ,h\}\) and \(v\in Y_v^i\). It remains to observe that when we consider \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U'',D'',A'',I'')\) and the pair \((E_1,E_2')\), we obtain \(\gamma (t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\) for \(U=U''\cup R_v^i\), \(D=D''\cup R_e^i\), \(A=A''\cup E_1\cup E_2'\) and \(I=I''\cup \{i\}\). \(\blacksquare \)

Now we evaluate the running time of the dynamic programming algorithm.

*U*,

*D*,

*A*). Since at most \(k_{vd}\) vertices of \(W_i\) can be deleted and we can modify degrees of at most \((k+\varDelta )k_{vd}+2(k_{ed}+k_{ea})\) vertices, \(\delta _i'-\delta _i\le (k+\varDelta +1)k_{vd}+2(k_{ed}+k_{ea})\). Similarly, if \(\delta _i>\delta _i'\), then at least \(\delta _i-\delta _i'\) vertices of \(V(G)\setminus W_i\) should get modified degrees. Since we can modify degrees of at most \((k+\varDelta )k_{vd}+2(k_{ed}+k_{ea})\) vertices, \(\delta _i-\delta _i'\le (k+\varDelta )k_{vd}+2(k_{ed}+k_{ea})\). We conclude that for each \(i\in \{0,\ldots ,r\}\),

*X*is at most \((\varDelta +1)^{2k}\) and there are at most \(3(k+1)\) possibilities for \(t_{vd},t_{ed},t_{ea}\). We conclude that each \(T_i\) has \(2^{O((\varDelta +k)\log (\varDelta +k))}\) records.

To construct a new record \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U',D',A',I')\) from \(\gamma (t_{vd},t_{ed},t_{ea},X,\delta )=(U,D,A,I)\) we consider all possible choices of \(E_1\) and \(E_2\). Since these edges have their end-vertices in a set of size at most \(2k_{ea}\) and \(|E_1|+|E_2|\le k_{ea}\), there are \(2^{O(k\log k)}\) possibilities to choose \(E_1\) and \(E_2\). The other computations in the construction of \(\gamma (t_{vd}',t_{ed}',t_{ea}',X',\delta ')=(U',D',A',I')\) can be done in linear time. We have that \(T_i\) can be constructed from \(T_{i-1}\) in time \(2^{O((\varDelta +k)\log (\varDelta +k))}\cdot n\) for \(i\in \{1,\ldots ,s\}\). Since \(s\le n\), the total time is \(2^{O((\varDelta +k)\log (\varDelta +k))}\cdot n^2\).

We proved that a colorful solution can be found in time \(2^{O((\varDelta +k)\log (\varDelta +k))}\cdot n^2\) if it exists. Clearly, any colorful solution is a solution for \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) and we can return it, but nonexistence of a colorful solution does not imply that there is no solution. Hence, to find a solution, we run the randomized algorithm *N* times, i.e., we consider *N* random colorings and try to find a colorful solution for them. If we find a solution after some run, we return it and stop. If we do not obtain a solution after *N* runs, we return a NO-answer. The next claim shows that it is sufficient to run the algorithm \(N=6^{2k(\varDelta +k)^2}\) times.

**Claim D.***There is a positive **p**that does not depend on the instance such that if the randomized algorithm has not found a solution for *\((G,\sigma ,k_{vd},k_{ed},k_{ea})\)*after *\(N=6^{2k(\varDelta +k)^2}\)*executions, then the probability that *\((G,\sigma ,k_{vd},k_{ed},k_{ea})\)*is a no-instance is at least **p*.

*Proof*

*(of Claim D).* Suppose that \((G,\sigma ,k_{vd},k_{ed},k_{ea})\) has a solution (*U*, *D*, *A*). Let *X* be the set of end-vertices of the edges of *D* and *Y* is the set of end-vertices of *A*. Let \(W=N_G^2[U]\cup N_G[X\cup Y]\) and denote by *L* the set of edges incident to the vertices of \(N_G[U]\cup X\cup Y\). The algorithm colors the vertices of *G* independently and uniformly at random by three colors and the edges are colored by two colors. Notice that if the vertices of *W* and the edges of *L* are colored correctly with respect to the solution, i.e., the vertices of *U* are red, the vertices of *Y* are yellow, all the other vertices are blue, the edges of *D* are red and all the other edges are blue, then (*U*, *D*, *A*) is a colorful solution. Hence, the algorithm can find a solution in this case.

We find a lower bound for the probability that the vertices of *W* and the edges of *L* are colored correctly with respect to the solution. Recall that \({\varDelta (G)\le \varDelta +k}\). Hence, \(|W|\le k_{vd}(\varDelta +k)^2+2(k_{ed}+k_{ea})(\varDelta +k)\le 2k(\varDelta +k)^2\) and \(|L|\le k_{vd}(\varDelta +k)^2+2(k_{ed}+k_{ea})(\varDelta +k)\le 2k(\varDelta +k)^2\). As the vertices are colored by three colors and the edges by two, we obtain that the probability that the vertices of *W* and the edges of *L* are colored correctly with respect to the solution is at least \(3^{-2k(\varDelta +k)^2}\cdot 2^{-2k(\varDelta +k)^2}=6^{-2k(\varDelta +k)^2}\).

The probability that the vertices of *W* and the edges of *L* are not colored correctly with respect to the solution is at most \(1-6^{-2k(\varDelta +k)^2}\), and the probability that these vertices are not colored correctly with respect to the solution for neither of \(N=6^{2k(\varDelta +k)^2}\) random colorings is at most \((1-1/N)^{N}\), and the claim follows. \(\blacksquare \)

Claim D implies that the running time of the randomized algorithm is \(2^{O(k(\varDelta +k)^2)}\cdot n^2\).

The algorithm can be derandomized by standard techniques (see [1, 7]) because random colorings can be replaced by the colorings induced by *universal sets*. Let *m* and *r* be positive integers, \(r\le m\). An *(m, r)-universal set* is a collection of binary vectors of length *m* such that for each index subset of size *r*, each of the \(2^r\) possible combinations of values appears in some vector of the set. It is known that an (*m*, *r*)-universal set can be constructed in FPT-time with the parameter *r*. The best construction is due to Naor, Schulman and Srinivasan [22]. They obtained an (*m*, *r*)-universal set of size \(2^r\cdot r^{O(\log r)} \log m\), and proved that the elements of the sets can be listed in time that is linear in the size of the set.

In our case we have \(m=|V(G)|+|E(G)|\le ((\varDelta +k)/2+1)n\) and \(r=4k(\varDelta +k)^2\), as we have to obtain the correct coloring of *W* and *L* corresponding to a solution (*U*, *D*, *A*). Observe that colorings induced by a universal set are binary and we use three colors. To fix it, we assume that the coloring of the vertices and edges is done in two stages. First, we color the elements of *G* by two colors: red and green, and then recolor the green elements by yellow or blue. By using an (*m*, *r*)-universal set of size \(2^r\cdot r^{O(\log r)} \log m\), we get \(4^r\cdot r^{O(\log r)} \log m\) colorings by three colors. We conclude that the running time of the derandomized algorithm is \(2^{O(k(\varDelta +k)^2)}\cdot n^2\log n\). \(\square \)

## 4 Kernelization for Editing to a Graph with a Given Degree Sequence

In this section we show that Editing to a Graph with a Given Degree Sequence has a polynomial kernel when parameterized by \(k+\varDelta \) if \(S=\{ea\}\), but for all other nonempty \(S\subseteq \{{ vd},{ ed},{ ea}\}\), there is no polynomial kernel unless \(\mathrm{NP}\subseteq \mathrm{coNP}/\text {poly}\).

**Theorem 3**

If \(S=\{{ ea}\}\), then Editing to a Graph with a Given Degree Sequence parameterized by \(k+\varDelta \) has a kernel with \(O(k\varDelta ^2)\) vertices, where \(\varDelta =\max \sigma \).

*Proof*

Let \((G,\sigma ,k)\) be an instance of Editing to a Graph with a Given Degree Sequence and \(\varDelta =\max \sigma \). If \(\varDelta (G)>\varDelta \), \((G,\sigma ,k)\) is a no-instance, because by edge additions it is possible only to increase degrees. Hence, we immediately stop and return a NO-answer in this case. Assume from now that \(\varDelta (G)\le \varDelta \). For \(i\in \{0,\ldots ,\varDelta \}\), denote \(W_i=\{v\in V(G)\mid d_G(v)=i\}\) and \(\delta _i=|W_i|\). Let \(s_i=\min \{\delta _i,2k(\varDelta +1)\}\) and let \(W_i'\subseteq W_i\) be an arbitrary set of size \(s_i\) for \(i\in \{0,\ldots ,\varDelta \}\). We consider \(W=\bigcup _{i=0}^\varDelta W_i'\) and prove the following claim.

**Claim A.***If *\((G,\sigma ,k)\)*is a yes-instance of *Editing to a Graph with a Given Degree Sequence, *then there is *\(A\subseteq \left( {\begin{array}{c}V(G)\\ 2\end{array}}\right) \setminus E(G)\)*such that *\(\sigma (G+A)=\sigma \), \(|A|\le k\)*and for any *\(uv\in A\), \(u,v\in W\).

*Proof*

*(of Claim A).* Suppose that \(A\subseteq \left( {\begin{array}{c}V(G)\\ 2\end{array}}\right) \setminus E(G)\) is a solution for \((G,\sigma ,k)\), i.e., \(\sigma (G+A)=\sigma \) and \(|A|\le k\), such that the total number of end-vertices of the edges of *A* in \(V(G)\setminus W\) is minimum. Suppose that there is \(i\in \{0,\ldots ,\varDelta \}\) such that at least one edge of *A* has at least one end-vertex in \(W_i\setminus W_i'\). Clearly, \(s_i= 2k(\varDelta +1)\). Denote by \(\{x_1,\ldots ,x_p\}\) the set of end-vertices of the edges of *A* in \(W_i\) and let \(\{y_1,\ldots ,y_q\}\) be the set of end-vertices of the edges of *A* in \(V(G)\setminus W_i\). Since \(p+q\le 2k\), \(\varDelta (G)\le \varDelta \) and \(s_i=2k(\varDelta +1)\), there is a set of vertices \(\{x_1',\ldots ,x_p'\}\subseteq W_i'\) such that the vertices of this set are pairwise nonadjacent and are not adjacent to the vertices of \(\{y_1,\ldots ,y_q\}\). We construct \(A'\subseteq \left( {\begin{array}{c}V(G)\\ 2\end{array}}\right) \setminus E(G)\) by replacing every edge \(x_iy_j\) by \(x_i'y_j\) for \(i\in \{1,\ldots ,p\}\) and \(j\in \{1,\ldots ,q\}\), and every edge \(x_ix_j\) is replaced by \(x_i'x_j'\) for \(i,j\in \{1,\ldots ,p\}\). It is straightforward to verify that \(A'\) is a solution for \((G,\sigma ,k)\), but \(A'\) has less end-vertices outside *W* contradicting the choice of *A*. Hence, no edge of *A* has an end-vertex in \(V(G)\setminus W\). \(\blacksquare \)

If \(\delta _i\le 2k(\varDelta +1)\) for \(i\in \{0,\ldots ,\varDelta \}\), then we return the original instance \((G,\sigma ,k)\) and stop, as \(|V(G)|\le 2k(\varDelta +1)^2\). From now we assume that there is \(i\in \{0,\ldots ,\varDelta \}\) such that \(\delta _i>2k(\varDelta +1)\). We construct the graph \(G'\) as follows.

Delete all the vertices of \(V(G)\setminus W\).

Construct \(h=\varDelta +2\) new vertices \(v_1,\ldots ,v_h\) and join them by edges pairwise to obtain a clique.

For any \(u\in W\) such that \(r=|N_G(u)\cap (V(G)\setminus W)|\ge 1\), construct edges \(uv_1,\ldots ,uv_r\).

Notice that \(d_{G'}(v_1)\ge \ldots \ge d_{G'}(v_h)\ge \varDelta +1\) and \(d_{G'}(u)=d_G(u)\) for \(u\in W\). Now we consider the sequence \(\sigma \) and construct the sequence \(\sigma '\) as follows.

The first

*h*elements of \(\sigma '\) are \(d_{G'}(v_1),\ldots ,d_{G'}(v_h)\).Consider the elements of \(\sigma \) in their order and for each integer \(i\in \{0,\ldots ,\varDelta \}\) that occurs \(j_i\) times in \(\sigma \), add \(j_i-(\delta _i-s_i)\) copies of

*i*in \(\sigma '\).

We claim that \((G,\sigma ,k)\) is a yes-instance of Editing to a Graph with a Given Degree Sequence if and only if \((G',\sigma ',k)\) is a yes-instance of the problem.

Suppose that \((G,\sigma ,k)\) is a yes-instance of Editing to a Graph with a Given Degree Sequence. By Claim A, it has a solution \(A\subseteq \left( {\begin{array}{c}V(G)\\ 2\end{array}}\right) \setminus E(G)\) such that for any \(uv\in A\), \(u,v\in W\). It is straightforward to verify that \(\sigma (G'+A)=\sigma '\), i.e., *A* is a solution for \((G',\sigma ',k)\). Assume that \(A\subseteq \left( {\begin{array}{c}V(G')\\ 2\end{array}}\right) \setminus E(G)\) is a solution for \((G',\sigma ',k)\). Because \(d_{G'}(v_1),\ldots ,d_{G'}(v_h)\) are the first *h* elements of \(\sigma '\) and \(d_{G'}(u)=d_G(u)\le \varDelta \) for \(u\in W\), for any \(uv\in A\), \(u,v\in W\). Then it is straightforward to check that \(\sigma (G+A)=\sigma \), i.e., *A* is a solution for \((G,\sigma ,k)\). \(\square \)

We complement Theorem 3 by showing that it is unlikely that Editing to a Graph with a Given Degree Sequence parameterized by \(k+\varDelta \) has a polynomial kernel for \(S\ne \{{ ea}\}\). The proof is based on the cross-composition technique introduced by Bodlaender, Jansen and Kratsch [3].

**Theorem 4**

If nonempty \(S\subseteq \{{ vd},{ ed},{ ea}\}\) but \(S\ne \{{ ea}\}\), then Editing to a Graph with a Given Degree Sequence has no polynomial kernel unless \(\mathrm{NP}\subseteq \mathrm{coNP}/\text {poly}\) when the problem is parameterized by \(k+\varDelta \) for \(\varDelta =\max \sigma \).

### References

- 1.Alon, N., Yuster, R., Zwick, U.: Color-coding. J. ACM
**42**(4), 844–856 (1995)MathSciNetCrossRefMATHGoogle Scholar - 2.Barabasi, A.L., Albert, R.: Emergence of scaling in random networks. Science
**286**(5439), 509–512 (1999)MathSciNetCrossRefMATHGoogle Scholar - 3.Bodlaender, H.L., Jansen, B.M.P., Kratsch, S.: Kernelization lower bounds by cross-composition. SIAM J. Discrete Math.
**28**(1), 277–305 (2014)MathSciNetCrossRefMATHGoogle Scholar - 4.Boesch, F.T., Suffel, C.L., Tindell, R.: The spanning subgraphs of Eulerian graphs. J. Graph Theory
**1**(1), 79–84 (1977)MathSciNetCrossRefMATHGoogle Scholar - 5.Bredereck, R., Froese, V., Hartung, S., Nichterlein, A., Niedermeier, R., Talmon, N.: The complexity of degree anonymization by vertex addition. In: Gu, Q., Hell, P., Yang, B. (eds.) AAIM 2014. LNCS, vol. 8546, pp. 44–55. Springer, Heidelberg (2014)Google Scholar
- 6.Bredereck, R., Hartung, S., Nichterlein, A., Woeginger, G.J.: The complexity of finding a large subgraph under anonymity constraints. In: Cai, L., Cheng, S.-W., Lam, T.-W. (eds.) Algorithms and Computation. LNCS, vol. 8283, pp. 152–162. Springer, Heidelberg (2013)CrossRefGoogle Scholar
- 7.Cai, L., Chan, S.M., Chan, S.O.: Random separation: a new method for solving fixed-cardinality optimization problems. In: Bodlaender, H.L., Langston, M.A. (eds.) IWPEC 2006. LNCS, vol. 4169, pp. 239–250. Springer, Heidelberg (2006)CrossRefGoogle Scholar
- 8.Cai, L., Yang, B.: Parameterized complexity of even/odd subgraph problems. J. Discrete Algorithms
**9**(3), 231–240 (2011)MathSciNetCrossRefMATHGoogle Scholar - 9.Cornuéjols, G.: General factors of graphs. J. Comb. Theory Ser. B
**45**(2), 185–198 (1988)MathSciNetCrossRefMATHGoogle Scholar - 10.Cygan, M., Fomin, F.V., Kowalik, L., Lokshtanov, D., Marx, D., Pilipczuk, M., Pilipczuk, M., Saurabh, S.: Parameterized Algorithms. Springer, Heidelberg (2015)CrossRefMATHGoogle Scholar
- 11.Cygan, M., Marx, D., Pilipczuk, M., Pilipczuk, M., Schlotter, I.: Parameterized complexity of Eulerian deletion problems. Algorithmica
**68**(1), 41–61 (2014)MathSciNetCrossRefMATHGoogle Scholar - 12.Dabrowski, K.K., Golovach, P.A., van ’t Hof, P., Paulusma, D.: Editing to eulerian graphs. In: FSTTCS 2014. LIPIcs, vol. 29, pp. 97–108. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2014)Google Scholar
- 13.Dabrowski, K.K., Golovach, P.A., van ’t Hof, P., Paulusma, D., Thilikos, D.M.: Editing to a planar graph of given degrees. In: Beklemishev, L.D., Musatov, D.V. (eds.) CSR 2015. LNCS, vol. 9139, pp. 143–156. Springer, Heidelberg (2015)Google Scholar
- 14.Downey, R.G., Fellows, M.R.: Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer, Heidelberg (2013)CrossRefMATHGoogle Scholar
- 15.Froese, V., Nichterlein, A., Niedermeier, R.: Win-win kernelization for degree sequence completion problems. In: Ravi, R., Gørtz, I.L. (eds.) SWAT 2014. LNCS, vol. 8503, pp. 194–205. Springer, Heidelberg (2014)CrossRefGoogle Scholar
- 16.Golovach, P.A.: Editing to a connected graph of given degrees. In: Csuhaj-Varjú, E., Dietzfelbinger, M., Ésik, Z. (eds.) MFCS 2014, Part II. LNCS, vol. 8635, pp. 324–335. Springer, Heidelberg (2014)Google Scholar
- 17.Golovach, P.A.: Editing to a graph of given degrees. Theoret. Comput. Sci.
**591**, 72–84 (2015)MathSciNetCrossRefMATHGoogle Scholar - 18.Hartung, S., Nichterlein, A., Niedermeier, R., Suchý, O.: A refined complexity analysis of degree anonymization in graphs. Inf. Comput.
**243**, 249–262 (2015)MathSciNetCrossRefMATHGoogle Scholar - 19.Hartung, S., Talmon, N.: The complexity of degree anonymization by graph contractions. In: Jain, R., Jain, S., Stephan, F. (eds.) TAMC 2015. LNCS, vol. 9076, pp. 260–271. Springer, Heidelberg (2015)Google Scholar
- 20.Mathieson, L., Szeider, S.: Editing graphs to satisfy degree constraints: A parameterized approach. J. Comput. Syst. Sci.
**78**(1), 179–191 (2012)MathSciNetCrossRefMATHGoogle Scholar - 21.Moser, H., Thilikos, D.M.: Parameterized complexity of finding regular induced subgraphs. J. Discrete Algorithms
**7**(2), 181–190 (2009)MathSciNetCrossRefMATHGoogle Scholar - 22.Naor, M., Schulman, L., Srinivasan, A.: Splitters and near-optimal derandomization. In: FOCS 1995, pp. 182–191. IEEE (1995)Google Scholar