Complexity of Secure Sets∗ Bernhard Bliem and Stefan Woltran Institute of Information Systems 184/2 Vienna University of Technology Favoritenstrasse 9–11, 1040 Vienna, Austria [bliem,woltran]@dbai.tuwien.ac.at
arXiv:1411.6549v1 [cs.CC] 24 Nov 2014
Abstract A secure set S in a graph is defined as a set of vertices such that for any X ⊆ S the majority of vertices in the neighborhood of X belongs to S. It is known that deciding whether a set S is secure in a graph is co-NP-complete. However, it is still open how this result contributes to the actual complexity of deciding whether for a given graph G and integer k, a non-empty secure set for G of size at most k exists. While membership in the class ΣP 2 is rather easy to see for this existence problem, showing ΣP -hardness is quite involved. In this paper, we provide such 2 a hardness result, hence classifying the secure set existence problem as ΣP 2 -complete. We do so by first showing hardness for a variant of the problem, which we then reduce step-by-step to secure set existence. In total, we obtain eight new completeness results for different variants of the secure set existence problem. 1998 ACM Subject Classification F.2.2 Nonnumerical Algorithms and Problems Keywords and phrases secure set, complexity analysis, alliances in graphs
1
Introduction
Secure sets in graphs have been introduced by Brigham et al. [3] as a strengthening of defensive alliances. In a nutshell, a secure set of a graph G = (V, E) is a set S ⊆ V such that for each subset X ⊆ S, the number of vertices in N [X] ∩ S is not less than the number of vertices in N [X] \ S, where N [X] denotes the closed neighborhood of X in G, i.e., X together with all vertices adjacent to X. The Secure Set problem, which we address in this paper, can be specified as follows: Given a graph G = (V, E) and an integer k, does there exists a secure set S of G such that 1 ≤ |S| ≤ k? It is known that deciding whether a given set S is secure in a graph is co-NP-complete [6], indicating that the problem of finding (non-trivial) secure sets is very hard. Unfortunately, the exact complexity of this problem has so far remained unresolved. This is an unsatisfactory state of affairs because it leaves the possibility open that existing approaches for solving the problem (e.g., [1]) are suboptimal in that they employ unnecessarily powerful programming techniques. Hence we require a precise complexity-theoretic classification of the problem. The main contribution of our paper is to show that Secure Set is ΣP 2 -complete. Unlike the co-NP-hardness proof of [6], which uses a (quite involved) reduction from Dominating Set, we base our proof on a reduction from a problem in the area of logic. To be specific, we first show that the canonical ΣP 2 -complete problem Qsat2 can be reduced to a variant of Secure Set, where (i) vertices can be forced to be in or out of every solution, where (ii) pairs of vertices can be specified to indicate that every solution must contain exactly one element of each such pair, and where (iii) each solution contains exactly a given number of
∗
This work was supported by the Austrian Science Fund (FWF) projects P25607 and Y698. © Bernhard Bliem and Stefan Woltran; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany
2
Complexity of Secure Sets
a c
b d
e
Figure 1 A graph with a minimum non-empty secure set indicated by circled nodes
elements. In order to prove the desired complexity result, we then successively reduce this variant to the standard Secure Set problem. Membership in the class ΣP 2 is rather obvious; in fact, [1] presents a poly-time reduction to Answer Set Programming [2] and thus implicitly shows this result. Together with our corresponding hardness result, it thus follows that Secure Set is ΣP 2 -complete, and it turns P out that all the problem variants we consider in this paper are Σ2 -complete. We thus complete the picture of the precise complexity of the Secure Set problem. Our results underline that Secure Set is among the few rather natural problems in graph theory that are complete for the second layer of the polynomial hierarchy (like, e.g., Clique Coloring [7] or 2-Coloring Extension [8]). Moreover, ΣP 2 -hardness of Secure Set indicates that an efficient reduction to the Sat problem is not possible (unless the polynomial hierarchy collapses). Therefore, our results allow us to conclude that approaches as suggested in [1] for solving the problem are indeed adequate from a complexity-theoretic point of view. This paper is organized as follows: We provide the necessary background in Section 2. In Section 3, we present our complexity results. Section 4 concludes the paper with a discussion.
2
Background
All graphs in this paper are simple. Given a graph G = (V, E), the open neighborhood of a vertex v ∈ V , denoted by NG (v), is the set of all vertices adjacent to v, and NG [v] = NG (v) ∪ {v} is called the closed neighborhood of v. Let S ⊆ V be a set of vertices. We abuse S S notation by writing NG (S) and NG [S] to denote v∈S NG (v) and v∈S NG [v], respectively. If it is clear from the context which graph is meant, we write N (·) and N [·] instead of NG (·) and NG [·], respectively. I Definition 1. Given a graph G = (V, E), a set S ⊆ V is secure in G if for each X ⊆ S it holds that |N [X] ∩ S| ≥ |N [X] \ S|. We often write “S is secure” instead of “S is secure in G” if it is clear from the context which graph is meant. By definition, the empty set is secure in any graph. Thus, in the following decision problems we ask for secure sets of size at least 1. The following is our main problem: Secure Set Input: A graph G = (V, E) and an integer k with 1 ≤ k ≤ |V | Question: Does there exist a set S ⊆ V with 1 ≤ |S| ≤ k that is secure? Figure 1 shows a graph together with a minimum non-empty secure set S = {a, b, c}. Observe that for any X ⊆ S the condition |N [X] ∩ S| ≥ |N [X] \ S| is satisfied. Note that the well-known Defensive Alliance problem is a special case of Secure Set where only those subsets X of S are considered that have size 1. For example, in Figure 1, the set S 0 = {a, b} is a defensive alliance as |N [v] ∩ S 0 | ≥ |N [v] \ S 0 | holds for any v ∈ S 0 , but S 0 is not a secure set, since for X 0 = S 0 it holds that |N [X 0 ] ∩ S 0 | < |N [X 0 ] \ S 0 |.
B. Bliem and S. Woltran
3
a d
b 6= c e
Figure 2 Illustration of forbidden, necessary and complementary vertices
We now define three variants of the Secure Set problem that we require in our proofs. Secure SetF generalizes the Secure Set problem by designating some “forbidden” vertices that may never be in any solution. This variant can be formalized as follows: Secure SetF Input: A graph G = (V, E), an integer k with 1 ≤ k ≤ |V | and a set V ⊆ V Question: Does there exist a set S ⊆ V \ V with 1 ≤ |S| ≤ k that is secure? Secure SetFN is a further generalization that, in addition, allows “necessary” vertices to be specified that must occur in every solution. Secure SetFN Input: A graph G = (V, E), an integer k with 1 ≤ k ≤ |V |, a set V ⊆ V and a set V4 ⊆ V Question: Does there exist a set S ⊆ V \ V with V4 ⊆ S and 1 ≤ |S| ≤ k that is secure? Finally, we introduce the generalization Secure SetFNC . Here we may state pairs of “complementary” vertices where any solution must contain exactly one element of such a pair. Secure SetFNC Input: A graph G = (V, E), an integer k with 1 ≤ k ≤ |V |, a set V ⊆ V , a set V4 ⊆ V and a set C ⊆ V 2 Question: Does there exist a set S ⊆ V \ V with V4 ⊆ S and 1 ≤ |S| ≤ k that is secure and, for each pair (a, b) ∈ C, contains either a or b? While the Secure Set problem asks for secure sets of size at most k, we also consider the Exact Secure Set problem that concerns secure sets of size exactly k. Note that a secure set may become insecure by adding or removing elements, so this is a non-trivial problem variant. Analogously, we can also define exact versions of the three generalizations of Secure Set presented above. In this paper’s figures, we indicate necessary vertices by means of a triangular node shape, and necessary vertices by means of either a square node shape or a superscript square in the node name. If two vertices are complementary, we express this in the figures by putting a 6= sign between them. For example, in Figure 2, the vertices b and c are complementary and occur in no solution together; a and the “anonymous” vertex adjacent to c are necessary and occur in every solution; d and the “anonymous” vertex adjacent to e are forbidden and occur in no solution. In this figure, the unique minimum non-empty secure set honoring the conditions of forbidden, necessary and complementary vertices consists of a, b and the “anonymous” necessary vertex adjacent to c. A few terminological remarks are in order. We often use the terms attackers and defenders of a subset X of a secure set candidate S. By these we mean elements of N [X] \ S and
4
Complexity of Secure Sets
Qsat2 Lemma 2 Exact Secure SetFNC
Secure SetFNC
Lemma 3 Exact Secure Set
Theorem 6
FN
Secure SetFN
Lemma 4 Exact Secure Set
F
Theorem 6 Lemma 5
Theorem 6 Exact Secure Set
Secure SetF Theorem 6 Secure Set
Figure 3 Reduction strategy for proving ΣP 2 -hardness of Secure Set
N [X] ∩ S, respectively. To show that a subset X of a secure set candidate S is not a witness to S being insecure, we sometimes employ the notion of matchings of the attackers of X with dedicated defenders in N [X] ∩ S: If we are able to find an injective mapping µ : N [X] \ S → N [X] ∩ S, then obviously |N [X] \ S| ≤ |N [X] ∩ S|. Given such a matching µ, we say that a defender d repels an attack on X by an attacker a whenever µ(a) = d. Consequentially, when we say that a set of defenders D can repel attacks on X from a set of attackers A, we mean that there is a matching that assigns each element of A a dedicated defender in D.
3
Complexity Results
In this section we prove ΣP 2 -hardness of the Secure Set problem and several variants by a chain of polynomial reductions from Qsat2 . Our proof strategy is illustrated in Figure 3. In Theorem 6, we finally obtain ΣP 2 -completeness for eight problems. I Lemma 2. Exact Secure SetFNC is ΣP 2 -hard. Proof. We reduce from Qsat2 to Exact Secure SetFNC . We are given a quantified Boolean formula ϕ = ∃x1 . . . ∃xnx ∀y1 . . . ∀yny ψ, where ψ is in 3-DNF and contains nt terms. We assume that no term contains both a variable and its complement (since such a term can never be satisfied) and that each term contains at least one universally quantified variable (since ϕ is trivially true otherwise). We construct an instance (G, k, V4 , V , C) of Exact Secure SetFNC in the following. For an illustration, see Figure 4. We define the graph G = (V, E) and let V be the union of the following sets: X = {x1 , . . . , xnx }
X = {x1 , . . . , xnx }
Y = {y1 , . . . , yny }
Y = {y1 , . . . , yny }
Y4 =
4 {yi,j , yi,j 4
| 1 ≤ i ≤ ny , 1 ≤ j ≤ nt }
Y = {yi,j | 1 ≤ i ≤ ny , 1 ≤ j ≤ nt + 1}
T = {t1 , . . . tnt }
Y40 = {yj4 | 1 ≤ j ≤ nt − 1}
H = {d 1 , d2 , t }
T = {t1 , . . . tnt }
T = {t1 , . . . tnt } T 0 = {t01 , . . . , t0nt } 0 T0 = {t0 1 , . . . , t nt }
4
4
T 4 = {t1 , . . . tnt } T 0 = {t01 , . . . t0nt }
T 0 = {t01 , . . . , t0nt }
B. Bliem and S. Woltran
t1
t2
t3
x1 6= x1 x2 6= x2 x3 6= x3 d 1
5
(nt )
t1 6= t1
6= t01 6= t01
t2 6= t2
6= t02 6= t02
t3 6= t3 d 2
6= t03 6= t03 t
y1 (nt + 1)
y1 (nt − 1)
y2
y2
Figure 4 Graph corresponding to the Qsat2 formula ∃x1 ∃x2 ∃x3 ∀y1 ∀y2 (¬x1 ∧ x2 ∧ y1 ) ∨ (x3 ∧ ¬y1 ∧ y2 ) ∨ (x3 ∧ ¬y1 ∧ ¬y2 ) . To avoid clutter, we omit labels for the vertices from Y4 , Y40 , Y , T 4 , T0 and T 0 , and we draw some edges in a dashed style.
Next we define the set of edges. In the following, whenever we sloppily speak of a literal in the context of the graph G, we mean the vertex corresponding to that literal (i.e., some xi , xi , yi or yi ), and we proceed similarly for terms. Furthermore, when we are dealing with a (vertex corresponding to a) literal l, then l shall denote the (vertex corresponding to the) complement of l. For any term ti , let LX (ti ) and LY (ti ) denote the set of existentially and universally quantified literals, respectively, in ti . n o 4 0 0 0 E = (ti , t ), (ti , ti ), (t0i , t0 i ), (ti , ti ) | ti ∈ T ∪ T × (Y ∪ Y ) n o n o ∪ (l, ti ), (l, ti ) | ti ∈ T, l ∈ LX (ti ) ∪ (l, t0i ) | ti ∈ T, l ∈ LY (ti ) o n o n ∪ (d 1 , ti ) | ti ∈ T, |LX (ti )| ≤ 1 ∪ (d2 , ti ) | ti ∈ T, LX (ti ) = ∅ n o 4 ∪ (yi , yi,j ), (yi , yi,j 4 ) | 1 ≤ i ≤ ny , 1 ≤ j ≤ nt n o ∪ (yi , yi,j ), (yi , yi,j ) | yi,j ∈ Y ∪ Y40 × (Y ∪ Y ) Finally, we define V4 = Y ∪ Y ∪ Y4 ∪ Y40 ∪ T 4 ,
V = Y ∪ T ∪ T0 ∪ T 0 ∪ H,
C = {(xi , xi ) | 1 ≤ i ≤ nx } ∪ {(ti , ti ), (ti , t0i ), (t0i , t0i ) | 1 ≤ i ≤ nt }, and k = |V4 | + nx + 2nt . The following observations are crucial: Elements of X ∪ X are only adjacent to vertices from T (which are forbidden) and T . For any i, each element of X ∪ X is adjacent to ti ∈ T iff it is adjacent to ti ∈ T . Furthermore, for any i, j, if xi or xi is adjacent to tj , then setting the variable xi to true or false, respectively, falsifies the term tj . Finally, for any i, j, if yi or yi is adjacent to t0j , then setting the variable yi to true or false, respectively, falsifies the term tj . We claim that ϕ is true iff (G, k, V4 , V , C) is a positive instance of Exact Secure SetFNC . Since, for each ϕ, the corresponding instance (G, k, V4 , V , C) can be constructed in time polynomial in the size of ϕ, ΣP 2 -hardness follows.
6
Complexity of Secure Sets
“Only if” direction. If ϕ is true, then there is an assignment I to x1 , . . . , xnx such that, for all assignments extending I to y1 , . . . , yny , some term in ψ is satisfied. We define a set S = V4 ∪ {xi ∈ X | I(xi ) = true} ∪ {xi ∈ X | I(xi ) = false} ∪ {ti ∈ T , t0i ∈ T 0 | there is some l ∈ LX (ti ) such that I 6|= l} ∪ {ti ∈ T, t0i ∈ T 0 | for all l ∈ LX (ti ) it holds that I |= l}. We observe that |S| = k, V ∩ S = ∅, V4 ⊆ S, and that for any (a, b) ∈ C it holds that a ∈ S iff b ∈ / S. By construction, whenever some element of X ∪ X is in S, then all its neighbors in T are in S; and whenever some ti is in S, then some neighbor of ti in X ∪ X is in S. We claim that S is a secure set in G. Let R be an arbitrary subset of S. We show that R has at least as many defenders as attackers by matching each attacker of R with a dedicated defender in N [R] ∩ S. We distinguish cases regarding the origins of the attacks on R.
We match each attacker ti ∈ T with ti . Since ti attacks R, R must contain some element of X ∪ X that is adjacent to ti and thus also to ti , so ti ∈ N [R] ∩ S. Each attacker from X ∪ X ∪ {d 1 , d2 } is adjacent to some ti ∈ T ∩ R. We match that 4 attacker with ti , which is adjacent to ti . Note that it cannot be the case that ti is attacked by more than one vertex in X ∪X ∪{d 1 , d2 } because ti has exactly two neighbors from that set and would not be in S if neither of these neighbors was in S. If t attacks R, then it attacks at least one element of T ∩ R, which is adjacent to some element of X ∪ X that is also in S. We match t with any such element of X ∪ X. 4 4 Any attack from some ti ∈ T on R must be on ti . Since ti ∈ / S, ti is not consumed for 4 repelling an attack on ti , so we match ti with ti . 0 0 0 0 If some t0 i ∈ T attacks R (by attacking ti ), we match ti with ti .
Analogously, we match each attacker t0i ∈ T 0 with t0i . If, for some i with 1 ≤ i ≤ ny , the vertices yi,j for 1 ≤ j ≤ nt + 1 attack R, then we 4 distinguish the following cases: If yi is in R, then the adjacent vertices yi,j for 1 ≤ j ≤ nt 4 are in the neighborhood of R, too. We then match each yi,j with yi,j for 1 ≤ j ≤ nt , and we match yi,n with yi . Otherwise, yi is in R, and we proceed symmetrically using t +1 4 yi,j and yi as matches. In order to account for attacks from T 0 ∪ T 0 on R, we distinguish two cases. If, for some i with 1 ≤ i ≤ ny , both yi and yi are in R, then, in the step before, we 4 have matched each yi,j with the respective yi,j or yi , but all yi,j 4 are still free. These 0 0 vertices can repel all attacks from T ∪ T , as there are at most nt such attacks. Otherwise we show that there are at most nt − 1 attacks from T 0 ∪ T 0 , and they can be repelled using Y40 . Consider the (partial) assignment J that assigns the same values to the variables x1 , . . . , xnx as the assignment I above, and, for any variable yi , sets yi to true or false if R contains the vertex yi or yi , respectively. By assumption we know that our assignment to x1 , . . . , xnx is such that for all assignments to y1 , . . . , yny some term ti in ψ is true. In particular, it must therefore hold that J falsifies no existentially quantified literal in ti . Then, by construction of S, the vertex t0i is not in S. We also know that J falsifies no universally quantified literal in ti . But then the vertices from Y ∪ Y adjacent to the vertex t0i are not in R due to our construction of J, so t0i does not attack any vertex in R. From this it follows that there are at most nt − 1 attacks from T 0 ∪ T 0 on R. We can repel all these attacks using the vertices y14 , . . . , yn4t −1 . This allows us to conclude |N [R] ∩ S| ≥ |N [R] \ S|. Therefore S is secure.
B. Bliem and S. Woltran
··· a
7
aab
4ab
bab
b ···
···
ab ab ab aab n+1 an+2 an+3 an+4
ab ab ab bab n+4 bn+3 bn+2 bn+1 · · ·
bab 1
··· aab 1
ab ab ab aab n+1 an+2 an+3 an+4
ab ab ab bab n+4 bn+3 bn+2 bn+1 · · ·
bab 1
aab 1
Figure 5 Gadget resulting from reducing an Exact Secure SetFNC instance with (a, b) ∈ C to an equivalent Exact Secure SetFN instance. Dashed rounded rectangles designate cliques.
“If” direction. Suppose S is a secure set in G honoring the conditions regarding forbidden, necessary and complementary vertices. If S contains some l ∈ X ∪ X, then N (l) ∩ T ⊆ S, as the number of neighbors l has in T is equal to the number of its other neighbors, which are all in T and attack l since T ⊆ V . If S contains some ti ∈ T , then ti must be adjacent to some element of X ∪ X that is also in S. Otherwise ti would have three attackers (t and two vertices from X ∪ X ∪ {d 1 , d2 }) 4 but only two defenders (ti and itself). We construct an interpretation I on the variables x1 , . . . , xnx that sets exactly those xi to true where the corresponding vertex xi is in S, and we claim that for each extension of I to the universally quantified variables there is a satisfied term in ψ. To see this, suppose to the contrary that some assignment J to all variables extends I but falsifies all terms in ψ. Then we define a set R consisting of all vertices yi such that J(yi ) = true, all vertices yi such that J(yi ) = false, and all vertices in (T 0 ∪ T 0 ) ∩ S that are adjacent to these vertices yi or yi . Clearly, R is a subset of S. R has |R| defenders due to itself, nt − 1 defenders due to Y40 , and ny · nt defenders due to N (R) ∩ Y4 . This amounts to |N [R] ∩ S| = |R| + nt − 1 + ny · nt . On the other hand, there are nt attacks on R from T 0 ∪ T 0 . This is because for any term ti in ψ one of the following cases applies: The term ti is falsified already by I. Then t0i ∈ S and thus t0i ∈ / S. The vertex t0i , however, is adjacent to any element of Y ∪ Y , so it attacks R. The term ti is not falsified by I but by J. Then t0i ∈ / S, and LY (ti ) contains some literal l with l ∈ N (t0i ) and J |= l, so l is in R and attacked by t0i . In addition to these nt attackers, R has R ∩ (T 0 ∪ T 0 ) attackers in N (R) ∩ (T0 ∪ T 0 ), as well as ny · (nt + 1) attackers in Y . Since |R| = ny + R ∩ (T 0 ∪ T 0 ) , we obtain in total |N [R] \ S| = nt + R ∩ (T 0 ∪ T 0 ) + ny · (nt + 1) = |R| + nt + ny · nt > |N [R] ∩ S|. This contradicts S being secure, so for each extension of I to the universally quantified vertices, ψ is true; hence ϕ is true. J I Lemma 3. Exact Secure SetFN is ΣP 2 -hard. Proof. We give a polynomial reduction from Exact Secure SetFNC . The statement then follows from Lemma 2. Let an instance of Exact Secure SetFNC be given by G = (V, E), k > 0, V ⊆ V , V4 ⊆ V and C ⊆ V 2 , and let n = |V |. We now formally construct a graph G0 = (V 0 , E 0 ). For each (a, b) ∈ C, we introduce new vertices aab , bab and 4ab as well as, for any x ∈ {a, b}, sets ab ab ab ab ab ab of new vertices Cxabc = {xab , . . . , xab 1 , . . . , xn+1 }, Dx c = {xn+2 , . . . , xn+4 }, Cx = {x1 n+1 } ab ab and Dx = {xab , . . . , x }; see also Figure 5 how these vertices are used. We define n+2 n+4 [ ab ab ab ab V0 =V ∪ {4ab , aab , bab } ∪ Caabc ∪ Cbabc ∪ Ca ∪ Cb ∪ Daabc ∪ Dbabc ∪ Da ∪ Db , (a,b)∈C
8
Complexity of Secure Sets
E0 = E ∪
[
[
{(4ab , xab )} ∪ ({x} × Cxabc) ∪ ({xab } × Dxabc)
(a,b)∈C x∈{a,b}
ab ab 2 ∪ {(s, t) ∈ (Cxabc ∪ Cx ∪ Dxabc ∪ Dx ) | s 6= t} . S ab ab ab ab Finally, we define k 0 = k + |C| · (n + 6), V0 = V ∪ (a,b)∈C (Ca ∪ Cb ∪ Da ∪ Db ) and S 0 ab V4 = V4 ∪ (a,b)∈C {4 }). We claim that (G, k, V , V4 , C) is a positive instance of Exact Secure SetFNC iff (G0 , k 0 , V0 , V40 ) is a positive instance of Exact Secure SetFN . “Only if” direction. Let S ⊆ V \ V be a secure set in G with |S| = k and V4 ⊆ S such that S |S ∩ {a, b}| = 1 whenever (a, b) ∈ C. We construct S 0 = S ∪ (a,b)∈C, x∈S∩{a,b} ({4ab , xab } ∪ Cxabc∪Dxabc) and observe that S 0 ∩V0 = ∅, V40 ⊆ S 0 , and |S 0 | = k 0 . Let X 0 be an arbitrary subset of S 0 . Since S is secure and X 0 ∩V ⊆ S, there is a matching µ : NG [X 0 ∩V ]\S → NG [X 0 ∩V ]∩S. We now construct a matching µ0 : NG0 [X 0 ] \ S 0 → NG0 [X 0 ] ∩ S 0 . For any attacker v of X 0 in G0 , we distinguish three cases. ab ab If v is some xab ∈ Cx ∪ Dx for some (a, b) ∈ C and x ∈ {a, b}, we set µ0 (v) = xab i i . 0 This element is in NG0 [X ] since all nodes in X 0 that v can attack are adjacent to it. If v is aab or bab for some (a, b) ∈ C, its only neighbor in X 0 can be 4ab (by our construction of S 0 ), and we set µ0 (v) = 4ab . Otherwise v is in NG [X 0 ∩ V ] \ S (by our construction of S 0 ). Since the codomain of µ is a subset of the codomain of µ0 , we may set µ0 (v) = µ(v).
Since µ0 is injective, each attack on X 0 in G0 can be repelled by S 0 . Thus S 0 is secure in G0 . “If” direction. Let S 0 ⊆ V 0 \ V0 be a secure set in G0 with |S 0 | = k 0 and V40 ⊆ S 0 . First we make the following observations for each (a, b) ∈ C and each x ∈ {a, b}: If x ∈ S 0 , then Cxabc ∩ S 0 6= ∅, since x only has at most n − 1 neighbors not in Cxabc. Similarly, if xab ∈ S 0 , then Dxabc ∩ S 0 6= ∅, as xab only has one neighbor not in Dxabc. ab 0 ab ab 0 ab If some xab i ∈ Cx c is in S , then Cx c∪ Dx c∪ {x} ⊆ S , since xi has n + 4 attackers from ab ab Cx ∪ Dx and only n + 4 other neighbors. ab 0 ab ab ab 0 If some xab i ∈ Dx c is in S , then Cx c ∪ Dx c ∪ {x } ⊆ S for the same reason. So for any (a, b) ∈ C and x ∈ {a, b}, S 0 contains either all or none of {x, xab } ∪ Cxabc ∪ Dxabc. For each (a, b) ∈ C, S 0 contains aab or bab , since 4ab ∈ S 0 , whose neighbors are aab and ab b . It follows that |S 0 | > |C| · (n + 6) even if S 0 contains only one of each (a, b) ∈ C. If, for some (a, b) ∈ C, S 0 contained both a and b, we could derive a contradiction to |S 0 | = k 0 because then |S 0 | > (|C| + 1) · (n + 6) > k 0 . So S 0 contains either a or b for any (a, b) ∈ C. We construct S = S 0 ∩ V and observe that |S| = k, V4 ⊆ S, V ∩ S = ∅, and |S ∩ {a, b}| = 1 for each (a, b) ∈ C. Let X be an arbitrary subset of S. We construct X 0 = X ∪ S ab observe that each Cxabc we put into X 0 entails Cxabc ∪ Dxabc = n + 4 (a,b)∈C,x∈X∩{a,b} Cx c and ab ab additional defenders and Cx ∪ Dx = n + 4 additional attackers of X 0 in G0 compared to 0 0 X in G; so |NG0 [X ] ∩ S | − |NG [X] ∩ S| = |NG0 [X 0 ] \ S 0 | − |NG [X] \ S|. Clearly X 0 ⊆ S 0 , so |NG0 [X 0 ] ∩ S 0 | ≥ |NG0 [X 0 ] \ S 0 | as S 0 is secure in G0 . We conclude |NG [X] ∩ S| ≥ |NG [X] \ S|. Hence S is secure in G. J I Lemma 4. Exact Secure SetF is ΣP 2 -hard. Proof. We give a polynomial reduction from Exact Secure SetFN . The statement then follows from Lemma 3. Let an instance of Exact Secure SetFN be given by G = (V, E), k > 0, V ⊆ V and V4 ⊆ V . Let n denote |V | and let V c denote V \ (V ∪ V4 ). We assume k ≥ |V4 |, as the
B. Bliem and S. Woltran
a
9
b
a
b
a1 a2 a3 a 1 a2 a3
Figure 6 Transformation of a sample Secure SetFN instance with k = 1 to an equivalent Secure SetF instance with k0 = 4. The the dashed rounded rectangle designates a clique.
instance is trivially negative otherwise. We define for each v ∈ V c the set of new vertices c Cv = {v1 , . . . , vn+1 , v1 , . . . , vn+1 }, and we use shorthand notation Cv = {v1 , . . . , vn+1 } and Cv = {v1 , . . . , vn+1 }. The intention is for each vi to be forbidden and for each vi to be in a secure set iff v is in it at the same time. We define the graph G0 = (V 0 , E 0 ) with [ c V0 =V ∪ Cv , E 0 = E ∪ {(v, u) | v ∈ V c, u ∈ Cv } ∪ {(s, t) ∈ Cv2 | v ∈ V c, s 6= t}. v∈V b S Furthermore, we define V0 = V ∪ v∈V b Cv and k 0 = |V4 | + (k − |V4 |) · (n + 2). An example for this construction is given in Figure 6. We claim that (G, k, V , V4 ) is a positive instance of Exact Secure SetFN iff (G0 , k 0 , V0 ) is a positive instance of Exact Secure SetF . “Only if” direction. Let S ⊆ V \ V be a secure set in G with |S| = k and V4 ⊆ S. S c We construct S 0 = S ∪ v∈S∩V b Cv . It holds that |S 0 | = |S| + (|S| − |V4 |) · (n + 1) = k + (k − |V4 |) · (n + 1) = |V4 | + (k − |V4 |) · (n + 2) = k 0 . To show that S 0 is secure in G0 , let X 0 be an arbitrary subset of S 0 . Since S is secure in G and X 0 ∩ V ⊆ S, there is a matching µ : NG [X 0 ∩ V ] \ S → NG [X 0 ∩ V ] ∩ S. We now construct a matching µ0 : NG0 [X 0 ] \ S 0 → NG0 [X 0 ] ∩ S 0 . For any attacker a of X 0 in G0 , we distinguish two cases: c If a is some is some vi ∈ Cv for some v ∈ V c, there is some vj ∈ Cv in X 0 . We set c µ0 (vi ) = vi , which is in NG0 [X 0 ] ∩ S 0 since Cv forms a clique. Otherwise a is in NG [X 0 ∩ V ] \ S (by our construction of S 0 ). Since the codomain of µ is a subset of the codomain of µ0 , we may set µ0 (a) = µ(a). Since µ0 is injective, each attack on X 0 in G0 can be repelled by S 0 . Thus S 0 is secure in G0 . “If” direction. Let S 0 ⊆ V 0 \ V0 be a secure set in G0 with |S 0 | = k 0 . If S 0 contains some c c vi ∈ Cv for some v ∈ V c, then {v} ∪ Cv ⊆ S 0 , as vi has n + 1 attackers in Cv and only n + 1 c neighbors not in Cv . It is impossible for S 0 to contain some v ∈ V c but none of Cv , as v has c c at most n − 1 neighbors not in Cv and |Cv | = n + 1. From these considerations we derive |S 0 | = |S 0 ∩ V4 | + |S 0 ∩ V c| · (n + 2). Since |V4 | ≤ n, this implies |S 0 | mod (n + 2) = |S 0 ∩ V4 |. At the same time, |S 0 | = k 0 = |V4 | + (k − |V4 |) · (n + 2), which implies |S 0 | mod (n + 2) = |V4 |. We conclude |S 0 ∩ V4 | = |V4 |, so V4 ⊆ S 0 . We construct S = S 0 ∩ V and claim that it is secure in G. It is easy to see that |S| = k; otherwise we would obtain a contradiction to |S 0 | = k 0 as we have seen that, for any v ∈ V c, c S 0 contains all elements of Cv ∪ {v} whenever it contains any of them. Let X be an S c c arbitrary subset of S. We construct X 0 = X ∪ v∈X∩V observe that each Cv we b Cv and c c put into X 0 entails |Cv | additional defenders and Cv = |Cv | additional attackers of X 0 in G0 compared to X in G; so |NG0 [X 0 ] ∩ S 0 | − |NG [X] ∩ S| = |NG0 [X 0 ] \ S 0 | − |NG [X] \ S|. Clearly X 0 ⊆ S 0 , so |NG0 [X 0 ] ∩ S 0 | ≥ |NG0 [X 0 ] \ S 0 | as S 0 is secure in G0 . Consequently |NG [X] ∩ S| ≥ |NG [X] \ S|. Hence S is secure in G. J
10
Complexity of Secure Sets
··· a
· · · a0 a1 a2 a3 a4 a5
a 0 a 1 a 2 a 3 a 4 a 5
Aa
··· ··· ··· ···
a 0 b 0 c 0 d 0
B
a0 b0 c0 d0 f1 f2
w1 w2 w3 w4
Figure 7 For a sample instance of Exact Secure SetF with V = {a, b, c, d} and k = 2, the left hand side illustrates the gadget that forces either all or none of a, a0 , . . . , an+1 to be in a solution of the resulting Secure SetF instance, while the right hand side illustrates the gadget that makes sure that at least k elements of V must be in each solution. Dashed rounded rectangles indicate cliques. For a sample solution candidate S 0 with {a, a0 , . . . , a5 , b0 , w1 , . . . , w5 } ⊆ S 0 , the dotted arrows indicate how attacks on {a0 , b0 } can be repelled.
I Lemma 5. Secure SetF is ΣP 2 -hard. Proof. We give a polynomial reduction from Exact Secure SetF . The statement then follows from Lemma 4. Let an instance of Exact Secure SetF be given by G = (V, E), k > 0 and V ⊆ V . Let c n denote |V |. We define for each v ∈ V the sets of new vertices Av = {v0 , v1 , . . . , vn+1 }, A v = c c + {v0 , v1 , . . . , vn+1 }, and denote by Av the set Av \ {v0 } and by Av the set Av ∪ A . We also v introduce the new vertices W = {w1 , . . . , wn } and F = {f1 , . . . , fk }, and we write A0 to denote {v0 ∈ Av | v ∈ V } and B to denote A0 ∪ W ∪ F . We define the graph G0 = (V 0 , E 0 ) S with V 0 = V ∪ W ∪ F ∪ v∈V Av and 2 2 E 0 = E ∪ {(v, u) | v ∈ V, u ∈ A+ v } ∪ {(s, t) ∈ Av | v ∈ V, s 6= t} ∪ {(s, t) ∈ B | s 6= t}.
S 0 Furthermore, we define V0 = V ∪ F ∪ v∈V A v and k = k · (n + 3) + n. Our construction is illustrated in Figure 7. For any v ∈ V , the intention for vi is to be in a secure set iff v is in it. The intention behind the clique B is that W shall be part of any secure set and is used for repelling attacks from F (consisting of forbidden vertices) and from those elements of A0 that are not in the secure set. This gadget shall enforce that all secure sets in G0 contain k elements of V . We claim that (G, k, V ) is a positive instance of Exact Secure SetF iff (G0 , k 0 , V0 ) is a positive instance of Secure SetF . “Only if” direction. Let S ⊆ V \ V be a secure set in G with |S| = k. We construct S c S 0 = S ∪ W ∪ v∈S Av and observe that |S 0 | = k 0 . Let X 0 be an arbitrary subset of S 0 . Since S is secure and X 0 ∩ V ⊆ S, there is a matching µ : NG [X 0 ∩ V ] \ S → NG [X 0 ∩ V ] ∩ S. We now construct a matching µ0 : NG0 [X 0 ] \ S 0 → NG0 [X 0 ] ∩ S 0 by distinguishing three cases: c 0 0 For any v ∈ V , if any vi ∈ A v attacks X , there is some vj ∈ Av in X . We set c 0 0 0 µ (vi ) = vi , which is in NG0 [X ] ∩ S since Av forms a clique. If any of the 2n + k elements of B attacks X 0 , B ∩ X 0 = 6 ∅. By construction, |A0 ∩ S 0 | = k 0 and W ⊆ S , and we know |W | = n. So there are exactly n attacks from B. They can all be repelled using the n vertices in W , which are all in NG0 [X 0 ] ∩ S 0 as B forms a clique. Any v ∈ V attacking X 0 is in NG [X 0 ∩ V ] \ S, due to our construction of S 0 . Since the codomain of µ is a subset of the codomain of µ0 , we may set µ0 (v) = µ(v). Clearly, µ0 is injective, so S 0 can repel each attack on X 0 in G0 . Thus S 0 is secure in G0 .
B. Bliem and S. Woltran
“If” direction. Let S 0 ⊆ V 0 \ V0 be a secure set in G0 with 1 ≤ |S 0 | ≤ k 0 . First we make the following observations: 0 If v ∈ S 0 for some v ∈ V , then some element of A+ v must be in S as well, since v has + n + 1 neighbors in Av , while it only has at most n − 1 neighbors not in A+ v. 0 If v0 ∈ S 0 for some v ∈ V , then some vi ∈ A+ is in S ; otherwise v would have at least 0 v 2n + 3 + k attackers due to Av \ {v0 } and F , while v0 has only 2n − 1 other neighbors (due to W and A0 \ {v0 }). c 0 If vi ∈ S 0 for some v ∈ V and vi ∈ A+ v , then Av ∪ {v} ⊆ S , since vi has n + 2 attackers c from Av and only n + 2 other neighbors (due to Av \ {vi } and v). If wi ∈ S 0 for some wi ∈ W , then v0 ∈ S 0 for some v ∈ V ; otherwise wi would have at least n + k attackers due to A0 ∪ F and at most n defenders (due to W ).
It follows that, for any v ∈ V , S 0 contains either all or none of {v, v0 , v1 , . . . , vn+1 }. This implies that S 0 cannot contain more than k elements of V , since |S 0 | ≤ k 0 . Moreover, the case distinction shows that if any vertex is in S 0 , then in particular some v ∈ V is in S 0 . As S 0 is not empty, we may conclude that v0 ∈ S 0 for some v ∈ V . Since v0 has n + 2 attackers from A and at least n − k attackers from A0 (as at most k v , k attackers from F 0 elements of A0 can be in S ), v0 in total has at least 2n + 2 attackers. At the same time, v0 c has n + 2 defenders from Av (including itself), at most n defenders from W , and no other defenders. So v0 has at most 2n + 2 defenders. This shows that S 0 must contain W and at least k elements of V ; otherwise v0 would have more attackers than defenders. It follows in particular that S 0 contains exactly k elements of V . We construct S = S 0 ∩ V and observe that |S| = k and V ∩ S = ∅. Let X be an S + arbitrary subset of S. We construct X 0 = X ∪ v∈X A+ v and observe that each Av we c c 0 put into X entails |Av | additional defenders and Av = |Av | additional attackers of X 0 in G0 compared to X in G; so |NG0 [X 0 ] ∩ S 0 | − |NG [X] ∩ S| = |NG0 [X 0 ] \ S 0 | − |NG [X] \ S|. We have X 0 ⊆ S 0 and |NG0 [X 0 ] ∩ S 0 | ≥ |NG0 [X 0 ] \ S 0 | as S 0 is secure in G0 . It follows that |NG [X] ∩ S| ≥ |NG [X] \ S|. This shows that S is secure in G. J We can now state the main result of the paper. I Theorem 6. The following problems are all ΣP 2 -complete: (a) Secure Set, (b) Exact Secure Set, (c) Secure SetF , (d) Exact Secure SetF , (e) Secure SetFN , (f) Exact Secure SetFN , (g) Secure SetFNC , and (h) Exact Secure SetFNC . Proof. For membership in ΣP 2 , given an instance of one of the problems under consideration, we guess a subset S of the vertices such that, depending on the problem variant, the size of S is either at most k or exactly k, and S additionally respects the applicable conditions regarding forbidden, necessary and complementary vertices. Checking that S is secure can be done with an NP oracle [6]. We recall our proof strategy illustrated in Figure 3. ΣP 2 -hardness of (h), (f), (d) and (c) follows from Lemmas 2–5. We obtain ΣP 2 -hardness of (e) and (g) by a trivial reduction from Secure SetF : Any instance of the latter is also an instance of both the former and has exactly the same secure sets in all cases. We now show ΣP 2 -hardness of Secure Set (a) by a polynomial reduction from Secure F Set (c). Let an instance of Secure SetF be given by G = (V, E), k > 0 and V ⊆ V . For each f ∈ V , we introduce new vertices f1 , . . . , f2k , and we define a graph G0 = (V 0 , E 0 ) with V 0 = V ∪ {f1 , . . . , f2k | f ∈ V }, E 0 = E ∪ {(fi , fj ) | f ∈ V , 1 ≤ i < j ≤ 2k} ∪ {(f, fi ) | f ∈ V , 1 ≤ i ≤ 2k}.
11
12
Complexity of Secure Sets
The instance (G, k, V ) of Secure SetF possesses the same solutions as the instance (G0 , k) of Secure Set: Each secure set S in G is also secure in G0 because the subgraph of G induced by NG [S] is isomorphic to the subgraph of G0 induced by NG0 [S]. On the other hand, a secure set S 0 in G0 with |S 0 | ≤ k cannot not contain any v ∈ {f, f1 , . . . , f2k } for any f ∈ V , as |N [v]| ≥ 2k + 1. Hence S 0 is also secure in G as the subgraphs induced by the respective neighborhoods are again isomorphic. The same argument also proves ΣP 2 -hardness of Exact Secure Set (b) by reduction from Exact Secure SetF (d). J
4
Conclusion
In this work, we have solved a complexity problem in graph theory that, to the best of our knowledge, has remained open since the introduction of secure sets [3] in 2007. We have shown that the problem of deciding whether, for a given graph G and integer k, G possesses a non-empty secure set of size at most k is ΣP 2 -complete. We moreover obtained ΣP 2 -completeness for seven further variants of this problem. In future work, we would like to identify subclasses of graphs that make the problems under consideration easier. Additionally, we plan to contribute results on the parameterized complexity of secure sets beyond the already known fixed-parameter tractability result from [5]. In particular, we believe that recently introduced classes (above NP) due to [4] are of interest here for some parameters, since our results show that the general hardness of secure sets makes the problem amenable to such an analysis in principle. References 1
2 3 4 5 6 7 8
Michael Abseher, Bernhard Bliem, Günther Charwat, Frederico Dusberger, and Stefan Woltran. Computing secure sets in graphs using answer set programming. In Proc. of ASPOCP’14, 2014. Gerhard Brewka, Thomas Eiter, and Mirosław Truszczyński. Answer set programming at a glance. Commun. ACM, 54(12):92–103, 2011. Robert C. Brigham, Ronald D. Dutton, and Stephen T. Hedetniemi. Security in graphs. Discrete Appl. Math., 155(13):1708–1714, 2007. Ronald de Haan and Stefan Szeider. The parameterized complexity of reasoning problems beyond NP. In Proc. of KR’14, pages 82–91, 2014. Rosa I. Enciso and Ronald D. Dutton. Parameterized complexity of secure sets. In Congr. Numer., volume 189, pages 161–168, 2008. Yiu Yu Ho. Global Secure Sets of Trees and Grid-like Graphs. PhD thesis, University of Central Florida, Orlando, USA, 2011. Dániel Marx. Complexity of clique coloring and related problems. Theor. Comput. Sci., 412(29):3487–3500, 2011. Stefan Szeider. Generalizations of matched CNF formulas. Ann. Math. Artif. Intell., 43(1):223–238, 2005.