# Complexity results for identifying codes in planar graphs

## Abstract

Let G be a simple, undirected, connected graph with vertex set V(G) and ��⊆V(G) be a set of vertices whose elements are called codewords. For vV(G) and r1, let us denote by Ir��(v) the set of codewords c∈�� such that d(vc)r, where the distance d(vc) is defined as the length of a shortest path between v and c. More generally, for AV(G), we define , which is the set of codewords whose minimum distance to an element of A is at most r. If r and l are positive integers, �� is said to be an (rl)-identifying code if one has Ir��(A)≠Ir��(A′) whenever A and A′ are distinct subsets of V(G) with at most l elements. We consider the problem of finding the minimum size of an (rl)-identifying code in a given graph. It is already known that this problem is NP-hard in the class of all graphs when l=1 and r1. We show that it is also NP-hard in the class of planar graphs with maximum degree at most three for all (rl) with r1 and l∈{1, 2}. This shows, in particular, that the problem of computing the minimum size of an (r2)-identifying code in a given graph is NP-hard.

## 1. Notation and definitions

By graph, we mean an undirected graph without loops or multiple edges. If G is a graph, we denote the sets of vertices and edges of G by V(G) and E(G), respectively. An edge {xy}∈E(G) with xyV(G) will be simply denoted by xy. We refer to Diestel (2005) for basic notions such as adjacent vertices, paths, cycles or the neighbourhood of a vertex. Let us recall the distinction between a subgraph and an induced subgraph: a subgraph of G is a graph H with V(H)⊆V(G) and E(H)⊆E(G), whereas if WV(G), the subgraph induced by G on W is the graph G[W] whose vertex set is W, and whose edges are all the edges xyE(G) with x and y in W.

From now on, we consider only connected graphs; for vV and rN, the ball of radius r centered at v is the set

where d(vw) denotes the number of edges in any shortest path between v and w, i.e. the length of any shortest path between v and w. Whenever d(vw)r, we say that v and w r-cover each other (or simply cover if there is no ambiguity). A vertex cV(G) is said to r-separate (or simply separate) vertices x and y if c r-covers one of them and does not r-cover the other.

In this paper, what we call a code is simply a set of vertices ��⊆V(G), and we refer to its elements as codewords. A code �� is said to be r-covering (or r-distance-dominating) if every vertex vV(G) is r-covered by at least one codeword c∈��. A code �� is said to be r-separating if for every pair of distinct vertices xy of G, there exists a codeword c∈�� that r-separates x and y.

An r-identifying code is a code, which is both r-covering and r-separating. Equivalently, ��⊆V(G) is an r-identifying code if all the sets

for vV(G) are non-empty and different.

More generally, if �� is a code and A is a subset of V(G), we denote by Ir��(A) the set of codewords, which r-cover at least one element of A, i.e.

If r and l are positive integers, an (rl)-identifying code is a code �� such that the sets Ir��(A) for all AV(G) with are different. Note that, in this case, as , then for ; thus, an (r1)-identifying code is simply an r-identifying code.

We recall that the degree of a vertex vV(G) is the number δ(v) of vertices wV(G) such that vwE(G). The maximum degree of G is defined as

Finally, a graph is planar if it can be drawn in the plane in such a way that its edges do not cross. For precise definitions and additional background about graphs, we refer once again to Diestel (2005). The reader will also need basic knowledge in algorithmic complexity such as polynomial reduction and NP-completeness; for these notions, we refer to Garey and Johnson (1979).

## 2. Introduction and main results

The problem of finding an identifying code of minimum size in a graph was introduced and studied in Karpovsky et al. (1998); the original motivation was fault detection in processor systems. It was shown in Charon et al. (2003) that the computation of the minimum size of an r-identifying code in a given graph is NP-hard for any r1; furthermore, it was proved in Gravier et al. (2008) that this problem is APX-hard for r=1. In particular, this implies that if PNP, there exists a constant c>1 such that no polynomial algorithm gives an efficiency ratio better than c. Indeed there is, for all r1, a polynomial approximation algorithm, which computes an r-identifying code with an efficiency ratio of , but the sublogarithmic ratios are intractable (see Suomela, 2007). For a nearly comprehensive bibliography about identifying codes (see Lobstein, 2010).

In this paper, we prove NP-hardness results for the restriction of this same problem to the class of planar graphs with maximum degree at most three; this class is quite restrictive, as connected graphs with maximum degree at most two are paths and cycles where the size of a minimum r-identifying code is known exactly in most cases (see Bertrand et al., 2004; Gravier et al., 2006; Roberts and Roberts, 2008; Xu et al., 2008). We also study the problem of finding the minimum size of an (r2)-identifying code and prove its NP-hardness in the class of planar graphs with maximum degree at most three for all r1, which of course implies its NP-hardness in the class of all graphs. These codes have been investigated in Laihonen and Ranto (2001), Gravier and Moncel (2005) and Laihonen and Moncel (2008); but to our knowledge to date, no complexity result is known about them. Our results show, in particular, that the problem of computing the minimum size of an (r2)-identifying code in a given graph is NP-hard.

Let us denote by Π3 the class of planar graphs with maximum degree at most three, and let r and l be positive integers. The problem that we study is precisely the following one:

Min (rl)-ID-code in Π3

• Instance: a graph G∈Π3 and an integer k;
• Question: is there an (rl)-identifying code �� of G with ?

Our results can be summarized in the following theorem:

Theorem 1.The problem Min (rl)-ID-code in Π3is NP-complete for l∈{1, 2}and all r1.

## 3. Proofs of the complexity results

### 3.1. The vertex cover problem

Let G be a graph. An edge e=xyE(G) is said to be covered by a vertex vV(G) if v and e are incident, i.e. if v=x or v=y. A vertex cover in G is a code ��⊆V(G) such that every edge of G is covered by at least one codeword c∈��. Equivalently, �� is a vertex cover if

It is well known that the problem of finding the minimum cardinality of a vertex cover in a given graph is NP-hard (Karp, 1972); furthermore, it was proved in Garey and Johnson (1977) that this problem remains NP-hard in the class of planar graphs whose maximum degree is at most three. More precisely, the following problem is NP-complete:

Min Vertex Cover in Π3

• Instance: a graph G∈Π3 and an integer k;
• Question: is there a vertex cover �� of G with ?

If r and l are fixed and a code �� is given in a graph G, as all the distances between the vertices of G can be computed in polynomial time, we can also compute all the sets Ir��(A) for AV(G) with and compare them in polynomial time, and thus check that �� is an (rl)-identifying code, therefore, the problem Min (rl)-ID-code in Π3 belongs to NP. We will complete the proof of Theorem 1 by showing that Min Vertex Cover in Π3 polynomially reduces to the problem Min (rl)-ID-code in Π3 for all r1 and l∈{1, 2}; we will consider four cases depending on the values of r and l: r=1, l=1 (Section 3.2), r=2, l=1 (Section 3.3), r3, l=1 (Section 3.4) and r1, l=2 (Section 3.5).

### 3.2. Reduction for r=1 and l=1

In this section, we set r=1 and l=1. Let us consider an instance of Min Vertex Cover in Π3, i.e. a planar graph G with maximum degree at most three and an integer k. We construct a graph G′ by replacing every edge e=xy of G by the structure Ce counting nine vertices and 11 edges as specified by Fig. 1. Note that we do not consider x and y as elements of the structure Ce; thus, Ce is not a graph (because it contains edges without containing their ends), but we will denote the set of its nine vertices by V(Ce) as we would have done if it were one. See also Fig. 2 for an example of transformation.

If G has n vertices and m edges, then G′ has n+9m vertices and 11m edges; thus, G′ can be constructed from G in polynomial time. It is easy to check that G′ is also planar and has maximum degree three. The key result for the reduction is the following:

Proposition 2.With the notation above, G admits a vertex cover �� withif and only if Gadmits a 1-identifying code ��with.

Proof. Let us fix our notation first: if G is the original graph and G′ is the transformed one, we consider the vertex set V(G) of G as a subset of V(G′). Therefore, V(G′) can be partitioned in sets:

Let �� be a vertex cover for G with ; we construct an identifying code ��′ for G′ by adding to �� five vertices in each set V(Ce) for all eE(G); thus, the code ��′ will have cardinality as stated in the proposition. For each edge e=xyE(G), the choice of the set ��′e of five vertices in V(Ce) added to �� will depend on the case x∈�� or y∈��; recall that as we have requested �� to be a vertex cover of G, we have at least one of x and y in ��. As the structure is symmetric, without loss of generality let us assume that x∈��. Then, we define (see Fig. 3)

When this is done for all eE(G), the code ��′ is defined as

It remains to prove that ��′ is a 1-identifying code; because for each edge e=xyE(G), the set of vertices covered by {s1s2s5s6s9} is precisely V(Ce)∪{xy}, it is easily seen that it suffices to check that for every edge e=xy of G, all vertices in

are covered and pairwise separated by ��′. We summarize in Table 1 which codewords cover the different vertices. Note that in Ce, both x and y may belong to ��; this has no consequence as containing an identifying code is a sufficient condition for a set of vertices to be an identifying code.

Table 1.
Covering sets for the vertices of Fig. 3
Vertices/codewordsxs1s2s5s6s9
x
y
s1
s2
s3
s4
s5
s6
s7
s8
s9

Conversely, suppose that there exists a 1-identifying code ��′ for G′ with . First, we prove

(1)

We just have to recall why a 1-identifying code on a cycle on nine vertices must have at least six codewords. To simplify the notation, let us consider that our vertices are integers modulo 9. If a is a vertex of the cycle, then a+1 and a+2 must be separated by a codeword; therefore, a or a+3 must be codewords. The same argument proves that there must be a codeword in {a+3, a+6}, and another in {a+6, a}. Thus, there must be at least two codewords in {aa+3, a+6} for each vertex a. Applied to a∈{1, 2, 3}, this argument shows that there are at least two codewords in each of the sets {1, 4, 7}, {2, 5, 8} and {3, 6, 9}, therefore, .

(2)

As in the previous case, there must be a codeword in {aa+3} for every a, except in the cases when x or y can be used to separate a+1 from a+2, i.e. except for a∈{3, 4, 8, 9}. Hence, there must be at least one codeword in each of the pairs:

We consider three cases:

• if neither s1 nor s5 are codewords, then s4, s2, s8 and s7 must be, as well as one of the pair {s6s9}, and thus we need five codewords at least in V(Ce);
• if s1 and s5 are both codewords, as at least one vertex in the pair {s6s9} is a codeword we can suppose that s6C′ by symmetry; but s3 and s8 are not covered by s1, s5, s6, x or y; therefore, we need at least two other codewords in V(Ce);
• if s1 is a codeword but s5 is not (the other case being the same by symmetry), then s2 and s8 are codewords as well as one of the pair {s6s9}. In both cases, we still need to cover s4 with a codeword in V(Ce).

Let us define �� as the trace of ��′ on V(G), i.e.

Recall that V(G) is a subset of V(G′), and hence �� is a code in G. We would like to use �� in order to build a vertex cover of G. It may occur for an edge e=xyE(G) that in G′ neither x nor y belongs to ��′, and in this case the edge xy of G is not covered by the code ��. Let p be the number of edges eE(G), which are not covered by ��. From (1) and (2), we have

As there are p uncovered edges, if we add to �� one codeword on each edge uncovered by ��, we get a vertex cover of G with at most k codewords.▪

### 3.3. Reduction for r=2 and l=1

For r=2, we use a different strategy for the reduction. The basic idea is to replace every edge e=xyE(G) by a chain on four vertices and five edges (see Fig. 4). Consider the central vertices a and b on the chain; as a 2-identifying code has to separate a from b, we deduce that x or y must be a codeword. Hence, the trace on G of a 2-identifying code of G′ will be a vertex cover of G.

Clearly, this reduction is not entirely satisfactory because we cannot control the total number of codewords in the identifying code. In order to do so, we will add other devices around the chain.

Let G∈Π3 and k be an integer. We construct from G a graph G′ by replacing every edge e=xy in E(G) by a structure Ce counting 11 vertices and 14 edges; see Fig. 5, where the chain xv5v7v8v6y plays the role of the chain in Fig. 4. As in the previous case, we do not consider x and y as elements of V(Ce).

Clearly, G′ can be constructed in polynomial time from G, and G′∈Π3. Let . We will prove:

Proposition 3.G admits a vertex cover��withif and only if Gadmits a 2-identifying code��′with.

Proof. Once again, V(G) is a subset of V(G′); hence, if we consider a vertex cover �� of G with , we can add codewords to �� in order to construct a 2-identifying code for G′. We accomplish this in the following way: if e=xyE(G), then x or y is in ��. Suppose that without loss of generality x∈��. We add to �� the five codewords v3, v4, v6, v8 and v9 on the structure Ce (see Fig. 6).

When this is done for all eE(G), we obtain a code ��′ on G′ with ; hence . To check that ��′ is a 2-identifying code on G′, we just have to see that for every e=xyE(G), the vertices xy and the 11 vertices of Ce are covered by different subsets of {xv3v4v6v8v9}. This is clearly sufficient because for a given e=xyE(G), a vertex belongs to V(Ce)∪{xy} if and only if it is 2-covered by v3, v4 or v9 (see Table 2).

Table 2.
Covering sets for the vertices of Fig. 6
Vertices/codewordsxv3v4v6v8v9
x
y
v1
v2
v3
v4
v5
v6
v7
v8
v9
v10
v11

Conversely, suppose that ��′ is a 2-identifying code of G′ with . Then, if e=xyE(G), consider the codewords on Ce:

• v1 and v2 must be separated by ��′, so v4∈��′;
• v1 must be covered by ��′, so ;
• v2 and v3 must be separated by ��′, so ;
• v10 and v11 must be separated by ��′, so ;
• v11 must be covered by ��′, so .

These five facts show that in each structure Ce, we have ; therefore, the trace of ��′ on V(G)

has cardinality at most

Moreover, in each struture Ce, v7 and v8, which play the same role as a and b in Fig. 4, must be separated by ��′, and hence x or y must belong to ��′, and hence to ��. Thus, �� is a vertex cover of G.▪

### 3.4. Reduction for r3 and l=1

For r3, our reduction uses the same idea as for r=2, but the structure is slightly different. It is easier to present the proof for r=3, but the general case is essentially the same.

Fix r=3 and let G∈Π3. We replace every edge e=xy of E(G) by the structure specified by Fig. 7. In particular, there are five cycles with paths attached on this structure that we call suns. A single sun is displayed in Fig. 8. There are 189 vertices, in Fig. 7, not counting x and y, and our transformation is polynomial; moreover, the new graph G′ is clearly in Π3. Now, we will prove the following proposition, where m=|E(G)|:

Proposition 4.G admits a vertex cover��withif and only if Gadmits a 3-identifying code��′with.

Proof. First, suppose that we have a vertex cover �� of G with . Then, we construct a 3-identifying code ��′ on G′ by adding 70 codewords to �� on each structure Ce; these codewords correspond to 14 codewords on each sun, as in Fig. 8, thus . We leave the readers to convince themselves that this defines a 3-identifying code on G′; just note that as in the case of r=2, the central vertices a and b are separated because x or y belongs to ��, and therefore is a codeword of ��′. Once again, it will be sufficient to check that ��′ 3-separates and 3-covers vertices inside each structure Ce if we first observe that ��′ enables us, for any vertex vV(G′), just by looking at the set , to know if v belongs to V(G) or to identify the structure Ce to which v belongs.

Conversely, if ��′ is a 3-identifying code on G′ with , then consider a single sun of a structure Ce (see Fig. 9). In order to separate vertices v4 and v5, v1 must be a codeword. In order to cover v5, we must have ��′∩{v2v3v4v5}≠∅. The same argument holds for every ray of the sun; therefore, we need at least 2 × 7=14 codewords in it. As there are five suns in Ce we need at least 70 codewords on Ce.

The code ��′ being 3-identifying on G′, it necessarily separates the vertices a and b, i.e. there is at least one codeword in the symmetric difference B(a, 3)ΔB(b, 3). This set is composed of six vertices (see Fig. 7): xy and four vertices belonging to Ce. Note that none of these six vertices was counted above in the 70 codewords. Hence, we have (recall that x and y do not belong to Ce):

• if x or y belong to ��′, then ;
• if neither x nor y belongs to ��′, then .

The conclusion goes exactly like in the case of r=1. Let us define

which is a code on G, and let p be the number of edges eE(G) uncovered by ��. Then,

because we supposed . Thus, if we add one codeword to �� on each of the p edges of G uncovered by ��, we get a vertex cover of G, whose cardinal is at most k.▪

For r4, our proof is exactly the same as in the case of r=3 but the structure has to be adapted. If we consider an edge e=xy of G, we replace it by a path on 2r extra vertices and attach five suns to the path, as in Fig. 10. Each sun is now a cycle on 2r+2 vertices with 2r+1 rays of length r+1. With this structure replacing every edge of G, we obtain a graph G′, satisfying the same properties as in the case of r=3. One can prove the following proposition exactly as it was done for r=3.

Proposition 5.G admits a vertex cover��withif and only if Gadmits an r-identifying code��′with.

### 3.5. Reduction for r1 and l=2

For our transformation, we need to define a restriction of the Min Vertex Cover in Π3 problem. Let Π′3 be the class of graphs G such that:

• G belongs to Π3, i.e. G is planar and every vertex of G has a degree of at most three;
• no vertex of G has degree one;
• if v1 and v2 are distinct vertices of G with degree 2, there exist vertices v1 and v2, distinct from v1 and v2, such that v1 is adjacent to v1 but not to v2, and v2 is adjacent to v2 but not to v1.

We define a problem Min Vertex Cover in Π′3 by analogy with the problem Min Vertex Cover in Π3. We will prove the following result:

Lemma 6.The problem Min Vertex Cover in Π′3is NP-complete.

Before proving this lemma, let us begin with three preliminary results.

Lemma 7.Let G be a graph and xyE(G) be an edge such that the degree of the vertex x is 1, and letbe the graph obtained when we remove x, y and all their incident edges from G. Then, the minimum cardinality of a vertex cover in G equals the minimum cardinality of a vertex cover in Gplus 1 (see Fig. 11).

Proof. Suppose that �� is a minimum vertex cover in G; then, exactly one of x and y belongs to ��, because if we had x and y in ��, then would also be a vertex cover of G. Hence, is a vertex cover of G′ and . Conversely, if ��′ is a (minimum) vertex cover of G′, then ��′∪{y} is a (minimum) vertex cover of G.▪

Lemma 8.Let G be a graph and x be a vertex of degree 2 whose neighbours y and z are adjacent, and letbe the graph obtained when we remove xyz and all their incident edges from G. Then, the minimum cardinality of a vertex cover in G equals the minimum cardinality of a vertex cover in Gplus 2 (see Fig. 12).

Proof. Suppose that �� is a minimum vertex cover in G; then exactly two of the three vertices x, y and z belong to ��, because we need at least two of them to cover the edges xyyz and zx, and if we had xy and z in ��, then would still be a vertex cover of G. Hence, is a vertex cover of G′ and . Conversely, if ��′ is a (minimum) vertex cover of G′, then ��′∪{yz} is a (minimum) vertex cover of G.▪

Note that the previous two lemmas could be generalized in the following way: if x is a simplicial vertex in G, i.e. a vertex x with degree δ1 whose δ neighbours induce a clique in G, then the minimum cardinality of a vertex cover in G is equal to the mimimum cardinality of a vertex cover in plus δ.1

Lemma 9.Let G be a graph and xy be two distinct vertices of G with degree 2, sharing the same neighbours z and z(in particular, x and y are non adjacent). Letbe the graph obtained when we remove xyzzand all their incident edges from G. Then, the minimum cardinality of a vertex cover in G equals the minimum cardinality of a vertex cover in G′ plus 2 (see Fig. 13).

Proof. If �� is a minimum vertex cover in G, then exactly two of the four vertices xyz and z′ belong to ��; the fact that zz′∈E(G) or not does not matter. The conclusion follows as in the previous two lemmas.▪

Proof of Lemma 6. Suppose that G belongs to Π3, but not to Π′3. Then, either:

• there exists a vertex x of degree one in G, and we will apply Lemma 7;
• there exist vertices xy of degree two such that every neighbour of x is either y or adjacent to y. Then:
• if x and y are adjacent, let z be their common neighbour. Then we can apply Lemma 8;
• if x and y are non adjacent, let z and z′ be their (common) neighbours; we can apply Lemma 9.

In the three cases, we obtain a ‘reduced’ graph G′ and we can trivially compute the size of a minimum vertex cover in G if we know the size of a minimum vertex cover in G′. Clearly, the reduced graph G′ is planar and has maximum degree at most three. If this graph does not belong to Π′3, we can reduce it once again, and so on until we obtain an ‘irreducible’ graph G″, i.e. a graph which belongs to Π′3. Thus, we obtain by an algorithm that is obviously polynomial a graph G″∈Π′3 and an integer k such that the size of a minimum vertex cover in G is equal to the size of a minimum vertex cover in G″ plus k. This proves that the problem Min Vertex Cover in Π′3 is algorithmically harder than Min Vertex Cover in Π3. As the converse is obviously true and as Min Vertex Cover in Π3 is NP-complete, we have proved Lemma 6.

Let us now come back to (r2)-identifying codes. Let G∈Π′3; we replace every edge eE(G) of G by a structure Ce which can be seen in Fig. 14. The structure Ce is made of a cycle on 4r+3 vertices, attached to x and y by a path on 2r+1 vertices. As before, we do not consider that x and y belong to V(Ce).

Clearly, if G∈Π′3 then G′∈Π3, and G′ can be computed in polynomial time from G. The reduction of the problem Min Vertex Cover in Π′3 to the problem Min (r2)-ID-code in Π3 will be obtained if we prove:

Proposition 10.G admits a vertex cover��withif and only if Gadmits an (r2)-identifying code��′with.

In order to shorten the proof of Proposition 10, we need two other technical lemmas:

Lemma 11. Let r1 and H be a graph consisting of a path on 3r+1 vertices

a cycle on 4r+3 vertices

and the edge p2r+1c1, which connects the path to the cycle (see Fig. 15). Let W be the set of vertices

and let ��=V(H) be the code consisting of all vertices in H. Then, all the identifying sets Ir��(A), for all with , are distinct.

Proof. The lemma is proved if we show that in the 15 cases given in Table 3.

Table 3.
The 15 cases to study to prove Lemma 11
A1=
12345
6789
(j1<j2)  101112
1314
15

The cases 2, 4, 7, 9, 11 and  14 are easy to check: in cases 2, 4 and  11, the codeword r-covers and neither nor , so Ir��(A1)≠Ir��(A2); similarly, in cases 7, 9 and  14 covers , and neither nor .

In case 1, assuming without loss of generality that j1<i1, covers , not .

In case 3, if , then either , if it exists, or a codeword of type c covers , not ; otherwise, set μ=min{i1j1} and consider pμr.

In cases 5 and  12, one of covers , and neither nor .

Cases 6 and 8 are also easy to handle.

In case 10, consider if i1j1; if i1=j1, then , if it exists, or a codeword of type c will do.

Case 15 is easy, both if i1=j1 and if i1j1.

We are left with case 13, where, instead of showing that , we equivalently show that, given , we can uniquely recover c1 and c2.

It is quite straightforward to observe that, with computations carried modulo 4r+3, the set is of the form , plus maybe vertices of type p, where . Then, .▪

Lemma 12.Let r1 and H be a graph consisting of a path on 2r+1 vertices

a cycle on 4r+3 vertices

and the edge p2r+1c1, which connects the path to the cycle (see Fig. 16). Let��be the code on H defined by

Then, �� is an r-identifying code on H.

Proof. The proof being much simpler than the proof of Lemma 11, we leave it to the readers who will easily convince themselves that the sets Ir��(v) are all non-empty and distinct for all vV(H). ▪

Proof of Proposition 10. Consider a vertex cover �� of G with . As in the previous sections, V(G) is a subset of V(G′), and hence �� is a subset of V(G′). We construct an (r2)-identifying code ��′ of G′ by adding to �� all the vertices in V(Ce) for each eE(G) (cf. Fig. 14). As each structure Ce counts 6r+4 vertices, the code ��′ will have cardinality

Before checking that ��′ is an (r2)-identifying code of G′, let us recall that V(G′) is partitioned in the following way:

Consider a set of vertices with ; if we are given , we want to identify A. If eE(G) let us define Je as the following subset of V(Ce) (see Fig. 14):

We will repeatedly use the following obvious fact:

(3)

Consider three cases:

• First case: there exist two distinct edges e1, e2 in E(G) such that

By (3), we must have and A consists of two vertices v1 and v2 respectively belonging to and . As e1e2, we have ; if we denote by H the graph induced by G′ on (cf. Fig. 16), Lemma 12 implies that is an r-identifying code on H, and thus v1 can be identified. By the same argument v2, and thus A can be identified.

• Second case: there is a single edge e1E(G) such that. In this case, there are three possibilities:
• either and A consists of two vertices x and v1, where xV(G) and ;
• or and A consists of two vertices ;
• or and A consists of a single vertex .

We can simply detect if a vertex xV(G) belongs to A: such a vertex x is r-covered by the vertices pr in each structure Ce such that e is incident with x in G. Suppose that xA. As G∈Π′3, x has a degree at least 2 in G, and hence there must exist two vertices pr and pr in two distinct structures Ce and Ce such that pr and pr belong to . If this happens, we easily find x as the common endpoint of e and e′. Conversely, if , we know that and the vertices pr in structures Ce with ee1 cannot belong to .

Thus, we have proved that in the above three possibilities, we know if we are in the first one and then we can identify x. It will remain to identify the vertex ; as x does not r-cover the vertices of , we know by Lemma 12 that this can be done.

In the case , we must determine if or , and then find A. Let e1=xy, with xyV(G); as �� is a vertex cover of G, we know that x or y belong to ��, and thus to ��′. Let us suppose without loss of generality that x∈��′. The degree of x in G is at least two; therefore, there must exist an edge e2=xz incident with e1 in x. Let us denote by , the vertices on the path of the structure . If we consider the union of the path in , with the vertex x and the set (see Fig. 17), we find an (isometric) induced subgraph of G′ where every vertex is a codeword. Because we know that , Lemma 11 can be applied, with x playing the role of p0, and thus A can be identified.

• Third case: for all eE(G) we have.

Then by (3), A consists of one or two vertices that belong to V(G). Let us denote by F the set of edges e=xyE(G) such that the vertex pr of Ce belongs to . If e=xyF, with xyV(G), we know that xA or yA, and the converse is also true; thus, F is precisely the set of edges of G, which are incident in G with the vertex, or the two vertices, in A. Can we find A if F is given?

Let us consider the graph G[F] whose edge set is F and whose vertex set consists of the elements of V(G) incident with at least one edge in F (this is not always an induced subgraph of G). We claim that we can identify A by looking at the degrees of its vertices in G and in G[F].

Note that if zA, then z has the same degree in G[F] as in G, and this degree is two or three because G∈Π′3; and if , then z, in G[F], can have neighbours only in A, and hence its degree is one or two.

Thus, if , every vertex of G[F] has degree one in G[F] with the exception of the vertex x such that A={x}; whereas if , there must exist at least two vertices in G[F] with a degree of at least two. Therefore, by counting the number of vertices with a degree of at least two in G[F], we can tell if is equal to 1 or 2, and identify A in the former case.

If , let A={xy}. Because G∈Π′3, we have three cases:

• (i)If there is no vertex of degree three in G[F], we have δ(x)=δ(y)=2; then there must exist vertices z and z′, distinct from x and y, such that z is adjacent to x and not to y and z′ is adjacent to y and not to x. Thus, z and z′ are vertices of G[F] and have degree one in G[F]: this enables us to identify x and y as the only vertices adjacent to the vertices of degree one in G[F].
• (ii)If there are two vertices with degree three in G[F], we have δ(x)=δ(y)=3; these are precisely the only two vertices with degree three in G[F], and they can be identified as such.
• (iii)We are left with the case when, without loss of generality, δ(x)=3 and δ(y)=2; then x is identified as the only vertex with degree three in G[F].

If at least one of the neighbours of y has degree one in G[F], then, as in case (i), y can be identified by the fact that it is adjacent to a vertex of degree one in G[F]. Hence, now we assume that the two neighbours of y, z1 and z2, have degree two or three in G[F]; note that if zi has degree two in G[F], then it is adjacent to x and y in G[F], and if it has degree three in G[F], then zi=x.

If x and y are non adjacent, then z1, z2 are adjacent to xy, and y can be identified as the only vertex in G[F] not adjacent to x (which has already been identified). If x and y are adjacent, then we have the following edges in G[F]: yx=yz1xz2yz2xz3. Now how to know whether it is y or z2 which belongs to A? They cannot both have degree two in G, because the characterization of Π′3 states that they should have distinct neighbours. Hence, z2 has degree three in G, and y is identified by the fact that it has degree two in G and in G[F].

Given G and G[F], let us recapitulate how we can determine the unknown set A, where |A|2. If there is no edge in G[F], then . If there is only one vertex with a degree of at least two in G[F], then this vertex is the only element in A; otherwise, |A|=2. If there are two vertices with degree three in G[F], then these vertices are the two elements in A. If there is no vertex with degree three in G[F], then the elements in A are the two vertices adjacent to the vertices of degree one in G[F]. Finally, if there is exactly one vertex with degree three in G[F], this vertex belongs to A, and we name it x. Then, if there is one vertex, which is not adjacent to x in G[F], this vertex is the second element in A; otherwise, the second element in A is the vertex with degree two in G and in G[F].

Conversely, consider an (r2)-identifying code ��′ of G′ with

First, we will show that for every eE(G), we must have . To do this, note that as ��′ is an (r2)-identifying code, if we find in G′ two distinct vertices a and b such that

(4)

where cV(G′) and Δ stands for the symmetric difference of sets, then, as we must have

we conclude that necessarily c∈��′. Let us write (ab)→c if (4) is true for three vertices a, b and c. The following facts are easily checked in Fig. 14.

hence, we must have pi∈��′ for i∈{1, 2, ⋯, r+1}. Furthermore

and hence we also have pi∈��′ for i∈{r+2, r+3, ⋯, 2r+1}. The same argument can be applied in the cycle:

and in the other direction

Thus, for every edge eE(G), we have . As , if we define �� as the trace of ��′ on V(G)

the cardinal of �� is at most

To conclude, note that for every edge xyE(G), we have in Ce

and hence we must have x�� or y��; thus �� is a vertex cover of G. This ends the proof of Proposition 10.

In conclusion, Propositions 2–5 together with Proposition 10 cover all the cases in Theorem 1 and give a complete proof for it. We have therefore shown that the problem Min (rl)-ID-code in Π3 is NP-complete for l∈{1, 2} and all r1.

### Footnotes

1. 1We thank the referee for this remark.