Abstract 1 Introduction: The Mission 2 The Network Architecture 3 The Timeline Deployment Strategy 4 Hardness 5 Conclusions References

The Berlin Safe House Puzzle: Spycraft via Interval Graphs

Gennaro Cordasco111Corresponding author ORCID Dipartimento di Informatica, Università degli Studi di Salerno, Fisciano, Italy Luisa Gargano ORCID Dipartimento di Informatica, Università degli Studi di Salerno, Fisciano, Italy Adele Anna Rescigno ORCID Dipartimento di Informatica, Università degli Studi di Salerno, Fisciano, Italy
Abstract

We propose a gamified application of the Identifying Code problem on Interval Graphs, framed as a high-stakes Cold War counter-intelligence operation. We present a polynomial-time algorithm to assign “Listening Devices” (bugs) to “Safe Houses” (intervals) so that every safe house is uniquely identifiable by its bug signature. While the problem is NP-hard on several graph classes, including chordal and bipartite graphs, the interval-graph structure allows us to compute a 2-approximate solution efficiently.

Keywords and phrases:
Interval Graphs, Watching-System, Approximate Algorithms
Copyright and License:
[Uncaptioned image] © Gennaro Cordasco, Luisa Gargano, and Adele Anna Rescigno; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Problems, reductions and completeness
; Theory of computation Approximation algorithms analysis
Funding:
This work was partially supported by project SERICS (PE00000014) under the MUR National Recovery and Resilience Plan funded by the European Union – NextGenerationEU.
Editor:
John Iacono

1 Introduction: The Mission

Welcome, Agent X. The year is 196X. You are a spy handler operating in the shadowed streets of Cold War Berlin.

Your network consists of m Safe Houses. Due to rigorous security protocols, each safe house is active only during a specific time window. However, a vulnerability exists: Two safe houses are connected if their active times overlap, meaning that agents can move between them without being exposed. Your mission is to secure the network against leaks. To do this, you must plant Listening Devices (Bugs) within the safe houses. These devices are sophisticated; a bug placed in one house can be tuned to listen to any chosen subset of the overlapping (connected) houses.

The Constraint

To succeed, your deployment must satisfy a critical Unique Identification directive: generate a unique “bug signature” – the specific set of bugs that can hear it. If a message is intercepted, you must be able to identify exactly which safe house it came from. If two houses share the same signature, the network is compromised.

The Strategy

The problem challenges us to find the minimum number of bugs required to make the entire network identifiable.

Figure 1: The Safe House Network. Safe Houses correspond to active time intervals. House A and House B overlap in time, creating a covert connection. House C is isolated.

In the following, we declassify the mathematical dossier for this operation. We map the “Safe Houses” to intervals on a real line and the “Spy Network” to an Interval Graph. We then present an algorithm that utilizes a “Timeline Strategy” (Interval Ordering) and a “Suspicion Shuffle” mechanism to secure the network.

2 The Network Architecture

We formalize our spy network using the language of Interval Graphs and establish the following correspondence between our problem and mathematical structures. This correspondence allows us to transfer algorithmic tools, complexity results, and structural properties from the general theory of Watching Systems to the specialized interval-graph surveillance setting developed in this work. The used definitions and the notation are given in sections 2.1-2.3.

Spycraft Term Symbol Mathematical Concept
Safe House I Interval
Connection (Overlap) IJ Adjacency / Intersection
Timeline Order Interval Ordering
Listening Device (Bug) b Watcher
Bug Signature S(I) Code
Surveillance System B Watching System

2.1 Interval graphs

An interval graph is a graph in which each vertex is associated with an interval on the real line (representing the active time window of a safe house) such that two vertices are adjacent if and only if their associated intervals have a nonempty intersection (i.e., two safe houses are connected if and only if their active times overlap).

From now on, each safe house will be identified with the time interval I corresponding to its activation window. Let be a set of intervals on the time line representing our network of safe houses. We now introduce a timeline ordering relation on . For any interval I, we denote its leftmost (minimum) and rightmost (maximum) points – corresponding to the start and end times of the safe house activity – by

(I)=min{ttI},r(I)=max{ttI}.
Definition 1 (Timeline Ordering).

For all I,J,

IJ(r(I)<r(J))or(r(I)=r(J) and (I)>(J)). (1)

If ={I1,,Im} is ordered so that I1I2Im, then Ii is called the i-th safe house.

2.2 Bug Signatures and Surveillance Systems

According to (1), we define an ordering on the bugs. Bugs located in different safe houses follow the order of their intervals, whereas bugs in the same house may appear in any order.

Let B={b1,b2,,bk} be a set of listening devices on . For bugs bp,bqB located in intervals I and J, respectively, we set

bpbqwhenever IJ. (2)

In what follows, every set of bugs is assumed to be ordered according to (2), with ties broken arbitrarily.

Given a safe house J and a listening device (bug) b located in safe house I, we say that

  • J is in the range of b (equivalently b is able to listen to J) if JI (the houses’s operation times overlap);

  • J is monitored by b (equivalently b monitors J) if the bug b is tuned to listen to J.

We denote by M(b) the set of safe houses monitored by the bug b,

M(b)={J|J is monitored by b}.

Given a set of listening devices B on , together with the associate monitored set of houses (M(b) with bB), a bug signature (or code) of a safe house J is

SB(J)={bBJM(b)}.
Definition 2 (Surveillance System (SS)).

A set of listening devices B, located in is a Surveillance System for if one can determine the monitored sets M(b) for bB, so that there exists signatures SB(I), for I, such that

SB(I)andSB(I)SB(J)for all distinct I,J. (3)

We can now formally state agent X’s problem.

Surveillance System (SS)
Input: A set of intervals (safe houses) =(I1,I2,,Im).
Question: Find a minimum size Surveillance System B for .

2.3 From Field Intelligence to Graph Theory

Before proceeding to the algorithmic dossier, we highlight the exact correspondence between our spycraft terminology and its graph-theoretic counterpart.

The Underlying Watching-System Framework

Watching systems have been introduced in [1] as a more flexible framework with respect to identifying codes. An Identifying Code (IC) of a graph G=(V,E) is a subset 𝒞V such that sets {N[v]v𝒞} are nonempty and distinct, where N[v] denotes the closed neighborhood of the vertex v (the set containing v and all its neighbours)[15]. The goal is to minimize the size of 𝒞. For a comprehensive treatment of combinatorial and algorithmic aspects of identifying codes, see also [9].

In a watching system, if a watcher is placed at a vertex v, a subset of neighbor vertices (watching zone) can be selected instead of the whole closed neighborhood of v. It is also possible to place several watchers at the same vertex, with distinct watching zones.

Formally, a watching set is a collection W={(zi,Zi)}i=1k, where each ziV is a location and ZiN[zi] is the watching zone of watcher i. A watcher w=(z,Z) covers a vertex v if vZ. For each vV, its code is the set

CW(v)={wWv is covered by w}.

The set W is a watching system if all codes are nonempty and pairwise distinct. The goal is to find a watching system W of minimum size.

Various properties of watching systems, including structural characteristics and bounds on the watching number across different graph classes, are derived in [3, 1, 2, 13, 14, 17]. For a comprehensive bibliography on identifying, locating-dominating and watching systems, see [16]. We stress that the watching-system framework is strictly more general than identifying codes, and often yields much smaller solutions. Related identification frameworks include locating-dominating sets and their variants [8, 10, 18].

A constrained variant of Watching Systems, called the β-Watching System, in which a single vertex can host up to a bounded number β of watchers, has been recently introduced. For general graphs, the β-Watching System problem remains hard (even when β=1), but it admits a (2logn+1)-approximation algorithm. Moreover, when the underlying graph is a tree, an optimal β-Watching System can be computed in polynomial time [7].

Summarizing: The Surveillance System problem defined in the spycraft narrative is a direct instantiation of Watching Systems on an interval graph: Safe houses I1,,Im are the vertices of an interval graph. Each Listening Device (bug) located in a safe house I plays exactly the role of a watcher located in vertex I in the corresponding interval graph. A safe house J is monitored by a bug located in I precisely when J belongs to the chosen subset of neighbors on which the watcher located in I is probing. Thus, the set of bugs that can hear J – the bug signature S(J) – coincides with the watcher code CW(J) of the corresponding vertex in a watching system.

In our work, we instantiate this framework on interval graphs induced by time-intervals of safe houses: this specialization both justifies the surveillance (spy) interpretation and allows us to exploit interval-graph structure to design a polynomial-time factor-2 approximation algorithm for surveillance assignments.General bounds for identifying codes in terms of structural parameters such as maximum degree are studied in [12]. We stress that the identifying code problem remains NP-Hard on interval graphs [11] and a factor-6 approximation algorithm for interval graphs was presented in [6]; to the best of our knowledge, no specific results were previously known for the Watching System problem.

Our Results

In section 3, we present the Surveillance strategy. More precisely, in section 3.1 we introduce an algorithm that serves as a building block for the proposed Surveillance algorithm, which is then fully described in section 3.2. In section 4, we prove that the Surveillance System problem is NP-hard on chordal and bipartite graphs.

3 The Timeline Deployment Strategy

To secure the spy network with the fewest possible listening devices, Headquarters follows a rigorously codified deployment protocol – part greedy improvisation, part Cold-War bureaucracy carved in stone.

The operation begins by ordering all safe houses according to the Timeline Ordering introduced earlier (increasing right endpoint, with ties broken by decreasing left endpoint). This establishes the sequence in which the intervals I1I2Im are processed.

For each safe house Ii in this order, the following procedure is executed:

  1. 1.

    Attempt Signature Assignment. Look for a bug signature that Ii can receive by using the bugs already deployed; that is, all existing bugs located in intervals overlapping Ii and can, therefore, be tuned to monitor Ii.
    If a signature, which is nonempty and distinct from all previously assigned ones, exists, then nothing further is required: the safe house is uniquely identifiable.

  2. 2.

    Deploy a New Bug. Otherwise, a new bug must be introduced to guarantee a unique signature for Ii. By operational decree, this new bug must be placed at the rightmost safe house that still intersects Ii. Once positioned, the new bug is tuned to monitor Ii (and potentially other overlapping houses, as needed).

The introduction of a new bug may require a local adjustment of signatures for preceding safe houses: Some safe houses may now be monitored by this bug, others may cease to be monitored by existing ones in order to maintain consistency and injectivity. Whenever such changes occur, the algorithm recomputes the affected signatures – always following the established timeline order.

Figure 2: (a) Six safe houses are represented by the intervals I1,I2,,I6 ordered according to the Timeline Ordering in (1). (b) Two bugs ①,② have been located in I2 and I5, allowing us to identify distinct signatures for the first three intervals (signatures are shown inside the intervals while bugs appear as circled numbers). (c) Another bug ③ is located in I6, and accordingly, some signatures are recomputed. (d) A Surveillance System composed of three bugs.

An example of the Timeline Deployment Strategy is given in figure 2.

This procedure shows that the safe houses can be secured with a number of bugs which is at most twice the optimal.

3.1 A building block: Compute Signatures

In this section, we present an algorithm that serves as the basis for the proposed Surveillance algorithm, used later in section 3.2, namely the algorithm ComputeSignatures.

To describe the algorithm, we introduce an order on signatures, which is essentially the standard lexicographic ordering of subsets of a totally ordered set.

Definition 3 (Lexicographic Order on Bug Signatures).

Let X={x1,x2,,xs} and Y={y1,y2,,yt} be two ordered subsets of [k], that is,

x1<x2<<xsandy1<y2<<yt.

We say that XlexY if and only if one of the following holds:

  1. 1.

    x1=y1,,xj1=yj1, and xj<yj, for some jmin(s,t);

  2. 2.

    xj=yj for all j=1,,s and s<t.

Definition 4.

Let ={I1,,Im} be a family of intervals (safe houses), and let B={1,2,,k} be a set of bugs. For each j[m], we define Σj as the set of bugs able to listen to Ij

Σj={b[k]Ij is in the range of b}.
Definition 5 (Partial Surveillance System (PSS)).

A set of listening devices B, located in ={I1,,Im}, is a Partial Surveillance System for i={I1,,Ii} if one can determine the sets M(b)={Iji| bΣj and Ij is monitored by b}, for bB, such that the signatures Sj={bBIjM(b)}, for Iji satisfy

SjandSjSjfor all 1j,ji with jj. (4)

Clearly, for i=m the above becomes Definition 2.
The following observation will be used to characterize (Partial) Surveillance System by specifying the signatures associated with each safe house.

Observation 6.

Each Surveillance System B for ={I1,,Im} is uniquely identified by the signatures Sj associated with each safe house Ij, for every j[m]333For a positive integer a, we use [a] to denote the set of integers [a]={1,2,,a}..

Indeed, if bB is located in interval I, then b must be tuned to listen to the interval in the set M(b), where M(b)={IjbSj}.

The following fact will be useful in the following proofs.

Fact 7.

Consider the ordered intervals I1Im. For any a,b,c such that 1acbm, if IaIb then IcIb.

Proof.

Since IaIb and IaIb, by (1) we have (Ib)r(Ia). Furthermore, for each Ic with acb, it holds r(Ia)r(Ic)r(Ib). Hence, (Ib)r(Ic)r(Ib), implying IcIb.

The following lemma states that if a given set of bugs forms a Partial Surveillance System, then one can identify the signatures that certify this property by exploiting the lexicographic order on bug signatures.

Lemma 8.

Let ={I1,,Im} be a family of intervals (safe houses), and let B be a Partial Surveillance System for i. Let 𝒮=(S1,S2,,Si) be the list of signatures where, for each j[i], Sj is the lexicographically smallest signature on Σj excluding {S1,,Sj1}. (e.g. SjS1,,SjSj1). Then 𝒮 satisfies condition (4).

Proof.

By hypothesis, B is a PSS for i. Hence, at least a list of signature 𝒮=(S1,,Si) satisfying (4) exists. In the following, we transform 𝒮 to match 𝒮. We proceed by induction on i.

Base case: 𝒊=𝟏.

If S1=S1, then there is nothing to prove. If the signature S1 does not appear in 𝒮, then it is sufficient to set S1=S1.

Otherwise, S1 appears in 𝒮 as the signature of some interval Ip with p>1, i.e., Sp=S1. We show that the signatures of I1 and Ip can be swapped in 𝒮 that is SpΣ1 and S1Σp, so that 𝒮 and 𝒮 agree on I1.

Since Sp=S1Σ1, it remains to prove that S1Σp. Suppose, for contradiction, that the signature S1Σp. This implies that there exists a bug zS1 with zΣp. Let z be located in Ih, we have IhIp=.

Because S1 is the first signature in the construction of 𝒮, we know S1={b}, where bug b is the first bug in Σ1 (according to (2)). Let bug b be located in the interval Iq with q1.

We know that:

  • Sp=S1={b} implies that bug bΣp and, consequently,

    IqIp
  • zS1, and consequently zΣ1. Moreover, S1={b}, and S1 is the first signature in lexicographic orderon Σ1. It follows that b<z and by (2) consequently

    qh.

We distinguish two cases:

Case I: 𝒑𝒉.

Recalling that zΣ1 and z is located in Ih, we have I1Ih. Using ph and I1Ih, we know by Fact 7 that Ip must also intersect Ih, which contradicts IhIp=.

Case II: 𝒉<𝒑.

Using qh<p and IqIp, we know by Fact 7 that Ih must also intersect Ip, which contradicts IhIp=.

Thus, the contradiction shows that the signature S1 can be assigned to Ip and the swap is feasible.

Inductive step.

Assume that lists 𝒮 and 𝒮 agree on their first i1 entries. Since Σi depends only on the bug placement and both the lists 𝒮 and 𝒮 agree on their first i1 entries, both Si and Si belong to the same set that is the set of all the subsets of Σi excluding {S1,,Si1}. This set is nonempty because 𝒮 satisfies (4).

If Si=Si, or if Si does not appear in 𝒮, we are done. Otherwise, Si appears in 𝒮 as the signature of some interval Ip with p>i, i.e., Sp=Si.

We show that the signatures of Ii and Ip can be swapped in 𝒮 that is SpΣi and SiΣp, obtaining that 𝒮 and 𝒮 agree on their first i entries.

Since Sp=SiΣi, it remains to prove that SiΣp. Suppose, for contradiction, that the signature SiΣp. This implies that there exists a bug zSi with zΣp. Let z be located in Ih, we have IhIp=.

Let b be the first bug (under (2)) in the signature Si and let it be located in interval Iq.

We know that:

  • Since bSi=Sp, we have that bug bΣp and consequently

    IqIp
  • zSi, and consequently zΣi. Moreover, bSi, and Si is the first signature in lexicographic order taken from the set of all the subsets of Σi excluding {S1,,Si1}. It follows that b<z and by (2) consequently

    qh.

We distinguish two cases:

Case I: 𝒑𝒉.

Recalling that zΣi and z is located in Ih, we have IiIh. Using i<ph and IiIh, we know by Fact 7 that Ip must also intersect Ih, which contradicts IhIp=.

Case II: 𝒉<𝒑.

Using qh<p and IqIp, we know by Fact 7 that Ih must also intersect Ip, which contradicts IhIp=.

The contradiction shows that the signature Si can be assigned to Ip, and the swap is feasible.

Algorithm 1 ComputeSignatures(,k,i).

Exploiting the result of Lemma 8, the algorithm ComputeSignatures checks whether a prescribed set B of bugs, located in the intervals of , yields a Partial Surveillance System (PSS) for i={I1,,Ii}. If so, the algorithm returns the bug-signature list , which coincides with the signature list 𝒮 defined in the statement of Lemma 8.

The input to the procedure ComputeSignatures consists of: a set of intervals (safe houses) ={I1,,Im}; a vector k=(k1,,km) of integers; and an index i[m]. The vector k specifies a candidate set of bugs B with the associated locations: specifically, it indicates how many bugs are placed in each safe house.

The algorithm begins by assigning identifiers to the bugs in increasing order (lines 1–4), consistently with the ordering (2). The sets Bj record the bugs located in each interval Ij. Next, for each j[m], the procedure constructs the set Σj of all bugs able to listen to Ij (lines 5–7). Finally, the intervals are processed in timeline order. For each Ij, the algorithm selects the lexicographically smallest signature (according to Definition 3) on Σj with SjS1,,SjSj1, provided such a signature exists (line 9). If no admissible signature remains (Sj=null), then no Surveillance System on can be obtained using the multiplicities prescribed by k, and the algorithm returns false. Otherwise, it returns true together with the list of the distinct nonempty bug signatures assigned to the intervals I1,,Ii.

It is important to note that the algorithm only needs to look for the first signature in lexicographic order that does not belong to {S1,,Sj1}. Since at most j1 signatures are excluded, it suffices to generate up to the first j signatures on Σj in lexicographic order.

The signatures constructed by the algorithm exactly match the choice described in Lemma 8, namely, each signature Sj is the lexicographically smallest one (according to Definition 3) on Σj avoiding the previously assigned signatures {S1,,Sj1}. As a consequence, Lemma 8 immediately implies the correctness of ComputeSignatures, formally stated in Lemma 9.

Lemma 9.

Given ={I1,,Im}, let k=(k1,,km) be a vector of non-negative integers, which characterizes a set of bugs B. The algorithm ComputeSignatures(,k,i) returns true, if and only if B yields a Partial Surveillance System for i={I1,,Ii}.

3.2 The Timeline Deployment Strategy Algorithm

Algorithm 2 Surveillance().

The algorithm Surveillance() computes a Surveillance System B for a set of safe houses ={I1,,Im}.

The algorithm initializes the bug vector k=(0,,0). It then proceeds iteratively. At step i, assuming k provides a Partial Surveillance System (PSS) for i1={I1,,Ii1}, the procedure ComputeSignatures checks if k also covers the new interval Ii (line 3). If it does not, k is extended by adding a single bug within the rightmost interval intersecting Ii (lines 5–6). This update ensures k becomes a PSS for i=i1{Ii} (see Lemma 12). Consequently, after processing all inputs, the final vector k yields a Surveillance System for the entire set . An example of how Algorithm Surveillance works is given in Example 10, while Example 11 shows that Algorithm Surveillance may not be optimal.

Example 10.

The set of intervals ={I1,I2,I3,I4} depicted in figure 3 is the input of Algorithm Surveillance. At the beginning, vector k=(0,0,0,0).
At step i=1, ComputeSignatures(,k,1) returns false and the vector k is updated so that k3=1, (i.e., I3, the rightmost interval intersecting I1, must locate the first bug).
At step i=2, ComputeSignatures(,k,2) again returns false (one bug is not enough to give distinct signatures to I1 and I2) and the vector k is updated so that k3=2.
At step i=3, ComputeSignatures(,k,3) locates bug ① and ② in I3, and assigns signatures to I1,I2,I3 returning (true,(Si={1},S2={1,2},S3={2})). The vector k remains unchanged.
At step i=4, ComputeSignatures(,k,4) returns false and the vector k is updated so that k4=1, (i.e., I4, the rightmost interval intersecting I3 must locate a new bug).
Finally, ComputeSignatures(,k,4) is called again to assign the final signatures S1={1},S2={1,2},S3={1,2,3},S4={1,3} to the intervals in .

Figure 3: An example illustrating the execution of the algorithm Surveillance().
Example 11.

The suboptimality of algorithm Surveillance is depicted in figure 4: for the same family of intervals ={I1,,I7}, the algorithm Surveillance produces a solution with four bugs (left), whereas there exists an optimal solution that uses only three bugs (right).

Figure 4: An example illustrating the suboptimality of Algorithm Surveillance.

For each i[m], define q(i)=max{j[m]IiIj} as the index of the rightmost interval that intersects Ii. Let Q={j[m]i[m] such that q(i)=j}, we notice that, Algorithm Surveillance places bugs only in safe houses indexed by elements of Q.

The following lemma shows that starting from a PSS for i1 and adding a single bug located in q(i) is sufficient to obtain a PSS for i.

Lemma 12.

Given ={I1,,Im} and a vector k=(k1,,km) that yields a PSS for i1={I1,,Ii1}, for some i<m. If k does not yield a PSS for i={I1,,Ii}, then k=(k1,,km) yields a PSS for i, with

kj={kj+1if j=q(i),kjotherwise,
Proof.

We assume that k yields a PSS for i1. Let 𝒮=(S1,,Si1) be a list of nonempty, pairwise distinct signatures assigned to the intervals of i1 and associated with k. By adding one additional bug b to Iq(i), we obtain the new signature {b}, which is available for Ii and distinct from Sj for every j[i1]. Therefore, the updated vector k yields a PSS for i.

Hence, at the end of the for-loop (lines 2–6), we have that the vector k yields a SS for . The procedure ComputeSignatures is then invoked once more (line 7) to compute the signature associated with each interval in .

The following theorem establishes that the Surveillance algorithm is a 2-approximate algorithm.

Theorem 13.

Given a family of intervals (safe houses) ={I1,,Im}, Algorithm Surveillance returns, in polynomial time, a 2-approximate solution Surveillance System for identified by the pair (k,), where k=(k1,k2,,km) specifies the number of bugs located in each safe house and =(S1,,Sm) assigns a unique signature to each safe house in .

Proof.

Let k=(k1,k2,,km) be the vector returned by the algorithm, and let =(S1,,Sm) denote the corresponding list of signatures (chosen according to lexicographic order). Let o=(o1,o2,,om) be an optimal solution, and let 𝒞=(C1,C2,,Cm) be the list of associated signatures (chosen according to lexicographic order).

We show that o and 𝒞 can be transformed into k and , respectively, by adding some bugs in o. We refer to the bugs present in the optimal solution o as original bugs and to the additional ones as cloned bugs. We show that at the end of the process, there is at most one cloned bug for each original one. This implies that k yields a 2-approximate solution.

We transform o and 𝒞 step by step, starting from o(0)=o, to o(1),o(2),, o(m)=k. Similarly, we will have 𝒞(0)=𝒞, to 𝒞(1),𝒞(2),, 𝒞(m)=. We denote by Ωj the set of bugs that can listen to Ij at the current iteration, according to o(i); we stress that the bugs are identified with integers from 1 to =1mo(i) and are ordered according to (2). The following invariants are maintained by each o(i) and the list of associated signatures 𝒞(i).

Claim 14.

For each i[m], the vector o(i)=(o1(i),o2(i),,om(i)) and the corresponding list of associated signatures 𝒞(i)=(C1(i),C2(i),,Cm(i)) yields a Surveillance System for such that

  1. (a)

    kj=oj(i) for each j<q(i),

  2. (b)

    Sj=Cj(i) for each j=1,,i.

Base case: 𝒊=𝟏.

We recall that by construction, Algorithm Surveillance places bugs only in safe houses indexed by elements of Q. Moreover, for each j<q(1) we have q(j)q(1), and thus kj=0, while kq(1)>0 (because the first bug is placed in q(1)).

Starting from o(0)=o, we shift all bugs located in I1,I2,,Iq(1)1 to Iq(1). Formally, we define o(1)=(o1(1),,om(1)) by

oj(1)={0,if j<q(1),h=1q(1)oh(0),if j=q(1),oj(0),otherwise. (5)

The total number of bugs is unchanged.

Feasibility.

We show that o(1) still yields a Surveillance System for . Let a be bug located in Ip with p<q(1). For any index j such that aΩj (i.e., IpIj), we show that Iq(1)Ij, which implies that a can be shifted to Iq(1).

Case I: 𝒋𝒒(𝟏).

Since I1Iq(1), by Fact 7, we obtain Iq(1)Ij.

Case II: 𝒋>𝒒(𝟏).

Since p<q(1)<j and IpIj, Fact 7, we obtain Iq(1)Ij.

Thus, a belongs to Ωj also after being shifted to Iq(1). Repeating this argument for all such bugs yields the solution o(1).

Claim 14-(a).

Since kj=oj(1)=0 for all j<q(1), Claim 14-(a) holds.

Claim 14-(b).

If S1=C1(0), there is nothing to prove and 𝒞(1)=𝒞(0)=𝒞.
If S1 does not appear in 𝒞(0), we simply set C1(1)=S1 and Cj(1)=Cj(0) for each j>1.
Otherwise, S1 appears in 𝒞(0) as Ct(0) for some t>1. We show that the signatures assigned to I1 and It can be swapped in 𝒞(0).

By signatures construction and (5), Ct(0)=S1Ω1; it then suffices to show that C1(0)Ωt.

We first show that Iq(1)It. Since Ct(0)=S1, each bug bCt(0) can listen to both I1 and It, and therefore is located in some interval Ip with pq(1) such that IpIt.

If tq(1), then 1tq(1) and, since I1Iq(1), Fact 7, we obtain Iq(1)It. Otherwise, if t>q(1), then using p<q(1)<t and IpIt, by Fact 7, we obtain Iq(1)It.

Since C1(0)Ω1, all bugs in C1(0) are now located in Iq(1). Because Iq(1)It, we conclude that C1(0)Ωt. Therefore, the swap is feasible, we set C1(1)=Ct(0)=S1, Ct(1)=C1(0) and Cj(1)=Cj(0) for each j{1,t} and Claim 14-(b) holds.

Inductive step 𝟏<𝒊𝒎.

Consider a Surveillance System satisfying Claim 14 for i1; let it be identified by the vector o(i1)=(o1(i1),,om(i1)) with associated list of signatures 𝒞(i1).

If q(i)=q(i1), we simply set o(i)=o(i1), moving no bug.

Otherwise, q(i)>q(i1). We first establish that

oq(i1)(i1)kq(i1). (6)

To see why, note that Algorithm Surveillance introduces a bug only when necessary: specifically, a bug placed at interval Iq(i1) must appear in one of the signatures S1,,Si1. By the inductive hypothesis, and 𝒞(i1) share the first i1 signatures; consequently, every bug counted in k1++kq(i1) must also be counted in o1(i1)++oq(i1)(i1). Moreover, by Claim 14-(a), kj=oj(i1) for all j<q(i1). Inequality (6) follows directly.

We now shift all the bugs located in intervals Iq(i1)+1,,Iq(i)1, together with oq(i1)(i1)kq(i1) bugs at Iq(i1), to Iq(i). Formally, we define o(i)=(o1(i),,om(i)) as follows:

oj(i)={oj(i1)if j<q(i1) or j>q(i),kj,if j=q(i1),0if q(i1)<j<q(i),oq(i1)(i1)kq(i1)+h=q(i1)+1q(i)oh(i1)if j=q(i). (7)

Clearly, the total number of bugs is preserved. We stress that after the shifts in (7), any bug located in an interval IjIq(i) will not be shifted anymore. Recalling that the bugs are numbered from 1 to =1mo(i) and ordered according to (2), this also implies that from now

ΣjΩj, for each ji. (8)

We show now that Claim 14 holds for o(i).

Feasibility: o(𝒊) yields a Surveillance System for 𝓘.

Let a be any bug originally located in an interval Ip, with q(i1)p<q(i) according to o(i1). Suppose a is one of the bugs that are shifted to Iq(i). We show that shifting a preserves the feasibility of the Surveillance System.

To this aim, consider any index j such that aΩj (i.e., IpIj).

Case 𝒋<𝒊.

By construction, the signatures S1,,Si1:

  • do not contain any bug located in intervals Ih with h>q(i1). Indeed, any interval in {I1,,Ii1} is disjoint from every interval in {Iq(i1)+1,,Im}; therefore, bugs located in Iq(i1)+1,,Im cannot listen to any interval among I1,,Ii1;

  • use at most kq(i1) bugs located in Iq(i1).

Since and 𝒞(i1) coincide on the first i1 signatures, we retain exactly kq(i1) bugs in Iq(i1) and shift all the bugs that are not contained in S1,,Si1. Summarizing, any shifted bug does not appear in any signature Cj(i1) with j<i.

Case 𝒊𝒋𝒒(𝒊).

Since IiIq(i) and ijq(i), by Fact 7, we obtain Iq(i)Ij. Hence, a remains in Ωj after the shift.

Case 𝒋>𝒒(𝒊).

Since p<q(i)<j and IpIj, by Fact 7, we obtain Iq(i)Ij. Again, a remains in Ωj after the shift.

Repeating this argument for all shifted bugs yields o(i).

Claim 14-(a).

If q(i)=q(i1), the claim follows immediately from the inductive hypothesis. Otherwise, Claim 14-(a) holds for all j<q(i1) by induction. Moreover, by (7) we have oq(i1)(i)=kq(i1) and oj(i)=kj=0 for q(i1)<j<q(i). Hence, Claim 14-(a) holds for i.

Claim 14-(b).

By the inductive hypothesis, S1=C1(i1),,Si1=Ci1(i1).

  1. 1)

    If Si=Ci(i1), there is nothing to prove and 𝒞(i)=𝒞(i1).

  2. 2)

    If Si does not appear in 𝒞(i1), we simply set Ci(i)=Si and Cj(i)=Cj(i1) for all ji.

  3. 3)

    Otherwise, Si=Ct(i1) for some t>i. by (8), we know that Ct(i1)=SiΣiΩi. Hence, we can again set Ci(i)=Ct(i1)=Si and Cj(i)=Cj(i1) for all j{i,t}. However, we need Ct(i).
    To this aim, denote by b the smallest bug in Ct(i1).

    1. 3.1)

      If there exists a signature S in which the smallest bug is b such that SΩt and S𝒞(i1), we assign Ct(i)=S.

    2. 3.2)

      Otherwise, a new bug b~ (hereafter, the clone of b) is located in the interval Iq(i). Let b be located in the interval I, since bCt(i1)=Si we know that IiI. Recalling that Iq(i) is rightmost interval intersecting Ii, we know that q(i). Moreover, since Ct(i1)=Si we have ItI. Hence we have ItIq(i) and we set Ct(i)=Ct(i1){b~}.
      We observe that b~ is located in Iq(i) and b is located in I with q(i). Hence, we may assume that bb~ and b is still the smallest bug in Ct(i).
      We also notice that for any t>i such that bCt, the interval It intersects the interval I containing b. Because q(i), the interval Iq(i) also intersects It. This implies that at any subsequent step i, we can still use the clone b~ located in Iq(i) to eventually construct a signature Ct(i); that is, Case 3.2) cannot occur again, and no bug cloning is required.

    If case 3.2) applied, we added a new bug b~ located in q(i), we have oq(i)(i)=oq(i)(i)+1. To maintain the identifiers of the bugs in increasing order according to the ordering (2), we update the bugs identifier and the signatures in 𝒞(i) consistently. We notice that since b~ is located in q(i), this update affects only the identifiers of the bugs located in intervals after q(i) and consequently does not affect any signature before Cj(i) with j<i.

Let k be the size of the optimal solution. Initially, all signatures contain only the k original bugs of the optimal solution. Moreover, we have already observed that, after cloning a bug b, any interval containing b will not require a new cloned bug, e.g., Case 3.2) occurs at most once for each original bug and consequently, the total number of clones is at most k.
In conclusion, when reaching o(m), we have kj=oj(m) for all j<q(m)=m, and 𝒞(m) coincide with . Since uses all and only the bugs described by k and o(m) contains at most k clones, we conclude that k yields a 2-approximate solution.

Time complexity.

The algorithm ComputeSignatures needs O(m3) time. The initialization of the variables (lines 1–4) takes O(m) time. Computing the neighborhoods requires O(m2) time. The computation of all sets Ωj, for j[m], also takes O(m2) time in total.
As observed above, to compute a signature Sj, since at most j1 signatures are excluded, it suffices to generate the first j signatures over Σj in lexicographic order and return the first one that is not excluded. The signatures over Σj can be generated by a straightforward algorithm that performs an iterative depth-first traversal with a preorder visit of the implicit lexicographic tree of subsets of Σj. Since the size of any signature is at most k<m (a trivial solution, placing one bug in each safe house, each tuned only to its own house, is always feasible), generating and checking a single signature requires O(m) time. Therefore, generating the first j signatures over Σj takes O(jm) time. Summing over all j[m], the total time spent generating signatures is O(m3). Hence, the total running time of ComputeSignatures is O(m3).

The time complexity of Algorithm Surveillance is O(m4). Indeed, the algorithm invokes ComputeSignatures a total of m+1 times, and the computation of h, performed at most m times, requires O(m2) time.

By using appropriate data structures for the generation and checking of signatures or by means of an amortized analysis, this time complexity can be reduced to O(m3). Moral of the story: in Cold War Berlin, as in algorithms, a small amount of redundancy along the timeline buys you certainty at only twice the cost.

4 Hardness

In section 2.3, we highlighted the strong connection between the Surveillance System problem and the Watching System problem when the input graph is an interval graph.

In this section, we show that if we slightly enlarge the class of input graphs by considering chordal graphs, the problem becomes NP-hard.

It is known that the Dominating Set (DS) problem is NP-hard even when restricted to chordal and bipartite graphs [4, 5]. Here, we prove that the Watching System (WS) problem remains NP-hard even when restricted to chordal and bipartite graphs, by means of a reduction from DS.

To this end, we consider the decision version of the WS problem, which asks whether there exists a watching system of the input graph of size at most k. Recall that, given a graph G=(V,E) and an integer k, the DS problem asks whether there exists a set DV such that |D|k and DN(v) for every vVD.

Theorem 15.

The Watching System problem remains NP-hard even on chordal and bipartite graphs.

Proof.

Let G=(V,E),k be an instance of DS. We construct a graph G from G as follows. For each vertex vV, we introduce three new vertices v1,v2,v3 and add edges connecting v1 to v, v2, and v3.

By construction, if G is chordal (respectively, bipartite), then G is also chordal (respectively, bipartite). Indeed, for each vertex vV, we attach a tree to v. If G is bipartite, attaching a tree to a single vertex preserves bipartiteness; applying this argument to every vertex of G implies that G is bipartite. Moreover, since the added gadgets are trees, no induced cycle of length greater than three is created. Therefore, if G is chordal, then G is chordal as well.

In order to complete the proof, we establish the following claim.

Claim 16.

For any integer k,

G=(V,E),k is a YES-instance of DS 

if and only if

G,k=k+2|V| is a YES-instance of WS.

Assume first that DV is a dominating set of G with |D|k. We show that

W={(v,NG[v])vD}{(v1,{v,v1,v3}),(v2,{v1,v2})vV}.

is a watching system for G.

By construction, |W|=|D|+2|V|. Moreover, at most one watcher is located in each vertex; hence, we identify a watcher with the vertex where it is placed.

We now show that the codes associated with the vertices of G are all nonempty and pairwise distinct. The codes are as follows:

CW(v1)={{v,v1,v2}if vD{v1,v2}otherwise,CW(v2)={v2},CW(v3)={v1},

and, for each vV,

CW(v)={v1}(NG[v]D).

Hence, every vertex of G has a nonempty code. Furthermore, all codes are pairwise distinct. In particular, for each vV:

  • CW(v)CW(v1), since v2CW(v1) but v2CW(v);

  • CW(v)CW(v3), since D is a dominating set and therefore NG[v]D.

Finally, for any two distinct vertices u,vV, the codes CW(u) and CW(v) are distinguished by u1 and v1, respectively.

Thus, W is a valid watching system for G of size |D|+2|V|k+2|V|.

Conversely, let W be a watching system for G with |W|k+2|V|. For each vertex vV, consider the gadget formed by v1,v2, and v3. At least two watchers must be placed in {v1,v2,v3} in order to distinguish v2 and v3.

Moreover, since two watchers located in v1 are sufficient to distinguish v1, v2, and v3, if three or more watchers are placed in {v1,v2,v3}, we can obtain an equivalent watching system by moving two watchers to v1 and relocating any remaining watchers to v. Hence, in the remainder of the proof, we may assume that each gadget hosts exactly two watchers, and consequently that at most k watchers are located in vertices of V.

Let DV be the set of vertices of V hosting a watcher. By the above argument, |D|k. We claim that D is a dominating set of G.

Suppose, for contradiction, that there exists a vertex vVD such that NG(v)D=. Since v is adjacent to v1 in G, and CW(v), the watchers placed in the gadget of v must distinguish the vertices v, v1, v2, and v3. This is impossible unless either vD or NG(v)D, contradicting the assumption. Therefore, D is a dominating set of G.

5 Conclusions

In this paper, we sent Agent X on a mission through the timelines of Cold War Berlin and, along the way, studied the Watching System problem on interval graphs. By translating safe houses into intervals and listening devices into watchers, we showed that the temporal structure of interval graphs can be exploited in a surprisingly effective way.

Our main result is a simple polynomial-time 2-approximation algorithm, built around a timeline deployment strategy: whenever the existing bugs cannot uniquely identify a newly activated safe house, one carefully placed extra device suffices. The algorithm is greedy, local, and easy to implement, yet its analysis reveals a subtle global invariant: each optimal bug may need to be duplicated at most once. In short, certainty along the timeline can be bought at twice the optimal cost.

Not all spy networks are so cooperative. We also proved that as soon as the setting is slightly generalized, to chordal or bipartite graphs, the problem becomes NP-hard. This sharply marks interval graphs as a rare safe zone where surveillance remains algorithmically manageable.

Several mysteries remain unsolved. Is the factor 2 approximation the best Agent X can hope for, or is an even more efficient deployment possible? Can similar timeline-based ideas be adapted to other geometric graph classes? We leave these questions for future investigations and future missions.

For now, the lesson is clear: when safe houses line up neatly on a timeline, a small amount of well-placed redundancy is enough to keep every secret uniquely identified.

References

  • [1] David Auger, Irène Charon, Olivier Hudry, and Antoine Lobstein. Watching systems in graphs: An extension of identifying codes. Discret. Appl. Math., 161(12):1674–1685, 2013. doi:10.1016/j.dam.2011.04.025.
  • [2] David Auger, Irène Charon, Olivier Hudry, and Antoine Lobstein. Maximum size of a minimum watching system and the graphs achieving the bound. Discret. Appl. Math., 164:20–33, 2014. doi:10.1016/j.dam.2012.08.028.
  • [3] David Auger and Iiro S. Honkala. Watching systems in the king grid. Graphs Comb., 29(3):333–347, 2013. doi:10.1007/s00373-011-1124-0.
  • [4] Alan A. Bertossi. Dominating sets for split and bipartite graphs. Inf. Process. Lett., 19(1):37–40, 1984. doi:10.1016/0020-0190(84)90126-1.
  • [5] Kellogg S. Booth and J. Howard Johnson. Dominating sets in chordal graphs. SIAM J. Comput., 11(1):191–199, 1982. doi:10.1137/0211015.
  • [6] Nicolas Bousquet, Aurélie Lagoutte, Zhentao Li, Aline Parreau, and Stéphan Thomassé. Identifying codes in hereditary classes of graphs and vc-dimension. SIAM J. Discret. Math., 29(4):2047–2064, 2015. doi:10.1137/14097879X.
  • [7] Gennaro Cordasco, Luisa Gargano, and Adele A. Rescigno. Watching systems with bounded probes. In Luca Moscardelli and Francesca Scozzari, editors, Proceedings of the 26th Italian Conference on Theoretical Computer Science, Pescara, Italy, September 10-12, 2025, volume 4039 of CEUR Workshop Proceedings, pages 3–15. CEUR-WS.org, 2025. URL: https://ceur-ws.org/Vol-4039/paper20.pdf.
  • [8] Gennaro Cordasco, Luisa Gargano, and Adele Anna Rescigno. Red-blue unshared dominators. In Proceedings of the 25th International Symposium on Fundamentals of Computation Theory (FCT 2025), pages 94–108, 2025.
  • [9] Florent Foucaud. Combinatorial and algorithmic aspects of identifying codes in graphs. PhD thesis, Université Sciences et Technologies - Bordeaux, 2012.
  • [10] Florent Foucaud, Michael A. Henning, Christian Löwenstein, and Thomas Sasse. Locating-dominating sets in twin-free graphs. Discret. Appl. Math., 200:52–58, 2016. doi:10.1016/j.dam.2015.06.038.
  • [11] Florent Foucaud, George B. Mertzios, Reza Naserasr, Aline Parreau, and Petru Valicov. Identification, location-domination and metric dimension on interval and permutation graphs. II. algorithms and complexity. Algorithmica, 78(3):914–944, 2017. doi:10.1007/s00453-016-0184-1.
  • [12] Florent Foucaud and Guillem Perarnau. Bounds for identifying codes in terms of degree parameters. Discrete Applied Mathematics, 232:99–114, 2017.
  • [13] Mehdi Ghorbani, Matthias Dehmer, Hossein Maimani, Saeid Maddah, Mohammad Roozbayani, and Frank Emmert-Streib. The watching system as a generalization of identifying code. Applied Mathematics and Computation, 380, 2020.
  • [14] Modjtaba Ghorbani and Sheyda Maddah. On the watching number of graphs using discharging procedure. J. Appl. Math. Comput., 67(1-2):507–518, 2021. doi:10.1007/s12190-020-01482-w.
  • [15] Mark G. Karpovsky, Krishnendu Chakrabarty, and Lev B. Levitin. On a new class of codes for identifying vertices in graphs. IEEE Trans. Inf. Theory, 44(2):599–611, 1998. doi:10.1109/18.661507.
  • [16] Antoine Lobstein. Watching systems, identifying, locating-dominating and discriminating codes in graphs: A bibliography. arXiv preprint arXiv:1004.2192, 2010.
  • [17] Maryam Roozbayani and Hamidreza Maimani. Identifying codes and watching systems in kneser graphs. Discret. Math. Algorithms Appl., 9(1):1750007:1–1750007:9, 2017. doi:10.1142/S1793830917500070.
  • [18] Suk Jai Seo and Peter J. Slater. Open neighborhood locating dominating sets. Australas. J Comb., 46:109–120, 2010. URL: http://ajc.maths.uq.edu.au/pdf/46/ajc_v46_p109.pdf.