On the minimum size of an identifying code over all orientations of a graph

If G be a graph or a digraph, let id( G ) be the minimum size of an identifying code of G if one exists, and id( G ) = + ∞ otherwise. For a graph G , let idor( G ) be the minimum of id( D ) overall orientations D of G . We give some lower and upper bounds on idor( G ). In particular, we show that idor( G ) (cid:54) 32 id( G ) for every graph G . We also show that computing idor( G ) is NP-hard, while deciding whether idor( G ) (cid:54) | V ( G ) | − k is polynomial-time solvable for every ﬁxed integer k .


Introduction
Let G be a graph. The closed neighbourhood of v, denoted N [v], is the set of vertices that are either v or adjacent to v in D. A set C ⊆ V (G) is an identifying code in G if for every vertex v ∈ V (G), N [v] ∩ C = ∅, and for any two distinct vertices u, v ∈ V (D), ∩ C is called the identifier of v (with respect to C in G) and is denoted by I C,G (v), or simply I C (v) (resp. I(v)) when G (resp. G and C) is clear from the context. Two vertices u and v are twins in G if N [u] = N [v]. Clearly, if a graph has two twins u and v, then it has no identifying codes because I C (u) = I C (v) for any subset C ⊆ V (G). Conversely, if a graph G is twin-free (i.e. has no twins), then V (G) is an identifying code. Hence we have the following. For a graph G, we define id(G) as the minimum size of an identifying code of G if one exists, and id(G) = +∞ otherwise. Hence Proposition 1 asserts that id(G) is finite if and only if G is twin-free.
Identifying codes have been widely studied since the introduction of the concept in [19] and have been applied to problems such as fault-diagnosis in multiprocessor systems [19], compact routing in networks [20,21], emergency sensor networks in facilities [22] or the analysis of secondary RNA structures [17]. In particular, it has been proved [5] determining the value id(G) of a graph G is NP-hard.
Identifying codes have first been studied in undirected graphs, but the concept has naturally been extended to directed and oriented graphs [4,3]. Let D be a digraph. The . Clearly, if a digraph has two twins u and v, then it has no identifying codes because I(u) = I(v) for any subset C ⊆ V (D). Conversely, if a digraph is twin-free (i.e. has no twins), then V (D) is an identifying code. Hence we have the following.

Proposition 2.
A digraph has an identifying code if and only if it is twin-free. In particular, every oriented graph has an identifying code.
For a digraph D, we define id(D) as the minimum size of an identifying code of D if one exists, and id(D) = +∞ otherwise. Hence Proposition 2 asserts that id(D) is finite if and only if D is twin-free.
Let G be a graph. The symmetric digraph associated to G, denoted by D G , is the digraph obtained from G by replacing each edge by two arcs in opposite directions. Clearly, a set C is an identifying code of G if and only if it is an identifying code of D G . Hence all results on identifying codes in graphs may be seen as results on identifying codes in symmetric digraphs. In particular, it NP-hard to determine id(D) for a given (symmetric) digraph. Charon, Hudry, and Lobstein [5] proved that it is NP-hard to compute id(D) even if D is an acyclic bipartite digraph, and in particular if D is an oriented graph.
Let D be a twin-free digraph of order n. If C is an identifying code of D, then the sets of identifiers are distinct non-empty subsets of C, so n 2 |C| − 1. Moreover, |C| n since C is a subset of V (D). Hence log 2 (n + 1) id(D) n. (1) In this paper, we are interested by the following problem. We are given an undirected graph G of order n, and we want to find an orientation D of G such that id(D) is as small as possible. Let idor(G) be the minimum of id(D) over all possible orientations D of G.
Equation (1) yields directly the following. log 2 (n + 1) idor(G) n. (2) The bounds in this equation are tight. Indeed E n , the empty graph of order n, satisfies idor(E n ) = n, and K n , the complete graph of order n, satisfies idor(K n ) = log 2 (n + 1) (see Proposition 5). The fact that the lower and upper bound are attained by the complete graphs and the empty graphs, respectively, is explained by the fact that idor decreases with the addition of edges (Proposition 10).
In Section 3, we prove additional upper bounds using several graph parameters. We also consider the case of trees: we show that for a tree T of order at least 5, |V (T )|+1 2 idor(T ) 4 3 α(T ), where α(T ) denotes the maximum size of a stable set in T . In Section 4, we investigate the relation between the parameters id and idor. Similarly, to Equation 1, we have log 2 (n+1) id(G) n for every twin-free graph G. Furthermore, Gravier and Moncel [16] proved that every non-empty twin-free graph G of order n satisfies id(G) n − 1. Hence, together with Equation (2), we obtain that idor(G) 2 id(G) − 1 and id(G) 2 idor(G) − 2 for every twin-free graph G. It is then natural to ask whether this bound are tight or not. We prove in Theorem 27 that idor(G) 3 2 id(G), and in Proposition 29, we show that this bound is tight. Foucaud [10] observed that there are twin-free graphs G for which id(G) 2 idor(G) − 2; see Proposition 31.
In Section 5, we study the complexity of determining idor(G) and the corresponding decision problem.

Idor
Input: A graph G and an integer k. Question: idor(G) k ?
We prove that this problem is NP-complete (Theorem 32). On the the other hand, when k is fixed, deciding whether idor(G) k can be done in polynomial time. Indeed, by Equation (2), a graph satisfying idor (G) k has order at most 2 k − 1. We can thus return 'No' if |V (G)| 2 k and try all possibilities if |V (G)| 2 k − 1 (there are at most 2 |E(G)| 2 |V (G)| 2 possible orientations and for each of them there is at most sets of k vertices). This procedure also shows that it can be done in FPT time when parameterized by k. An interesting question is to investigate whether idor(G) is close to the lower bound log 2 (|V (G)| + 1).

Problem 3.
What is the complexity of the following problem when parameterized by k?
Dually, one might wonder whether idor(G) is close to the upper bound |V (G)| and consider the following problem the electronic journal of combinatorics 22 (2015), #P00 Large-Idor Input: A graph G and an non-negative integer k. Question: idor(G) |V (G)| − k ?
We prove in Theorem 36 that this problem is in XP when parameterized by k, that is that Large-Idor is polynomial-time solvable for every fixed k. A natural question is then the following.
Let G be a graph or a digraph. For every S ⊆ V (G), we denote by G S the subgraph or subdigraph induced by S.
Set k = log 2 (n + 1) . Let X = {x 1 , . . . , x k } be a set of k vertices of K n and let Y = V (K n ) \ X. Orient the edges of K n X in a transitive way, i.e. x i x j is an arc if and only if j > i. Let I = {[i] | 1 i k}. Let us label the vertices of Y with distinct non-empty subsets of [k] not in I. This is possible because n 2 k − 1. We orient Y arbitrarily. Finally, we orient an edge yx i from y to x i if and only if i is in the label of y. Let us denote by D the resulting orientation of K n .
We claim that X is an identifying code of D. Indeed, with respect to X, the identifier of x i is {x j | j ∈ [i]|} and for every y ∈ Y the identifier of y is {x j | j in the label of y}. Hence all the identifiers are distinct and non-empty.
This proposition shows that the lower bound log 2 (n + 1) idor(G) of Equation 2 is tight. The empty graphs show that the upper bound idor(G) n of Equation (2) is tight. We shall now completely characterize the graphs G of order n satisfying idor(G) = n.
We need the following useful lemma.
Proof. For i = 1, 2, let D i be an orientation of G i having an identifying code C i of order idor(G i ). Let D be the orientation of G obtained from D 1 and D 2 by orienting all edges between V 1 and V 2 from V 1 to V 2 . Let us prove that C 1 ∪ C 2 is an identifying code of D. v be two vertices. If u and v are both in V 2 , then I C (u) = I C 2 (u) = I C 2 (v) = I C (v). If u and v are both in C 1 then . Therefore, all the identifiers (according to C) are distinct.
Corollary 7. Let G be a graph and let k be an integer. If G has an induced subgraph H such that idor(H) |V (H)| − k, then idor(G) |V (G)| − k.
Let G 1 and G 2 be two graphs. The disjoint union of G 1 and G 2 is denoted by G 1 + G 2 and their join is denoted by G 1 ⊕ G 2 .
Consider now an identifying code C of an orientation D of G 1 + G 2 . For i = 1, 2, let Proposition 9. Let G be a graph of order n. idor(G) = n if and only if G is the disjoint union of copies of K 1 and copies of K 2 .
Proof. It is clear that if G is the disjoint union of copies of K 1 and copies of K 2 , then idor(G) = n.
Assume now that G is not the disjoint union of copies of K 1 and copies of K 2 . Necessarily, G has an induced subgraph isomorphic to either P 3 the path of order 3, or K 3 the complete graph of order 3. K 3 can be oriented into the directed cycle C 3 and P 3 can be oriented into the directed path P 3 . These two digraphs have an identifying code of size 2, hence idor(K 3 ), idor(P 3 ) 2. Thus, by Corollary 7, idor(G) n − 1.
This proposition implies that one can decides in polynomial time whether a graph G of order n satisfies idor(G) n − 1. In Subsection 5.2, we extend this by showing that, for every fixed k, it is polynomial-time solvable to decide whether a graph G of order n satisfies idor(G) n − k. 3 Bounds using various parameters 3

.1 Upper bounds
We denote by ω(G) the clique number of the graph G. Proposition 5 and Corollary 7 imply directly the following.
Proposition 11 is tight for complete graphs and disjoint union of copies of K 1 , copies of K 2 and one complete graph. However, we might expect better upper bounds for other graphs, for example for connected triangle-free graphs.
The minimum degree of a graph G is denoted by δ(G). Proposition 9 shows that idor G) n − 1 if and only δ(G) 2. We now extend this for graphs with larger minimum degree.
Proof. We prove the result by induction on |E(G)|, the result holding when δ(G) 4 by Proposition 9.
Let G be a graph with δ(G) 5. Necessarily G contains a cycle. Let C be a shortest cycle in G. Let G = G − C. Since C is a shortest cycle, then every vertex in V (G ) has at most three neighbours in C. Hence δ(G ) δ(G) − 3.
Assume now that δ(G ) = δ(G) − 3. There is a vertex v of G having three neighbours in C. Since C is a shortest cycle, it implies that |C| = 3. Hence V (C)∪{v} is a clique K on four vertices, say K = {t, u, v, w}. Since δ(G) 5, there exists distinct vertices v and w in G − K such that v is adjacent to v and w is adjacent to w. Proposition 13 (Folklore). Every graph contains an (induced) subgraph with minimum degree at least Ad(G)/2. Propositions 12, 13, and 9 imply the following.
This result suggests the more general problems: • What is the maximum value g(k) such that idor(G) |V (G)| − g(k) for every graph G with δ(G) k ?
• What is the maximum value g 1 (α) such that idor(G) Observe that g 1 = g 2 : As Ad Mad, we trivially have that g 2 (α) g 1 (α). Conversely, let G be a graph with Mad(G) = α. It contains a subgraph H such that Proposition 12 and Corollary 14 yields the lower bounds g(k) k 2 −1 and g 1 (α) α 4 −1. We now show some upper bounds. We denote by K a,b the complete bipartite graph with a vertices in one part and b vertices in the other.
Proof. Let (A, B) be a bipartition of K k,n−k with |A| = k and |B| = n − k. Let C be an identifying code in an orientation D of K k,n−k . Set P = A ∩ C, Q = B \ C, p = |P |, and q = |Q|. The identifiers of vertices in Q are distinct non-empty subsets of P . Hence

Lower bounds
Theorem 17. Let G be a graph with maximum degree ∆. Then idor(G) Proof. Let C be an identifying code of an orientation D of G. We shall use the Discharging Method to prove that |C| 2 ∆+2 |V (G)|. This method was often use to get lower bounds on the size of identifying codes, in particular for infinite grids, see e.g. [2,6,7,8,9].
We give an initial charge of 1 to every vertex v. Hence the total charge is |V (G)|. Then every vertex distribute its charge uniformly to the vertices in its identifier. In other word, we apply the following rule: every vertex sends 1 |I(v)| to every vertex of I(v). Consider now the final charge w(v) of a vertex. If v / ∈ C, then it gives all its charge and receives nothing, so w(v) = 0. If v ∈ C, then it gives all its charge, but receives from all the vertices whose identifier contains v (including itself). Observe that there are at most ∆ + 1 such vertices, and that at most one of this vertex has {v} for identifier. So v receives 1 from at most one vertex, and at most 1/2 from all the others. Hence

Trees
Of course better lower and upper bounds might be obtained when G belongs to some graph classes. In this subsection, we give tight lower and upper bounds for trees. Identifying codes of trees have been studied in [1]. We shall need the following lemma. Proof. Because u and v have non-empty distinct identifiers, any identifying code of any orientation of G contains at least two vertices in {u, v, w}.
Suppose now that C is an identifying code of an orientation D of G. If C does not contain w, then {u, v} ⊆ C. Let C = (C \ {v}) ∪ {w} and let D be the orientation of G obtained from D by reorienting (if necessary) all edges incident to v away from this vertex. It is simple matter to check that C is an identifying code of D .
Proof. Let us prove the result by induction on n, the result holding trivially when n 3. Let T be a tree of order n 3. Let P = (v 1 , . . . , v k ) be a diameter of T , and let L be the set of all neighbours of v 2 distinct from v 3 . All vertices in L are leaves of T because P is a diameter, Let C be an identifying code of an orientation D of T . Assume that v 2 / ∈ C. Then L ⊆ C. Moreover, C \ L is an identifying code of D − (L ∪ {v 2 }). Thus, by the induction hypothesis, |C \ L| (n − |L|)/2 , so |C| (n + 1)/2 . Henceforth we may assume that v 2 ∈ C. Moreover we may assume that v 2 dominates all vertices in L ∩ C in D.
Because at most one vertex has {v 2 } as an identifier, all vertices of L except possibly one are in C.
We distinguish two cases according to whether |L| 2 or not. Case 2: Assume |L| = 1. By Lemma 19, we may also assume that v 3 ∈ C.
The bound of Theorem 20 is tight as shown by paths: Proposition 21. Let P n be the path of order n. idor(P n ) = (n + 1)/2 . If n is even, then {v i | i odd} ∪ {v n } is an identifying code of P n : if i is odd then Hence idor(P n ) (n + 1)/2 . By Theorem 20, idor(P n ) = (n + 1)/2 . K 1 and K 2 are trees T such that idor(T ) = |V (T )|. However, Proposition 9 asserts that they are the only ones. By Proposition 21, if T = P 4 , then idor(T ) = |V (T )| − 1. The stars also satisfy this equality. Recall that the star of order n is the graph S n in which a vertex called the centre is adjacent to all other vertices, called leaves.
Proof. Let c be the centre of the star and u 1 , . . . , u n−1 be its leaves. One can check that V (S n ) \ u 1 is an identifying code of the orientation of S n with arc set Assume now that C is an identifying code of an orientation D of S n . If all leaves of S n are in C, then |C| n − 1. Henceforth, we assume that a leaf, say u 1 is not in C. Since I(u 1 ) = ∅, necessarily, (u 1 , c) ∈ A(D), c ∈ C and I(u 1 ) = c. Moreover, since I(u i ) = I(u 1 ), we necessarily have u i ∈ C for 2 i n − 1. Thus |C| n − 1.
However, we can improve on the upper bound idor(T ) = |V (T )| − 1 via some tree parameters. Let us denote by leav(T ) the number of leaves in a tree. A leaf in a tree is a vertex of degree at most 1. When |V (T )| > 2, we have leav(T ) |V (T )| − 1. A vertex of a tree that is not a leaf is called a node.
Proof. Let T be a tree, and let L be its set of leaves. T − L is a tree. Therefore it has a stable set S of size at least |V (T −L)|

2
. Let D be an orientation of T such that all edges between S and V (T ) \ S are oriented away from S.
We claim that C = V (T )\S is an identifying code of D. Indeed every vertex of S has at least two neighbours in T which are its out-neighbours in D. Hence the identifier of every vertex is non-empty, since the identifier of each vertex c ∈ C contains c. Furthermore, consider two distinct vertices u, v of V (T ). If one of them, say u, is in S, then N T (u) = I(u). But u is the only vertex adjacent to the (at least two) vertices of N T (u) in T , because T is acyclic. Hence I(u) = I(v). If both u and v are not in S, then they are in C. Without loss of generality, u does not dominate v, and so v ∈ I(v) \ I(u), so I(u) = I(v). This proves that C is an identifying code of D.
Hence idor(T ) Observe that the bound of Theorem 23 is attained for stars and paths. Note moreover that leav(T ) α(T ) and |V (T )|/2 α(T ). This directly implies the following corollary. This upper bound is attained for the paths P 2 and P 4 of order 2 and 4 respectively. However, they are the only ones.
Theorem 25. Let T be a tree different from P 2 and P 4 . Then idor(T ) 4 3 α(T ). Proof. We prove the result by induction. One can easily check that the results holds for |V (T )| 5. In particular, for every tree T of order 5, we have idor(T ) 4 3 α(T ). Suppose now that |V (T )| 6.
Assume that some vertex v ∈ T is incident to at least two leaves v 1 , v 2 . Clearly, α(T ) = α(T − v 1 ) + 1 and, by Lemma 6, idor(T ) idor(T − v 1 ) + 1. By the induction hypothesis, idor(T − v 1 ) 4 3 α(T − v 1 ). Consequently, idor(T ) 4 3 α(T ). Henceforth, we may assume that every vertex of T is adjacent to at most one leaf. We distinguish three cases, depending on the value of leav(T ): • If leav(T ) n/3, we apply Theorem 23 and obtain idor(T ) 2 3 n = 4 3 · n Theorem 25 is best possible. Indeed consider A 6p the tree which is the union of 2p disjoint paths Q i = (a i , b i , c i ), 1 i 2p and the path P = (a 1 , a 2 , . . . , a 2p ). One can easily see that a maximum matching of A 6p is {c i | 1 i 2p} ∪ {a 2j | 1 j 2p}, so α(A 6p ) = 3p. On the other hand, for any code C of any orientation D of A 6p , there must be at least two vertices of C in each {a i , b i , c i }, by Lemma 19. Hence idor(A 6p ) 4p. Thus idor(A 6p ) 4 3 α(A 6p ).

Relations between id and idor
We denote by E(A, B) the set of edges with an endvertex in A and the other in B.
Proof. Let G be a graph. If G has some twins, then id(G) = +∞ and the results holds trivially. Assume now that G is twin-free, that is id(G) < +∞. Let C be a code of G with cardinality id(G) and set U = V (G)\C. Let D be an orientation of G such that all edges of the electronic journal of combinatorics 22 (2015), #P00 E(U, C) are oriented towards C. Observe that for every u ∈ U , I C,D (u) ∩ C = I C,G (u) = ∅ and for every vertex w ∈ C, w ∈ I C,D (w). Therefore, I C,D (v) = ∅ for all v ∈ V (G).
Observe that for every two distinct vertices u 1 , u 2 ∈ U , we have I C,D (u 1 ) ∩ C = I C,G (u 1 ) = I C,G (u 2 ) = I C,D (u 2 ) ∩ C, so I C,D (u 1 ) = I C,D (u 2 ). Recall moreover, that for two vertices w 1 , w 2 in C, we have I C,D (w 1 ) = I C,D (w 2 ). Hence C is almost an identifying code of D. There only thing that prevents it to be a code are pairs (u, w) ∈ U × C such that I C,D (u) = I C,D (w). Call such pairs, bad pairs. Observe that for any bad pair (u, v), we have (u, v) ∈ A(D). Moreover, a vertex w ∈ C is in at most one bad pair, so there are at most |C| bad pairs. Let U be the set of vertices of U which are the first vertex of a bad pair. One can easily check that C = C ∪ U is an identifying code D since the identifier of the two elements of a bad pair are now distinct. Moreover, |U | |C|, so C | 2|C|. Hence idor(G) 2 id(G).
Theorem 27. idor(G) 3 2 id(G) for all graph G. This theorem follows directly from the following lemma.
Lemma 28. Let G be a graph having an identifying code C. There exists an orientation D of G having an identifying code C with C ⊆ C and |C | 3 2 |C|.
We first orient all the edges of E(U, C) towards C. We then partition our graph using the following process. Set U 1 := U , C 1 := C and i = 1. As long as there is a vertex in U i having at least two neighbours in C i . Choose such a vertex u i . Set , and i := i + 1. Reorient the edges of E(u i , B i ) towards u i , and reorient the edges of E(C i+1 , B i ) towards B i . See Figure 1. Figure 1: Partitioning the graph Let p be the index i at which the process stops. Each vertex of U p has no neighbour in C \ C p for otherwise it would belong to some S i . Hence it has degree 1 in C and its neighbour is in C p . For every, u ∈ U p , let c(u) be its neighbour. We have I C,G (u) = {c(u)}, therefore c(u) = c(u ) for all u, u ∈ U p . Let B p be the set of vertices of C p having a neighbour in U p , i. e. Finally orient all the unoriented edges arbitrarily to obtain an orientation D of G. Set C = C ∪ {u 1 , . . . , u p−1 } ∪ W . Observe that |{u 1 , . . . , u p } ∪ W | |C|/2, so |C | 3|C|/2. We shall now prove that C is an identifying code of D.
Observe first that for every vertex u ∈ U , I C,G (u) = I C ,D (u). In particular, I C ,D (u) is not empty. Since the identifier of the vertices of C are trivially non-empty, all the identifiers are non-empty. Let us now prove that they are all distinct.
Two vertices in C have clearly distinct identifiers. If u 1 and u 2 are two vertices of U , then I C ,D (u 1 ) = I C,G (u 1 ) = I C,G (u 2 ) = I C ,D (u 2 ).
Consider now a vertex u ∈ U and v ∈ C .
Henceforth we may assume that u ∈ U p , v ∈ B p and c(u) = v. Note that Hence v has an out-neighbour in H, and so I C , By Theorem 27, idor(R) 6. We shall now prove that idor(R) 6. Assume for a contradiction that D contains an orientation of D having an identifying code C of order less than 6. Moreover, we take such a pair (D, C) such that C ∩ {c 1 , c 2 , c 3 , c 4 } is maximum. Problem 30. What is the complexity of the following problems : • Deciding whether idor(G) < 3 2 id(G). • Given a graph G with an identifying code C, deciding whether an orientation D of G and an identifying code C of D such that C ⊆ C and |C | < 3 2 |C|. Recall that id(G) 2 idor(G) −2 for every twin-free graph G. The following proposition, observed by Florent Foucaud [10], shows that this bound is tight. Let J 2p+1 be the graph obtained from a complete graph on 2p + 1 vertices by removing a matching of size p.
Now, let C be a set of k vertices of J 2 k −1 such that C is complete to V (J 2 k −1 ) \ C. Such a set clearly exists by definition of J 2 k −1 . Take an arbitrary orientation D C of G C . Let F be the set of closed out-neighbourhoods in D C : Let us label the vertices of V (J 2 k −1 ) \ C with distinct non-empty subsets of C not in F. This is the electronic journal of combinatorics 22 (2015), #P00 possible because J 2 k −1 has 2 k − 1 vertices. Let D be an orientation of G obtained from D C by orienting an edge uv with u ∈ V (J 2 k −1 ) \ C and v ∈ C from u to v if and only if v is in the label of u, and orienting the edges with both endvertices in V (J 2 k −1 ) \ C arbitrarily. One easily checks that C is an identifying code of D. Thus idor(J 2 k −1 ) = k.

Complexity of Idor
Finding the minimum size of an identifying code in a graph or a digraph is an NP-hard problem even on some very restricted classes of graphs or digraphs, see e.g. [5,12,11,4]. We now prove an analogous results for idor.
Theorem 32. Idor is NP-complete, even when restricted to bipartite cubic graphs or when restricted to bipartite planar graphs of maximum degree 3.
Proof. Reduction from Vertex Cover which consists, given a graph G and a nonnegative integer k, in deciding whether G has a vertex cover of size at most k. Recall that a vertex cover in a graph G is a set S of vertices such that every edge of G has an endvertex in S. The minimum size of a vertex cover of G is denoted by vc(G). This problem is one of the 21 first problems proved to be NP-complete by Karp [18]. It is known to be NPcomplete even when restricted to cubic graphs [15] and when restricted to planar graphs of maximum degree 3 [14]. It can easily be shown that it also remains NP-complete when restricted to such planar graphs with minimum degree at least 2 and maximum degree 3. (From an instance G of vertex cover, consider the graph H = G − (V 1 ∪ N (V 1 )) where V 1 is the set of vertices of degree at most 1 and N (V 1 ) the set of vertices adjacent to vertices in V 1 .) Let G be a graph. Let H be the graph obtained from G by replacing each edge by the edge gadget F e depicted Figure 3. Observe that H is bipartite. Moreover if G is cubic then H is cubic, and if G is a planar graph with minimum degree at least 2 and maximum degree 3 so is H. We claim that idor(H) = vc(G) + 2|E(G)| which will imply the result. We shall use the name of the vertices as written of this figure. For each edge e = uv, we set X e = {x e u , x e v }. Assume that G has a vertex cover S. Let e = uv be an edge of G. We have |{u, v} ∩ S| 1. If |{u, v} ∩ S| = 1, we orient the edges of F e as shown on Figure 4 left, and if |{u, v} ∩ S| = 2, we orient the edges of F e as shown on Figure 4 right. This result in an orientation D of G. Set Observe Idor can be solved in polynomial time for graphs with maximum degree 2. Indeed such graphs are disjoint union of paths and cycles. Consequently idor can be computed in linear time (the time required to compute the connected components of the graphs) using Corollary 8, Proposition 21 and the following proposition.
Proposition 33. Let C n be the cycle of length n. If n = 4 then idor(C n ) = n/2 , and idor(C 4 ) = 3. Proof. Assume first that n = 4. By Theorem 17, idor(C n ) n/2 . Let D be an orientation of C n with n/2 sources and n/2 sinks. One easily checks that the set of n/2 vertices of D which are not source is an identifying code of D. Hence idor(C n ) n/2 .
Observe that graphs with maximum degree 2 have treewidth at most 2. More generally, one can compute Idor can be solved in polynomial time for graphs with bounded treewidth.
Proposition 34. For every fixed integer t, Idor is polynomial-time solvable when restricted to the class T t of graphs with treewidth at most t. What is the complexity of Idor when restricted to cographs? when restricted to split graphs ? when restricted to interval graphs ? when restricted to chordal graphs ?

Large-Idor
The aim of this subsection is to prove that Large-Idor is XP when parameterized by k. This is equivalent to the following statement. Let A k be the set of k-atoms. Observe that Corollary 7 implies that every graph G such that idor(G) |V (G)| − k contains a k-atom as an induced subgraph. In other words, the set of graphs such that idor(G) > |V (G)| − k is the set of A k -free graphs.
We shall prove that for every k the set A k is finite. Then a brute-force algorithm checking whether a given graph G contains a (k + 1)-atom would solve k-Large-Idor in polynomial time.
Theorem 37. Let k be a positive integer. Every k-atom has order at most k 2 + 2k + 1.
the electronic journal of combinatorics 22 (2015), #P00 Proof. Let G be a graph of order n. It has an orientation D which has an identifying code C of order n − k. Set U = V (G) \ C.
To prove the result, it is sufficient to prove that there is a set C of size at most k 2 + k + 1 which is an identifying code of an orientation D of G U ∪ C . For such C and D , the following four properties will be satisfied.
(P2) for every two distinct vertices u, u ∈ U , I C (u) = I C (u ).
(P3) for every two distinct vertices v, v ∈ C , I C (v) = I C (v ).
(P4) for every u ∈ U and v ∈ C, I C (u) = I C (v).
For every two distinct vertices u, u ∈ U , choose a vertex s(u, u ) in . Therefore at most one vertex of U has no out-neighbour in S. If such a vertex u 0 exists, let t(u 0 ) be its out-neighbour in C and let C 0 = S ∪ {t(u 0 )}. Otherwise let C 0 = S. Let D 0 = D C 0 ∪ U . We shall now extend C 0 into set C i and D 0 into an orientation D i of G C i ∪ U that satisfies the following properties.
Observe that C 0 and D 0 have been constructed so that P1 and P2 hold. Moreover, P3 holds for every oriented graph since for two elements in the code, one of them is not in the identifier of the other. However, C 0 and D 0 do not necessarily fulfill P4. Let B = {(u 1 , v 1 ), . . . , (u p , v p )} be the pairs of U ×C 0 that do not satisfy P4 (i.e. I C 0 (u i ) = I C 0 (v i )). Observe that, since P3 holds, all the u i are distinct, and so p k. For Note that T ∩ C 0 = ∅. Now orient all edges between C 0 and T towards T and all edges between T and U towards U . Finally, if {v i , t(u i , v i )} is not an edge, then we reorient {u i , t(v i )} in (u i , t(v i )). This results in an orientation D of G S ∪ T ∪ U .
We claim that C = C 0 ∪ T is an identifying code of D . Clearly, C and D satisfy P1, P2 and P3. Let us now prove that P4 also holds. Let u and v be two vertices in U and C respectively. Assume first that v ∈ C 0 . If (u, v) / ∈ B, then I C 0 (u) = I C 0 (v), so I C (u) = I C (v). If (u, v) ∈ B, then either {u, t(u, v)} is an edge of G and t(u, v) ∈ N + [v] \ N + [u], or {u, t(u, v)} is not an edge of G and t(u, v) ∈ N + [u]\N + [v]. In both cases, , or {v i , v} is not an edge of G. In both cases, I C (u) = I C (v).
In view of Theorem 37, one naturally asks the following questions.
Problem 38. What is precisely the set of k-atoms ? In particular, what is the maximum size of a k-atom ? How many k-atoms are there ?
Note that Proposition 9 implies that the set of 1-atoms is {K 3 , P 3 }.

IsCode
Problem 39. What is the complexity of the following problem : IsCode Input: A graph G and a set C ⊆ V (G). Question: Is there an orientation D of G for which C is an identifying code ?
Proof. IsCode is clearly in NP. An orientation D of G in which C is an identifying code is clearly a certificate.
Let us now prove that IsCode is NP-hard. We give a reduction from 3, 4-SAT which is a restriction of 3-SAT to instances in which each variable occurs at most 4 times. This problem was shown NP-complete by Tovey [23].
Consider a 3, 4-SAT formula. We first double every clause to obtain an equivalent 3, 4-SAT formula F with 2m clauses C 1 , . . . , C 2m on n variables x 1 , . . . , x n . Let G be the graph and C its subset of vertices constructed as follows. For each variable x i , we create a vari- Figure 5. Moreover, if k j , k ∈ [3], is the negated literal x i then we connect the vertex k j to x 1 i and x 2 i , and if k j is the non-negated literal x i then we connect the vertex k j tox 1 i andx 2 i . Figure 5: Variable gadget V G i (left) and clause gadget CG j (right).
. The two gadgets are very similar in their principle: we want to ensure that, in any orientation of G in which C is an identifying codes, every variable/clause gadget has at least one vertex whose edges leaving the gadget are all directed away from it. To this aim, we add new vertices in G (but not in C). For every vertex v in • For every variable x i , we add a vertex whose unique neighbour is y i ; • For every clause C j , we add a vertex whose unique neighbour is z j ; • For every set S which is a non-empty strict subset of P we add a vertex whose neighbourhood is S.
the electronic journal of combinatorics 22 (2015), #P00 Observe that in the last step, for every k j , we create a vertex of V (G)\C whose unique neighbour is k j . Observe that since every variable occurs in at most 8 clauses, there are at most 2 9 −2 = 510 non-empty strict subsets of P Hence G has a size at most 2046n + 2m.
Let us now show that F is satisfiable if and only if G has an orientation in which C is an identifying code.
Suppose first that C is an identifying code of an orientation D of G. Observe that every vertex v ∈ V (G) \ C must satisfy I(v) = N G (v), and all edges of E(V (G) \ C, C) are oriented towards C.
In particular, for every v ∈ C, there is a vertex in V (G) \ C whose identifier is {v}. Consequently, all vertices of C must have at least one out-neighbour in C. In particular, each y i has an out-neighbour which must be in C so in Furthermore, we can assume that y i has exactly one out-neighbour in {x 1 i , x 2 i ,x 1 i ,x 2 i } because reversing some arcs towards y i leaves C an identifying code of D (provided that y i keeps one outneighbour). Let w i be the out-neighbour of y i . As mentioned above it is in {x 1 i , x 2 i ,x 1 i ,x 2 i }. The identifier of w i is contained in P [w i ]. Now by construction and the fact that all edges of E(V (G) \ C, C) are oriented towards C, every strict subset S of this set is the neighbourhood and the identifier of a vertex in V (G) \ C. Hence the identifier of w i is P [w i ]. In particular, it dominates all its neighbours in clause gadgets.
Let φ be the truth assignment defined by φ(x i ) = true if w i ∈ {x 1 i , x 2 i } and φ(x i ) = f alse otherwise. Let us prove that it satisfies φ.
Let C j = 1 j ∨ 2 j ∨ 3 j be a clause of F. In D, z j has an out-neighbour, say k j . Assume that the literal l k j corresponds to the negated variablex i . Then vertex N G ( k j ) = {z j , x 1 i , x 2 i }. Hence its identifiers is contained in { k j , x 1 i , x 2 i }. But since x i is in at least two clauses (because we doubled the clauses), { k j }, { k j , x 1 i } and { k j , x 2 i } are strict subsets of P [x 1 i ] and P [x 2 i ] respectively. Therefore, those three sets are identifiers of some vertices of V (G) \ C. Hence the identifier of k j is { k j , x 1 i , x 2 i }. In particular, k j dominates x 1 i and x 2 i and so w i is not in {x 1 i , x 2 i }. Hence by definition φ( k j ) = φ(x i ) = true. So C j contains a true literal.
Assume now that there is a truth assignment φ satisfying F. Let D be the orientation of G obtained as follows. Firstly we orient all edges of E(V (G)\C, C) are oriented towards C. Secondly for every variable x i , we orient the edges y i x 1 i and y i x 2 i away from y i and the edges y ix 1 i and y ix 2 i towards y i if φ(x i ) = true, and we orient the edges in the other direction if φ(x i ) = f alse. Finally, for every clause C j = 1 j ∨ 2 j ∨ 3 j , we orient z j towards its literals which are true. (There is at least one of them). Moreover if φ( k j ) = true, we orient all edges between k j and vertices in variable gadgets away from k j . Otherwise, we orient all these edges towards k j . One can easily check that C is an identifying code of D.
Despite Theorem 40, there are many cases when IsCode can be solved in polynomial time. If C = V (G) the answer is trivially 'yes', and if 2 |C| − 1 < V (G) then the answer is the electronic journal of combinatorics 22 (2015), #P00 trivially 'no'. If C is a stable set of G, or if G C has a bounded number of edges, then it can be solved in polynomial time using matchings, as we shall now explain.
Lemma 41. Given a graph G, a set C ⊆ V (G), and an orientation D C of G C , one can check in polynomial time whether there exists an orientation D of G such that D C = D C and C is an identifying code of D.
Proof. Observe first that for any orientation D such that D C = D C , I C,D (v) = N + [v]∩C for all v ∈ C.
For every vertex v ∈ V (G), let P (v) be the set of potential identifiers of v and p(v) its cardinality: if v ∈ C, then P (v) = {N + [v] ∩ C} and p(v) = 1; if v ∈ V (G) \ C, then P (v) consists in all non-empty subsets of N (v) ∩ C and p(v) = 2 |N (v)∩C| − 1. Note that p(v) can be computed in polynomial time.
We need to assign to each vertex v a set I(v) in P (v) such that the I(v) are pairwise distinct. Observe that if p(v) |V (G)| whatever assignment is done for the other vertices, one can find a set I(v) in P (v) which is distinct from the I(u), u = v. Hence, we do the assignment of such vertices greedily at the end.
Let A be the set of vertices such that p(v) < |V (G)|. By the above observation, it suffices to assign identifiers to vertices in A. Let us construct an auxiliary bipartite graph H. The partition of its vertex set is (A, B) with B the set of subsets of C in v∈A P (v). Note that B has size less than |V (G)| 2 because p(v) < n for all v ∈ A. The edge set of H is E(H) = {ab | a ∈ A, b ∈ P (a)}. Finding an assignment of distinct identifiers for vertices in A is equivalent to find a matching saturating A in H. This can be done in polynomial time, by the celebrated Hungarian Method for example.
Lemma 41 implies that IsCode can be solved in polynomial time if C has few edges, that is at most log 2 (P (|V (G)|)) for P a fixed polynomial.
Problem 42. What is the complexity of the following problem : CliqueCode Input: A graph G and a clique C ⊆ V (G). Question: Is there an orientation D of G for which C is an identifying code ?