1 Introduction

The Metric Dimension problem has been introduced in the 1970s independently by Slater [22] and by Harary and Melter [13]. Given a graph G and an integer k, Metric Dimension asks for a subset S of vertices of G of size at most k such that every vertex of G is uniquely determined by its distances to the vertices of S. Such a set S is called a resolving set, and a resolving set of minimum-cardinality is called a metric basis. The metric dimension of graphs finds application in various areas including network verification [2], chemistry [4], and robot navigation [18].

Metric Dimension is an entry of the celebrated book on intractability by Garey and Johnson [12] where the authors show that it is NP-complete. In fact Metric Dimension remains NP-complete in many restricted classes of graphs such as planar graphs [6], split, bipartite, co-bipartite graphs, and line graphs of bipartite graphs [9], interval graphs of diameter two [11], permutation graphs of diameter two [11], and in a subclass of unit disk graphs [15]. Furthermore Metric Dimension cannot be solved in subexponential-time unless 3-SAT can [1]. On the positive side, the problem is polynomial-time solvable on trees [13, 18, 22]. Diaz et al. [6] generalize this result to outerplanar graphs. Fernau et al. [10] give a polynomial-time algorithm on chain graphs. Epstein et al. [9] show that Metric Dimension (and even its vertex-weighted variant) can be solved in polynomial time on cographs and forests augmented by a constant number of edges. Hoffmann et al. [16] obtain a linear algorithm on cactus block graphs.

Hartung and Nichterlein [14] prove that Metric Dimension is W[2]-complete (parameterized by the size of the solution k) even on subcubic graphs. Therefore an FPT algorithm solving the problem is unlikely. However Foucaud et al. [11] give an FPT algorithm with respect to k on interval graphs. This result is later generalized by Belmonte et al. [3] who obtain an FPT algorithm with respect to \(\text {tl}+\Delta\) (where \(\text {tl}\) is the tree-length and \(\Delta\) is the maximum-degree of the input graph), implying one for parameter \(\text {tl}+k\). Indeed interval graphs, and even chordal graphs, have constant tree-length. Hartung and Nichterlein [14] presents an FPT algorithm parameterized by the vertex cover number, Eppstein [8], by the max leaf number, and Belmonte et al. [3], by the modular-width (a larger parameter than clique-width).

The complexity of Metric Dimension parameterized by treewidth is quite elusive. It is discussed [8] or raised as an open problem in several papers [3, 6]. On the one hand, it was not known, prior to our paper, if this problem is W[1]-hard. On the other hand, the complexity of Metric Dimension in graphs of treewidth at most two is still an open question.

1.1 Our Contribution

We settle the parameterized complexity of Metric Dimension with respect to treewidth. We show that this problem is W[1]-hard, and we rule out, under the Exponential Time Hypothesis (ETH), an algorithm running in \(f(\text {tw})|V(G)|^{o(\text {tw})}\), where G is the input graph, \(\text {tw}\) its treewidth, and f any computable function. Our reduction even shows that an algorithm in time \(f(\text {pw})|V(G)|^{o(\text {pw})}\) is unlikely on constant-degree graphs, for the larger parameter pathwidth \(\text {pw}\). This is in stark contrast with the FPT algorithm of Belmonte et al. [3] for the parameter \(\text {tl}+\Delta\) where \(\text {tl}\) is the tree-length and \(\Delta\) is the maximum-degree of the graph. We observe that this readily gives an FPT algorithm for \(\text {ctw}+\Delta\) where \(\text {ctw}\) is the connected treewidth, since \(\text {ctw}\geqslant \text {tl}\). This unravels an interesting behavior of Metric Dimension, at least on bounded-degree graphs: usual tree-decompositions are not enough for efficient solving. Instead one needs tree-decompositions with an additional guarantee that the vertices of a same bag are at a bounded distance from each other.

As our construction is quite technical, we chose to introduce an intermediate problem dubbed \(k\)-Multicolored Resolving Set in the reduction from \(k\)-Multicolored Independent Set to Metric Dimension. The first half of the reduction, from \(k\)-Multicolored Independent Set to \(k\)-Multicolored Resolving Set, follows a generic and standard recipe to design parameterized hardness with respect to treewidth. The main difficulty is to design an effective propagation gadget with a constant-size left-right cut. The second half brings some new local attachments to the produced graph, to bridge the gap between \(k\)-Multicolored Resolving Set and Metric Dimension. Along the way, we introduce a number of gadgets: edge, propagation, forced set, forced vertex. They are quite streamlined and effective. Therefore, we believe these building blocks may help in designing new reductions for Metric Dimension.

1.2 Organization of the Paper

In Sect. 2 we introduce the definitions, notations, and terminology used throughout the paper. In Sect. 3 we present the high-level ideas to establish our result. We define the \(k\)-Multicolored Resolving Set problem which serves as an intermediate step for our reduction. In Sect. 4 we design a parameterized reduction from the W[1]-complete \(k\)-Multicolored Independent Set to \(k\)-Multicolored Resolving Set parameterized by treewidth. In Sect. 5 we show how to transform the produced instances of \(k\)-Multicolored Resolving Set to Metric Dimension-instances (while maintaining bounded treewidth). In Sect. 6 we conclude with some open questions.

2 Preliminaries

We denote by [ij] the set of integers \(\{i,i+1,\ldots , j-1, j\}\), and by [i] the set of integers [1, i]. If \({\mathcal {X}}\) is a set of sets, we denote by \(\cup {\mathcal {X}}\) the union of them.

2.1 Graph Notations

All our graphs are undirected and simple (no multiple edge nor self-loop). We denote by V(G), respectively E(G), the set of vertices, respectively of edges, of the graph G. For \(S \subseteq V(G)\), we denote the open neighborhood (or simply neighborhood) of S by \(N_G(S)\), i.e., the set of neighbors of S deprived of S, and the closed neighborhood of S by \(N_G[S]\), i.e., the set \(N_G(S) \cup S\). For singletons, we simplify \(N_G(\{v\})\) into \(N_G(v)\), and \(N_G[\{v\}]\) into \(N_G[v]\). We denote by G[S] the subgraph of G induced by S, and \(G - S := G[V(G) {\setminus} S]\). For \(S \subseteq V(G)\) we denote by \(\overline{S}\) the complement \(V(G) {\setminus} S\). For \(A, B \subseteq V(G)\), E(AB) denotes the set of edges in E(G) with one endpoint in A and the other one in B.

The length of a path in an unweighted graph is simply the number of edges of the path. For two vertices \(u, v \in V(G)\), we denote by \(\text {dist}_G(u,v)\), the distance between u and v in G, that is the length of the shortest path between u and v. The diameter of a graph is the longest distance between a pair of its vertices. The diameter of a subset \(S \subseteq V(G)\), denoted by \(\text {diam}_G(S)\), is the longest distance between a pair of vertices in S. Note that the distance is taken in G, not in G[S]. In particular, when G is connected, \(\text {diam}_G(S)\) is finite for every S. A pendant vertex is a vertex with degree one. A vertex u is pendant to v if v is the only neighbor of u. Two distinct vertices uv such that \(N(u) = N(v)\) are called false twins, and true twins if \(N[u] = N[v]\). In particular, true twins are adjacent. In all the above notations with a subscript, we omit it whenever the graph is implicit from the context.

2.2 Treewidth, Pathwidth, Connected Treewidth, and Tree-Length

A tree-decomposition of a graph G, is a tree T whose nodes are labeled by subsets of V(G), called bags, such that for each vertex \(v \in V(G)\), the bags containing v induce a non-empty subtree of T, and for each edge \(e \in E(G)\), there is at least one bag containing both endpoints of e. A connected tree-decomposition further requires that each bag induces a connected subgraph in G. The width of a (connected) tree-decomposition is the size of its largest bag minus one. The treewidth (resp. connected treewidth) of a graph G is the minimum width of a tree-decomposition (resp. a connected tree-decomposition) of G. The length of a bag is the maximum distance in G between any pair of vertices in the bag. The length of a tree-decomposition is the maximum length of any bag. The tree-length of a graph G is the minimum length of a tree-decomposition of G. We denote the treewidth, connected treewidth, and tree-length of a graph by \(\text {tw}\), \(\text {ctw}\), and \(\text {tl}\) respectively. Since a connected graph on n vertices has diameter at most \(n-1\), it holds that \(\text {ctw}\geqslant \text {tl}\).

The pathwidth is the same as treewidth except the tree T is now required to be a path, and hence is called a path-decomposition. In particular pathwidth is always larger than treewidth. Later we will need to upper bound the pathwidth of our constructed graph. Since writing down a path-decomposition is a bit cumbersome, we will rely on the following characterization of pathwidth. Kirousis and Papadimitriou [19] show the equality between the interval thickness number, which is known to be pathwidth plus one, and the node searching number. Thus we will only need to show that the number of searchers required to win the following one-player game is bounded by a suitable function. We imagine the edges of a graph to be contaminated by a gas. The task is to move around a team of searchers, placed at the vertices, in order to clean all the edges. A move consists of removing a searcher from the graph, adding a searcher at an unoccupied vertex, or displacing a searcher from a vertex to any other vertex (not necessarily adjacent). An edge is cleaned when both its endpoints are occupied by a searcher. However after each move, all the cleaned edges admitting a free-of-searchers path from one of its endpoints to the endpoint of a contaminated edge are recontaminated. The node searching number is the minimum number of searchers required to win the game.

2.3 Parameterized Problems and Algorithms

Parameterized complexity aims to solve hard problems in time \(f(k)|{\mathcal {I}}|^{O(1)}\), where k is a parameter of the instance \({\mathcal {I}}\) which is hopefully (much) smaller than the total size of \({\mathcal {I}}\). More formally, a parameterized problem is a pair \((\Pi ,\kappa )\) where \(\Pi \subseteq L\) for some language \(L \subseteq \Sigma ^*\) over a finite alphabet \(\Sigma\) (e.g., the set of words, graphs, etc.), and \(\kappa\) is a mapping from L to \({\mathbb {N}}\). An element \({\mathcal {I}} \in L\) is called an instance (or input). The mapping \(\kappa\) associates each instance to an integer called parameter. An instance is said positive if \({\mathcal {I}} \in \Pi\), and a negative otherwise. We denote by \(|{\mathcal {I}}|\) the size of \({\mathcal {I}}\), that can be thought of as the length of the word \({\mathcal {I}}\). An FPT algorithm is an algorithm which solves a parameterized problem \((\Pi ,\kappa )\), i.e., decides whether or not an input \({\mathcal {I}} \in L\) is positive, in time \(f(\kappa ({\mathcal {I}}))|{\mathcal {I}}|^{O(1)}\) for some computable function f. We refer the interested reader to recent textbooks in parameterized algorithms and complexity [5, 7].

2.4 Exponential Time Hypothesis, FPT Reductions, and W[1]-Hardness

The Exponential Time Hypothesis (ETH) is a conjecture by Impagliazzo et al. [17] asserting that there is no \(2^{o(n)}\)-time algorithm for 3-SAT on instances with n variables. Lokshtanov et al. [20] survey conditional lower bounds under the ETH.

An FPT reduction from a parameterized problem \((\Pi \subseteq L,\kappa )\) to a parameterized problem \((\Pi ' \subseteq L',\kappa ')\) is a mapping \(\rho : L \mapsto L'\) such that for every \({\mathcal {I}} \in L\):

  1. (1)

    \({\mathcal {I}} \in \Pi \Leftrightarrow \rho ({\mathcal {I}}) \in \Pi '\),

  2. (2)

    \(|\rho ({\mathcal {I}})| \leqslant f(\kappa ({\mathcal {I}}))| {\mathcal {I}}|^{O(1)}\) for some computable function f, and

  3. (3)

    \(\kappa (\rho ({\mathcal {I}})) \leqslant g(\kappa ({\mathcal {I}}))\) for some computable function g.

We further require that for every \({\mathcal {I}}\), we can compute \(\rho ({\mathcal {I}})\) in FPT time \(h(\kappa ({\mathcal {I}}))| {\mathcal {I}}|^{O(1)}\) for some computable function h. Condition (1) makes \(\rho\) a valid reduction, condition (2) together with the further requirement on the time to compute \(\rho ({\mathcal {I}})\) make the mapping \(\rho\) FPT, and condition (3) controls that the new parameter \(\kappa (\rho ({\mathcal {I}}))\) is bounded by a function of the original parameter \(\kappa ({\mathcal {I}})\). One can therefore observe that using \(\rho\) in combination with an FPT algorithm solving \((\Pi ',\kappa ')\) yields an FPT procedure to solve the initial problem \((\Pi ,\kappa )\).

A standard use of an FPT reduction is to derive conditional lower bounds: if a problem \((\Pi ,\kappa )\) is thought not to admit an FPT algorithm, then an FPT reduction from \((\Pi ,\kappa )\) to \((\Pi ',\kappa ')\) indicates that \((\Pi ',\kappa ')\) is also unlikely to admit an FPT algorithm. We refer the reader to the textbooks [5, 7] for a formal definition of W[1]-hardness. For the purpose of this paper, we will just state that W[1]-hard are parameterized problems that are unlikely to be FPT, and that the following problem is W[1]-complete even when all the \(V_i\) have the same number of elements, say t (see for instance [21]).

figure a

Every parameterized problem that \(k\)-Multicolored Independent Set FPT-reduces to is W[1]-hard. Our paper is thus devoted to designing an FPT reduction from \(k\)-Multicolored Independent Set to Metric Dimension parameterized by \(\text {tw}\). Let us observe that the ETH implies that one (equivalently, every) W[1]-hard problem is not in the class of problems solvable in FPT time (FPT\(\ne\)W[1]). Thus if we admit that there is no subexponential algorithm solving 3-SAT, then \(k\)-Multicolored Independent Set is not solvable in time \(f(k)|V(G)|^{O(1)}\). Actually under this stronger assumption, \(k\)-Multicolored Independent Set is not solvable in time \(f(k)|V(G)|^{o(k)}\). A concise proof of that fact can be found in the survey on the consequences of ETH [20].

2.5 Metric Dimension, Resolved Pairs, Distinguished Vertices

A pair of vertices \(\{u,v\} \subseteq V(G)\) is said to be resolved by a set S if there is a vertex \(w \in S\) such that \(\text {dist}(w,u) \ne \text {dist}(w,v)\). A vertex u is said to be distinguished by a set S if for any \(w \in V(G) {\setminus} \{u\}\), there is a vertex \(v \in S\) such that \(\text {dist}(v,u) \ne \text {dist}(v,w)\). A resolving set of a graph G is a set \(S \subseteq V(G)\) such that every two distinct vertices \(u, v \in V(G)\) are resolved by S. Equivalently, a resolving set is a set S such that every vertex of G is distinguished by S. Then Metric Dimension asks for a resolving set of size at most some threshold k. Note that a resolving set of minimum size is sometimes called a metric basis for G.

figure b

Here we anticipate on the fact that we will mainly consider Metric Dimension parameterized by treewidth. Henceforth we sometimes use the notation \(\Pi /\text {tw}\) to emphasize that \(\Pi\) is not parameterized by the natural parameter (size of the resolving set) but by the treewidth of the input graph.

3 Outline of the W[1]-Hardness Proof of Metric Dimension/\(\text {tw}\)

We will show the following.

Theorem 3.1

Unless the ETH fails, there is no computable function f such that Metric Dimension can be solved in time \(f(\text {pw})n^{o(\text {pw})}\) on constant-degree n-vertex graphs.

We first prove that the following variant of Metric Dimension is W[1]-hard.

figure c

In words, in this variant the resolving set is made by picking exactly one vertex in each set of \({\mathcal {X}}\), and not all the pairs should be resolved but only the ones in a prescribed set \({\mathcal {P}}\). We call critical pair a pair of \({\mathcal {P}}\). In the context of \(k\)-Multicolored Resolving Set, we call legal set a set which satisfies the former condition, and resolving set a set which satisfies the latter. Thus a solution for \(k\)-Multicolored Resolving Set is a legal resolving set.

The reduction from \(k\)-Multicolored Independent Set starts with a well-established trick to show parameterized hardness by treewidth. We create m “empty copies” of the \(k\)-MIS-instance \((G,k,(V_1,\ldots\), \(V_k))\), where \(m := |E(G)|\) and \(t := |V_i|\). We force exactly one vertex in each color class of each copy to be in the resolving set, using the set \({\mathcal {X}}\). In each copy, we introduce an edge gadget for a single (distinct) edge of G. Encoding an edge of \(k\)-MIS in the \(k\)-MRS-instance is fairly simple: we build a pair (of \({\mathcal {P}}\)) which is resolved by every choice but the one selecting both its endpoints in the resolving set. We now need to force a consistent choice of the vertex chosen in \(V_i\) over all the copies. We thus design a propagation gadget. A crucial property of the propagation gadget, for the pathwidth of the constructed graph to be bounded, is that it admits a cut of size O(k) disconnecting one copy from the other. Encoding a choice in \(V_i\) in the distances to four special vertices, called gates, we manage to build such a gadget with constant-size “left-right” separator per color class. This works by introducing t pairs (of \({\mathcal {P}}\)) which are resolved by the south-west and north-east gates but not by the south-east and north-west ones. Then we link the vertices of a copy of \(V_i\) in a way that the higher their index, the more pairs they resolve in the propagation gadget to their left, and the fewer pairs they resolve in the propagation gadget to their right.

We then turn to the actual Metric Dimension problem. We design a gadget which simulates requirement (i) by forcing a vertex of a specific set X in the resolving set. This works by introducing two pairs that are only resolved by vertices of X. We attach this new gadget, called forcing set gadget, to all the k color classes of the m copies. Finally we have to make sure that a candidate solution resolves all the pairs, and not only the ones prescribed by \({\mathcal {P}}\). For that we attach two adjacent “pendant” vertices to strategically chosen vertices. One of these two vertices have to be in the resolving set since they are true twins, hence not resolved by any other vertex. Then everything is as if the unique common neighbor v of the true twins was added to the resolving set. Therefore we can perform this operation as long as v does not resolve any of the pairs of \({\mathcal {P}}\).

To facilitate the task of the reader, henceforth we stick to the following conventions:

  • Index \(i \in [k]\) ranges over the k rows of the k -MRS/MD-instance or color classes of \(k\)-MIS.

  • Index \(j \in [m]\) ranges over the m columns of the k -MRS/MD-instance or edges of \(k\)-MIS.

  • Index \(\gamma \in [t]\), ranges over the t vertices of a color class.

We invite the reader to look up Table 1 when in doubt about a notation/symbol relative to the construction.

Table 1 Glossary of the construction

4 Parameterized Hardness of \(k\)-Multicolored Resolving Set/\(\text {tw}\)

In this section, we give an FPT reduction from the W[1]-complete \(k\)-Multicolored Independent Set to \(k\)-Multicolored Resolving Set parameterized by treewidth. More precisely, given a k -Multicolored Independent Set-instance \((G,k,(V_1, \ldots ,V_k))\) we produce in polynomial-time an equivalent \(k\)-Multicolored Resolving Set-instance \((G',k',{\mathcal {X}}, {\mathcal {P}})\) where \(G'\) has pathwidth (hence treewidth) O(k).

4.1 Construction

Let \((G,k,(V_1, \ldots ,V_k))\) be an instance of k -Multicolored Independent Set where \((V_1, \ldots , V_k)\) is a partition of V(G) and \(V_i := \{v_{i,\gamma }\,|\,1 \leqslant \gamma \leqslant t\}\). We arbitrarily number \(e_1, \ldots , e_j, \ldots , e_m\) the m edges of G.

4.1.1 Overall Picture

We start with a high-level description of the \(k\)-MRS-instance \((G',k',{\mathcal {X}},{\mathcal {P}})\). For each color class \(V_i\), we introduce m copies \(V_i^1, \ldots , V_i^j, \ldots , V_i^m\) of a selector gadget to \(G'\). Each set \(V_i^j\) is added to \({\mathcal {X}}\), so a solution has to pick exactly one vertex within each selector gadget. One can imagine the vertex-sets \(V_i^1, \ldots , V_i^m\) to be aligned on the i-th row, with \(V_i^j\) occupying the j-th column (see Fig. 1). Each \(V_i^j\) has t vertices denoted by \(v^j_{i,1}, v^j_{i,2}, \ldots , v^j_{i,t}\), where each \(v^j_{i,\gamma }\) “corresponds” to \(v_{i,\gamma } \in V_i\). We make \(v^j_{i,1}v^j_{i,2} \ldots v^j_{i,t}\) a path with \(t-1\) edges.

For each edge \(e_j \in E(G)\), we insert an edge gadget \({\mathcal {G}}(e_j)\) containing a pair of vertices \(\{c_j,c_j'\}\) that we add to \({\mathcal {P}}\). Gadget \({\mathcal {G}}(e_j)\) is attached to \(V_i^j\) and \(V_{i'}^j\), where \(e_j \in E(V_i,V_{i'})\). The edge gadget is designed in a way that the only legal sets that do not resolve \(\{c_j,c_j'\}\) are the ones that precisely pick \(v^j_{i,\gamma } \in V_i^j\) and \(v^j_{i',\gamma '} \in V_{i'}^j\) such that \(e_j = v_{i,\gamma }v_{i',\gamma '}\). We add a propagation gadget \(P_i^{j,j+1}\) between two consecutive copies \(V_i^j\) and \(V_i^{j+1}\), where the indices in the superscript are taken modulo m. The role of the propagation gadget is to ensure that the choices in each \(V_i^j\) (\(j \in [m]\)) corresponds to the same vertex in \(V_i\).

Fig. 1
figure 1

The overall picture with \(k=3\) color classes, \(t=5\) vertices per color class, \(m=6\) edges, \(e_1 = v_{1,3}v_{2,4}\), \(e_2 =v_{1,4}v_{2,1}\), \(e_3 = v_{1,5}v_{3,1}\), etc. The dashed lines on the left and right symbolize that the construction is cylindrical (Color figure online)

The intuitive idea of the reduction is the following. We say that a vertex of \(G'\) is selected if it is put in the resolving set of \(G'\), a tentative solution. The propagation gadget \(P_i^{j,j+1}\) ensures a consistent choice among the m copies \(V_i^1, \ldots , V_i^m\). The edge gadget ensures that the selected vertices of \(G'\) correspond to an independent set in the original graph G. If both the endpoints of an edge \(e_j\) are selected, then the pair \(\{c_j,c'_j\}\) is not resolved.

We now detail the construction.

4.1.2 Selector Gadget

For each \(i \in [k]\) and \(j \in [m]\), we add to \(G'\) a path on \(t-1\) edges \(v^j_{i,1}, v^j_{i,2}, \ldots , v^j_{i,t}\), and denote this set of vertices by \(V_i^j\). Each \(v^j_{i,\gamma }\) corresponds to \(v_{i,\gamma } \in V_i\). We call j-th column the set \(\bigcup _{i \in [k]} V_i^j\), and i-th row, the set \(\bigcup _{j \in [m]} V_i^j\). We set \({\mathcal {X}} := \{V_i^j\}_{i \in [k], j \in [m]}\). By definition of \(k\)-Multicolored Resolving Set, a solution S has to satisfy that for every \(i \in [k], j \in [m]\), \(|S \cap V_i^j| =1\). We call legal set a set S of size \(k' = {\mathrm{km}}\) that satisfies this property. We call consistent set a legal set S which takes the “same” vertex in each row, that is, for every \(i \in [k]\), for every pair \((v^j_{i,\gamma },v^{j'}_{i,\gamma '}) \in (S \cap V_i^j) \times (S \cap V_i^{j'})\), then \(\gamma = \gamma '\).

4.1.3 Edge Gadget

For each edge \(e_j=v_{i,\gamma } v_{i',\gamma '} \in E(G)\), we add an edge gadget \({\mathcal {G}}(e_j)\) in the j-th column of \(G'\). \({\mathcal {G}}(e_j)\) consists of a path on three vertices: \(c_jg_jc'_j\). The pair \(\{c_j,c'_j\}\) is added to the list of critical pairs \({\mathcal {P}}\). We link both \(v_{i,\gamma }^j\) and \(v_{i',\gamma '}^j\) to \(g_j\) by a private pathFootnote 1 of length \(t+2\). We link the at least two and at most four vertices \(v_{i,\gamma -1}^j, v_{i,\gamma +1}^j, v_{i',\gamma '-1}^j, v_{i',\gamma '+1}^j\) (whenever they exist) to \(c_j\) by a private path of length \(t+2\). This defines at most six paths from \(V_i^j \cup V_{i'}^j\) to \({\mathcal {G}}(e_j)\). Let us denote by \(W_j\) the at most six endpoints of these paths in \(V_i^j \cup V_{i'}^j\). For each \(v \in W_j\), we denote by P(vj) the path from v to \({\mathcal {G}}(e_j)\). We set \(E_i^j := \bigcup _{v \in W_j \cap V_i^j} P(v,j)\) and \(E_{i'}^j := \bigcup _{v \in W_j \cap V_{i'}^j} P(v,j)\). We denote by \(X_j\) the set of the at most six neighbors of \(W_j\) on the paths to \({\mathcal {G}}(e_j)\). Henceforth we may refer to the vertices in some \(X_j\) as the cyan vertices. Individually we denote by \(e_{i,\gamma }^j\) the cyan vertex neighbor of \(v_{i,\gamma }^j\) in \(P(v_{i,\gamma }^j,j)\). We observe that for fixed i and j, \(e_{i,\gamma }^j\) exists for at most three values of \(\gamma\). We add an edge between two cyan vertices if their respective neighbors in \(V_i^j\) are also linked by an edge (or equivalently, if they have consecutive “indices \(\gamma\)”). These extra edges are useless in the \(k\)-MRS-instance, but will turn out useful in the MD-instance. See Fig. 2 for an illustration of the edge gadget.

Fig. 2
figure 2

The edge gadget \({\mathcal {G}}(e_4)\) with \(e_4 = v_{1,5}v_{3,3}\). Weighted edges are short-hands for subdivisions of the corresponding length. The edges between the cyan vertices will not be useful for the \(k\)-MRS-instance, but will later simplify the construction of the MD-instance (Color figure online)

The rest of the construction will preserve that for every \(v \in (V_i^j \cup V_{i'}^j) {\setminus} \{v_{i,\gamma }^j, v_{i',\gamma '}^j\}\), \(\text {dist}(v,c'_j)=\text {dist}(v,c_j)+2\), and for each \(v \in \{v_{i,\gamma }^j, v_{i',\gamma '}^j\}\), \(\text {dist}(v,c_j) =\text {dist}(v,g_j)+1 = \text {dist}(v,c'_j)\). In other words, the only two vertices of \(V_i^j \cup V_{i'}^j\) not resolving the critical pair \(\{c_j,c'_j\}\) are \(v_{i,\gamma }^j\) and \(v_{i',\gamma '}^j\), corresponding to the endpoints of \(e_j\).

4.1.4 Propagation Gadget

Between each pair \((V_i^j,V_i^{j+1})\), where \(j+1\) is taken modulo m, we insert an identical copy of the propagation gadget, and we denote it by \(P_i^{j,j+1}\). It ensures that if the vertex \(v_{i,\gamma }^j\) is in a legal resolving set S, then the vertex of \(S \cap V_i^{j+1}\) should be some \(v_{i,\gamma '}^{j+1}\) with \(\gamma \leqslant \gamma '\). The cylindricity of the construction and the fact that exactly one vertex of \(V_i^j\) is selected, will therefore impose that the set S is consistent.

\(P_{i,}^{j,j+1}\) comprises four vertices \(\text {sw}^{j}_{i}\), \(\text {se}^{j}_{i}\), \(\text {nw}^{j}_{i}\), \(\text {ne}^{j}_{i}\), called gates, and a set \(A_i^j\) of 2t vertices \(a_{i,1}^j, \ldots\), \(a_{i,t}^j, \alpha _{i,1}^j, \ldots , \alpha _{i,t}^j\). We make both \(a_{i,1}^ja_{i,2}^j \ldots a_{i,t}^j\) and \(\alpha _{i,1}^j\alpha _{i,2}^j \ldots \alpha _{i,t}^j\) a path with \(t-1\) edges. For each \(\gamma \in [t]\), we add the pair \(\{a_{i,\gamma }^j,\alpha _{i,\gamma }^j\}\) to the set of critical pairs \({\mathcal {P}}\). Removing the gates disconnects \(A_i^j\) from the rest of the graph.

We now describe how we link the gates to \(V_i^j\), \(V_i^{j+1}\), and \(A_i^j\). We link \(v_{i,1}^j\) (the “top” vertex of \(V_i^j\)) to \(\text {sw}^{j}_{i}\) and \(v_{i,t}^j\) (the “bottom” vertex of \(V_i^j\)) to \(\text {nw}^{j}_{i}\) both by a path of length 2. We also link \(v_{i,1}^{j+1}\) to \(\text {se}^{j}_{i}\) by a path of length 3, and \(v_{i,t}^{j+1}\) to \(\text {ne}^{j}_{i}\) by a path of length 2. Then we make \(\text {nw}^{j}_{i}\) adjacent to \(a_{i,1}^j\) and \(\alpha _{i,1}^j\), while we make \(\text {ne}^{j}_{i}\) adjacent to \(\alpha _{i,1}^j\) only. We make \(\text {se}^{j}_{i}\) adjacent to \(a_{i,t}^j\) and \(\alpha _{i,t}^j\), while we make \(\text {sw}^{j}_{i}\) adjacent to \(a_{i,t}^j\) only. Finally, we add an edge between \(\text {ne}^{j}_{i}\) and \(\text {nw}^{j}_{i}\), and between \(\text {sw}^{j}_{i}\) and \(\text {se}^{j}_{i}\). See Fig. 3 for an illustration of the propagation gadget \(P_i^{j,j+1}\) with \(t=5\).

Fig. 3
figure 3

The propagation gadget \(P_i^{j,j+1}\). The critical pairs \(\{a_{i,\gamma }^j, \alpha _{i,\gamma }^j\}\) are surrounded by thin dashed lines. The blue (resp. red) integer on a vertex of \(A_i^j\) is its distance to the blue (resp. red) vertex in \(V_i^j\) (resp. \(V_i^{j+1}\)). Note that the blue vertex distinguishes the critical pairs below it, while the red vertex distinguishes critical pairs at its level or above (Color figure online)

Let us motivate the gadget \(P_i^{j,j+1}\). One can observe that the gates \(\text {ne}^{j}_{i}\) and \(\text {sw}^{j}_{i}\) resolve the critical pairs of the propagation gadget, while the gates \(\text {nw}^{j}_{i}\) and \(\text {se}^{j}_{i}\) do not. Consider that the vertex added to the resolving set in \(V_i^j\) is \(v_{i,\gamma }^j\). Its shortest paths to critical pairs below it (that is, with index \(\gamma ' > \gamma\)) go through the gate \(\text {sw}^{j}_{i}\), whereas its shortest paths to critical pairs at its level or above (that is, with index \(\gamma ' \leqslant \gamma\)) go through the gate \(\text {nw}^{j}_{i}\). Thus \(v_{i,\gamma }^j\) only resolves the critical pairs \(\{a_{i,\gamma '}^j,\alpha _{i,\gamma '}\}\) with \(\gamma ' > \gamma\). On the contrary, the vertex of the resolving set in \(V_i^{j+1}\) only resolves the critical pairs \(\{a_{i,\gamma '}^j,\alpha _{i, \gamma '}^j\}\) at its level or above. This will force that its level is \(\gamma\) or below. Hence the vertices of the resolving in \(V_i^j\) and \(V_i^{j+1}\) should be such that \(\gamma ' \geqslant \gamma\). Since there is also a propagation gadget between \(V_i^m\) and \(V_i^1\), this circular chain of inequalities forces a global equality.

4.1.5 Wrapping Up

We put the pieces together as described in the previous subsections. At this point, it is convenient to give names to the neighbors of \(V_i^j\) in the propagation gadgets \(P_i^{j-1,j}\) and \(P_i^{j,j+1}\). We may refer to them as blue vertices (as they appear in Fig. 4). We denote by \(\text {tl}^{j}_{i}\) the neighbor of \(v_{i,1}^j\) in \(P_i^{j-1,j}\), \(\text {tr}^{j}_{i}\), the neighbor of \(v_{i,1}^j\) in \(P_i^{j,j+1}\), \(\text {bl}^{j}_{i}\), the neighbor of \(v_{i,t}^j\) in \(P_i^{j-1,j}\), and \(\text {br}^{j}_{i}\), the neighbor of \(v_{i,t}^j\) in \(P_i^{j,j+1}\). We add the following edges and paths.

For any pair ij such that \(e_j\) has an endpoint in \(V_i\), the vertices \(\text {tl}^{j}_{i}, \text {tr}^{j}_{i}, \text {bl}^{j}_{i}, \text {br}^{j}_{i}\) are linked to \(g_j\) by a private path of length the distance of their unique neighbor in \(V_i^j\) to \(c_j\). We add an edge between \(\text {se}_i^j\) and \(\text {se}_i^{j+1}\), and between \(\text {nw}_i^j\) and \(\text {nw}_i^{j+1}\) (where \(j+1\) is modulo m). Finally, for every \(e_j \in E(V_i,V_{i'})\), we add four paths between \(\text {se}_i^j, \text {se}_{i'}^j, \text {nw}_i^j, \text {nw}_{i'}^j\) and \(g_j \in {\mathcal {G}}(e_j)\). More precisely, for each \(i'' \in \{i,i'\}\), we add a path from \(g_j\) to \(\text {se}_{i''}^j\) of length \(\text {dist}(g_j,\text {sw}_{i''}^j)-4\), and a path from \(g_j\) to \(\text {nw}_{i''}^j\) of length \(\text {dist}(g_j,\text {nw}_{i''}^j)-4\). These distances are taken in the graph before we introduced the new paths, and one can observe that the length of these paths is at least t. This finishes the construction.

We recall that, by a slight abuse of language, a resolving set in the context of \(k\)-Multicolored Resolving Set is a set which resolves all the critical pairs of \({\mathcal {P}}\). In particular, it is not necessarily a resolving set in the sense of Metric Dimension. With that terminology, a solution for \(k\)-Multicolored Resolving Set is a legal resolving set.

4.2 Correctness of the Reduction

We now check that the reduction is correct. We start with the following technical lemma. If a set X contains a pair that no vertex of N(X) (that is \(N[X] {\setminus} X\)) resolves, then no vertex outside X can distinguish the pair.

Lemma 4.1

Let X be a subset of vertices, and \(a, b \in X\) be two distinct vertices. If for every vertex \(v \in N(X)\), \(\text {dist}(v,a) =\text {dist}(v,b)\), then for every vertex \(v \notin X\), \(\text {dist}(v,a) =\text {dist}(v,b)\).

Proof

Let v be a vertex outside of X. We further assume that v is not in N(X), otherwise we can already conclude that it does not distinguish \(\{a,b\}\). A shortest path from v to a, has to go through N(X). Let \(w_a\) be the first vertex of N(X) met in this shortest path from v to a. Similarly, let \(w_b\) be the first vertex of N(X) met in a shortest path from v to b. Since \(w_a, w_b \in N(X)\), they satisfy \(\text {dist}(w_a,a) = \text {dist}(w_a,b)\) and \(\text {dist}(w_b,a) = \text {dist}(w_b,b)\). Then, \(\text {dist}(v,a) \leqslant \text {dist}(v,w_b)+\text {dist}(w_b,a) = \text {dist}(v,w_b) + \text {dist}(w_b,b) =\text {dist}(v,b)\), and \(\text {dist}(v,b) \leqslant \text {dist}(v,w_a)+\text {dist}(w_a,b) =\text {dist}(v,w_a) + \text {dist}(w_a,a) = \text {dist}(v,a)\). Thus \(\text {dist}(v,a) =\text {dist}(v,b)\). \(\square\)

We use the previous lemma to show that every vertex of a \(V_i^j\) only resolves critical pairs in gadgets it is attached to. This will be useful in the two subsequent lemmas.

Lemma 4.2

For any \(i \in [k]\), \(j \in [m]\), and \(v \in V_i^j\), v does not resolve any critical pair outside of \(P_i^{j-1,j}\), \(P_i^{j,j+1}\) (where indices in the superscript are taken modulo m), and \(\{c_j,c'_j\}\). Furthermore, if \(e_j \in E(G)\) has no endpoint in \(V_i \subseteq V(G)\), then v does not resolve \(\{c_j,c'_j\}\).

Proof

We first show that \(v \in V_i^j\) does not resolve any critical pair in propagation gadgets that are not \(P_i^{j-1,j}\) and \(P_i^{j,j+1}\). Let \(\{a_{i',\gamma }^{j'},\alpha _{i',\gamma }^{j'}\}\) be a critical pair in a propagation gadget different from \(P_i^{j-1,j}\) and \(P_i^{j,j+1}\). Let X be the connected component containing \(P_{i'}^{j',j'+1}\) of \(G' - (\{\text {nw}_{i'}^{j'-1}, \text {se}_{i'}^{j'-1}, \text {nw}_{i'}^{j'+1}, \text {se}_{i'}^{j'+1}\} \cup C_e)\), where \(C_e\) comprises \(\{c_j',g_j'\}\) if \(e_{j'}\) has an endpoint in \(V_{i'}\) and \(\{c_{j'+1},g_{j'+1}\}\) if \(e_{j'+1}\) has an endpoint in \(V_{i'}\). Thus \(C_e\) has size 0, 2, or 4. One can observe that \(N(X) = \{\text {nw}_{i'}^{j'-1}, \text {se}_{i'}^{j'-1}, \text {nw}_{i'}^{j'+1}, \text {se}_{i'}^{j'+1}\} \cup C_e\), that \(V_{i'}^{j'} \cup V_{i'}^{j'+1} \subseteq X\), and that no “other \(V_i^j\)” intersects X. In particular \(V_i^j\) is fully contained in \(G - X\). We now check that no vertex of N(X) resolves the pair \(\{a_{i',\gamma }^{j'},\alpha _{i',\gamma }^{j'}\}\) (which is inside X).

For each \(u \in \{\text {nw}_{i'}^{j'-1},\text {nw}_{i'}^{j'+1}\}\), it holds that \(\text {dist}(u,a_{i',\gamma }^{j'}) = \gamma +1 =\text {dist}(u,a_{i',\gamma }^{j'})\) (the shortest paths go through \(\text {nw}_{i'}^{j'}\)), while for each \(u \in \{\text {se}_{i'}^{j'-1}, \text {se}_{i'}^{j'+1}\}\), it holds that \(\text {dist}(u,a_{i',\gamma }^{j'}) = t - \gamma + 2 =\text {dist}(u,a_{i',\gamma }^{j'})\) (the shortest paths go through \(\text {se}_{i'}^{j'}\)). If they are part of \(C_e\), \(g_{j'}\) and \(c_{j'}\) also do not resolve \(\{a_{i',\gamma }^{j'},\alpha _{i', \gamma }^{j'}\}\), the shortest paths going through the gates \(\text {nw}_{i'}^{j'}\) or \(\text {se}_{i'}^{j'}\), and respectively \(g_j\) and then the gates \(\text {nw}_{i'}^{j'}\) or \(\text {se}_{i'}^{j'}\). For the same reason, \(g_{j'+1}\) and \(c_{j'+1}\) do not resolve \(\{a_{i',\gamma }^{j'},\alpha _{i', \gamma }^{j'}\}\). Then we conclude by Lemma 4.1 that no vertex of \(V_i^j\) (in particular v) resolves \(\{a_{i',\gamma }^{j'},\alpha _{i',\gamma }^{j'}\}\), or any critical pair in \(P_{i'}^{j'}\).

Let us now show that the pair \(\{c_j,c'_j\}\) is not resolved by any vertex of \(\cup {\mathcal {X}} {\setminus} (V_{i'}^j \cup V_{i''}^j)\) such that \(e_j \in E(V_{i'},V_{i''})\). Let \(Y := \{\text {tl}_{i'}^j, \text {tr}_{i'}^j, \text {bl}_{i'}^j, \text {br}_{i'}^j, \text {tl}_{i''}^j, \text {tr}_{i''}^j, \text {bl}_{i''}^j, \text {br}_{i''}^j, \text {nw}_{i'}^j, \text {se}_{i'}^j, \text {nw}_{i''}^j, \text {se}_{i''}^j\}\), and X be the connected component containing \(g_j\) in \(G' - Y\). Again one can observe that \(N(X) = Y\), X contains \(V_{i'}^j \cup V_{i''}^j\) but does not intersect any “other \(V_i^j\)”. We therefore show that no vertex of Y resolves \(\{c_j,c'_j\}\), and conclude with Lemma 4.1. All the vertices of Y have a private path to \(g_j\) whose length is such that they have a shortest path to \(c_j\) going through \(g_j\). Therefore \(\forall u \in Y\), \(\text {dist}(u,c_j) = \text {dist}(u,g_j)+1 = \text {dist}(u,c'_j)\). \(\square\)

The two following lemmas show the equivalences relative to the expected use of the edge and propagation gadgets. They will be useful in Sects. 4.2.1 and 4.2.2.

Lemma 4.3

A legal set S resolves the critical pair \(\{c_j,c'_j\}\) with \(e_j = v_{i,\gamma }v_{i',\gamma '}\) if and only if the vertex \(v_{i,\gamma _i}^j\) in \(V_i^j \cap S\) and the vertex \(v_{i',\gamma _{i'}}^j\) in \(V_{i'}^j \cap S\) satisfy \((\gamma ,\gamma ') \ne (\gamma _i,\gamma _{i'})\).

Proof

By Lemma 4.2, no vertex of \(S {\setminus} \{v_{i,\gamma _i}^j,v_{i',\gamma _{i'}}^j\}\) resolves \(\{c_j,c'_j\}\). By construction of \(G'\), \(v_{i,\gamma }^j\) (resp. \(v_{i',\gamma '}^j\)) is the only vertex of \(V_i^j\) (resp. \(V_{i'}^j\)) that does not resolve \(\{c_j,c'_j\}\). Indeed the shortest paths of \(v_{i,\gamma ''}^j\), for \(\gamma '' \geqslant \gamma +1\), to \(\{c_j,c'_j\}\) go through \(v_{i,\gamma +1}^j\) which resolves the pair. Note that a shortest path between \(V_i^j\) and \(V_{i'}^j\) has length at least \(2t+4\), so a shortest path from \(v_{i,\gamma ''}^j\) to \(\{c_j,c'_j\}\) cannot go through \(V_{i'}^j\). Similarly the shortest paths of \(v_{i,\gamma ''}^j\), for \(\gamma '' \leqslant \gamma -1\), to \(\{c_j,c'_j\}\) go through \(v_{i,\gamma -1}^j\) which also resolves the pair. Thus only \(v_{i,\gamma }^j\) (resp. \(v_{i',\gamma '}^j\)), whose shortest paths to \(\{c_j,c'_j\}\) go via \(g_j\), does not resolve this pair among \(V_i^j\) (resp. \(V_{i'}^j\)). Hence, the critical pair \(\{c_j,c'_j\}\) is not resolved by S if and only if \(v_{i,\gamma _i}^j = v_{i,\gamma }^j\) and \(v_{i',\gamma _{i'}}^j = v_{i',\gamma '}^j\). \(\square\)

Lemma 4.4

A legal set S resolves all the critical pairs of \(P_i^{j,j+1}\) if and only if the vertex \(v_{i,\gamma }^j\) in \(V_i^j \cap S\) and the vertex \(v_{i,\gamma '}^{j+1}\) in \(V_i^{j+1} \cap S\) satisfy \(\gamma \leqslant \gamma '\).

Proof

By Lemma 4.2, no vertex of \(S {\setminus} \{v_{i,\gamma }^j,v_{i,\gamma '}^{j+1}\}\) resolves a critical pair of \(P_i^{j,j+1}\). Let us show that the critical pairs that \(v_{i,\gamma }^j\) resolves in \(A_i^j\) are exactly the pairs \(\{a_{i,z}^j,\alpha _{i,z}^j\}\) with \(z > \gamma\). For any \(z \in [t]\), it holds that \(\text {dist}(v_{i,\gamma }^j,a_{i,z}^j) =\min (t+2+z-\gamma ,t+2+\gamma -z) = t+2+\min (z-\gamma ,\gamma -z)\), and \(\text {dist}(v_{i,\gamma }^j,\alpha _{i,z}^j) =\min (t+2+z-\gamma ,t+3 +\gamma -z) = t+2+\min (z-\gamma ,\gamma -z+1)\). So if \(z > \gamma\), \(\text {dist}(v_{i,\gamma }^j,a_{i,z}^j) = t + 2 + \gamma - z \ne t + 2 +\gamma - z + 1 = \text {dist}(v_{i,\gamma }^j,\alpha _{i,z}^j)\). Whereas if \(z \leqslant \gamma\), \(\text {dist}(v_{i,\gamma }^j,a_{i,z}^j) =t+2+z-\gamma = \text {dist}(v_{i,\gamma }^j,\alpha _{i,z}^j)\).

Similarly, we show that the critical pairs that \(v_{i,\gamma '}^{j+1}\) resolves in \(A_i^j\) are exactly the pairs \(\{a_{i,z}^j,\alpha _{i,z}^j\}\) with \(z \leqslant \gamma '\). For every \(z \in [t]\), it holds that \(\text {dist}(v_{i,\gamma '}^{j+1},a_{i,z}^j) = \min (t+3+z-\gamma ',t+3+\gamma '-z) = t+3+\min (z-\gamma ',\gamma '-z)\), and \(\text {dist}(v_{i,\gamma '}^{j+1},\alpha _{i,z}^j) = \min (t+2+z-\gamma ',t+3+\gamma '-z) = t+2+\min (z-\gamma ',\gamma '-z+1)\). So if \(z \leqslant \gamma '\), \(\text {dist}(v_{i,\gamma '}^{j+1},a_{i,z}^j) = t + 3 + z -\gamma ' \ne t + 2 + z - \gamma '= \text {dist}(v_{i,\gamma '}^{j+1},\alpha _{i,z}^j)\). Whereas if \(z > \gamma '\), \(\text {dist}(v_{i,\gamma '}^{j+1},a_{i,z}^j) = t + 3 + \gamma ' - z = \text {dist}(v_{i,\gamma '}^{j+1},\alpha _{i,z}^j)\). This implies that all the critical pairs of \(A_i^j\) are resolved by S if and only if \(\gamma \leqslant \gamma '\). \(\square\)

We can now prove the correctness of the reduction. The construction can be computed in polynomial time in |V(G)|, and \(G'\) itself has size bounded by a polynomial in |V(G)|. We postpone checking that the pathwidth is bounded by O(k) to the end of the second step, where we produce an instance of MD whose graph \(G''\) admits \(G'\) as an induced subgraph.

4.2.1 k-Multicolored Independent Set in \(G\ \Rightarrow\) Legal Resolving Set in \(G'\).

Let \(\{v_{1,\gamma _1}, \ldots , v_{k,\gamma _k}\}\) be a k-multicolored independent set in G. We claim that \(S:=\bigcup _{j \in [m]} \{v_{1,\gamma _1}^j, \ldots\), \(v_{k,\gamma _k}^j\}\) is a legal resolving set in \(G'\) (of size km). The set S is legal by construction. Since for every \(i \in [k]\), and \(j \in [m]\), \(v_{i,\gamma _i}^j\) and \(v_{i,\gamma _i}^{j+1}\) are in S (\(j+1\) is modulo m), all the critical pairs in the propagation gadgets are resolved by S, by Lemma 4.4. Since \(\{v_{1,\gamma _1}, \ldots , v_{k,\gamma _k}\}\) is an independent set in G, there is no \(e_j = v_{i,\gamma }v_{i',\gamma '} \in E(G)\), such that \((\gamma ,\gamma ')=(\gamma _i,\gamma _{i'})\). Thus every critical pair \(\{c_j,c'_j\}\) is resolved by S, by Lemma 4.3.

4.2.2 Legal Resolving Set in \(G'\ \Rightarrow \ k\)-Multicolored Independent Set in G.

Assume that there is a legal resolving set S in \(G'\). For every \(i \in [k]\), for every \(j \in [m]\), the vertex \(v_{i,\gamma (i,j)}^j\) in \(V_i^j \cap S\) and the vertex \(v_{i,\gamma (i,j+1)}^{j+1}\) in \(V_i^{j+1} \cap S\) (\(j+1\) is modulo m) are such that \(\gamma (i,j) \leqslant \gamma (i,j+1)\), by Lemma 4.4. Thus \(\gamma (i,1) \leqslant \gamma (i,2) \leqslant \ldots \leqslant \gamma (i,m-1) \leqslant \gamma (i,m) \leqslant \gamma (i,1)\), and \(\gamma _i := \gamma (i,1) = \gamma (i,2) = \ldots = \gamma (i,m-1) = \gamma (i,m)\). We claim that \(\{v_{1,\gamma _1}, \ldots , v_{k,\gamma _k}\}\) is a k-multicolored independent set in G. Indeed, there cannot be an edge \(e_j = v_{i,\gamma _i} v_{i',\gamma _{i'}} \in E(G)\), since otherwise the critical pair \(\{c_j,c'_j\}\) is not resolved, by Lemma 4.3.

5 Parameterized Hardness of Metric Dimension/\(\text {tw}\)

In this section, we produce in polynomial time an instance \((G'',k'')\) of Metric Dimension equivalent to \((G',{\mathcal {X}}, {\mathrm{km}},{\mathcal {P}})\) of \(k\)-Multicolored Resolving Set. The graph \(G''\) has also pathwidth O(k). Now, an instance is just a graph and an integer. There is no longer \({\mathcal {X}}\) and \({\mathcal {P}}\) to constrain and respectively loosen the “resolving set” at our convenience. This creates two issues: (1) the vertices outside the former set \({\mathcal {X}}\) can now be put in the resolving set, potentially yielding undesired solutionsFootnote 2 and (2) our candidate solution (when there is a k-multicolored independent set in G) may not distinguish all the vertices.

5.1 Construction

We settle both issues by attaching new gadgets to \(G'\). Eventually the new graph \(G''\) will contain \(G'\) as an induced subgraph. To settle the issue (1), we design a forced set gadget. A forced set gadget attached to \(V_i^j\) contains two pairs of vertices which are only resolved by vertices of \(V_i^j\). Thus the gadget simulates the action of \({\mathcal {X}}\).

There are a few pairs which are not resolved by a solution of \(k\)-Multicolored Resolving Set. To make sure that all pairs are resolved, we add vertices which need be selected in the resolving set. Technically we could use the previous gadget on a singleton set. But we can make it simpler: we just attach two pendant neighbors, that we then make adjacent, to some chosen vertices. A pair of pendant neighbors are true twins in the whole graph. So we know that at least one of these two vertices have to be in the resolving set. Hence we call that the forced vertex gadget, and one of the true twins, a forced vertex. It is important that these forced vertices do not resolve any pair of \({\mathcal {P}}\). So we can only add pendant twins to vertices themselves not resolving any pair of \({\mathcal {P}}\).

5.1.1 Forced Set Gadget

To deal with the issue (1), we introduce two new pairs of vertices for each \(V_i^j\). The intention is that the only vertices resolving both these pairs simultaneously are precisely the vertices of \(V_i^j\). For any \(i \in [k]\) and \(j \in [m]\), we add to \(G'\) two pairs of vertices \(\{p_i^j,q_i^j\}\) and \(\{r_i^j,s_i^j\}\), and two gates \(\pi _i^j\) and \(\rho _i^j\). Vertex \(\pi _i^j\) is adjacent to \(p_i^j\) and \(q_i^j\), and vertex \(\rho _i^j\) is adjacent to \(r_i^j\) and \(s_i^j\).

We link \(v_{i,1}^j\) to \(p_i^j\), and \(v_{i,t}^j\) to \(r_i^j\), each by a path of length t. It introduces two new neighbors of \(v_{i,1}^j\) and \(v_{i,t}^j\) (the brown vertices in Fig. 4). We denote them by \(\text {tb}^{j}_{i}\) and \(\text {bb}^{j}_{i}\), respectively. The blue and brown vertices are linked to \(\pi _i^j\) and \(\rho _i^j\) in the following way. We link \(\text {tl}^{j}_{i}\) and \(\text {tr}^{j}_{i}\) to \(\pi _i^j\) by a private path of length t, and to \(\rho _i^j\) by a private path of length \(2t-1\). We link \(\text {bl}^{j}_{i}\) and \(\text {br}^{j}_{i}\) to \(\pi _i^j\) by a private path of length \(2t-1\), and to \(\rho _i^j\) by a private path of length t. (Let us clarify that the names of the blue vertices \(\text {bl}^{j}_{i}\) and \(\text {br}^{j}_{i}\) are for “bottom-left” and “bottom-right”, and not for “blue” and “brown”.) We link \(\text {tb}^{j}_{i}\) (neighbor of \(v_{i,1}^j\)) to \(\rho _i^j\) by a private path of length \(2t-1\). We link \(\text {bb}^{j}_{i}\) (neighbor of \(v_{i,t}^j\)) to \(\pi _i^j\) by a private path of length \(2t-1\). Note that the general rule to set the path length is to match the distance between the neighbor in \(V_i^j\) and \(p_i^j\) (resp. \(r_i^j\)). With that in mind we link, if it exists, the top cyan vertex \(\text {tc}^{j}_{i}\) (the one with smallest index \(\gamma\)) neighboring \(V_i^j\) to \(\pi _i^j\) with a path of length \(\text {dist}(v_{i,\gamma }^j,p_i^j) = t+\gamma -1\) where \(v_{i,\gamma }^j\) is the unique vertex in \(N(\text {tc}^{j}_{i}) \cap V_i^j\). Observe that with the notations of the previous section \(\text {tc}^{j}_{i} =e_{i,\gamma }^j\). We also link, if it exists, the bottom cyan vertex \(\text {bc}^{j}_{i}\) (the one with largest index \(\gamma\)) to \(\rho _i^j\) with a path of length \(\text {dist}(v,r_i^j)\) where v is again the unique neighbor of \(\text {bc}^{j}_{i}\) in \(V_i^j.\)

It can be observed that we only have two paths (and not all six) from the at most three cyan vertices to the gates \(\pi _i^j\) and \(\rho _i^j\). This is where the edges between the cyan vertices will become relevant. See Fig. 4 for an illustration of the forced vertex gadget.

Fig. 4
figure 4

The forcet set gadget for \(V_i^j\). The cyan vertices are the at most three neighbors of \(V_i^j\) in the potential paths to \({\mathcal {G}}(e_j)\). The lengths of the paths from the neighbors of \(V_i^j\) to \(\pi _i^j\) and \(\rho _i^j\) is defined in Sect. 5.1.1 (Color figure online)

5.1.2 Forced Vertex Gadget

We now deal with the issue (2). By we add (or attach) a forced vertex to an already present vertex v, we mean that we add two adjacent neighbors to v, and that these two vertices remain of degree 2 in the whole graph \(G''\). Hence one of the two neighbors will have to be selected in the resolving set since they are true twins. We call forced vertex one of these two vertices (picking arbitrarily).

For every \(i \in [k]\) and \(j \in [m]\), we add a forced vertex to the gates \(\text {nw}^{j}_{i}\) and \(\text {se}^{j}_{i}\) of \(P_i^{j,{j+1}}\). We also add a forced vertex to each vertex in \(N(\{\pi _i^j,\rho _i^j\}) {\setminus} \{p_i^j, q_i^j, r_i^j, s_i^j\}\). This represents a total of 12 vertices (6 neighbors of \(\pi _i^j\) and 6 neighbors of \(\rho _i^j\)). For every \(j \in [m]\), we attach a forced vertex to each vertex in \(N(g_j) {\setminus} \{c_j, c'_j\}\). This constitutes 14 neighbors (hence 14 new forced vertices). Therefore we set \(k'' := {\mathrm{km}} + 12\,{\mathrm{km}} + 2\,{\mathrm{km}} + 14\,{\mathrm{m}} = 15\,{\mathrm{km}} + 14\,{\mathrm{m}}\).

5.1.3 Finishing Strokes and Useful Notations

We use the convention that P(uv) denotes the path from u to v which was specifically built from u to v. In other words, for P(uv) to make sense, there should be a point in the construction where we say that we add a (private) path between u and v. For the sake of legibility, P(uv) may denote either the set of vertices or the induced subgraph. We also denote by \(\nu (u,v)\) the neighbor of u in the path P(uv). Observe that P(uv) is a symmetric notation but not \(\nu (u,v)\).

We add a path of length \(\text {dist}(\nu (\pi _i^j,\text {tr}^{j}_{i}),\text {sw}^{j}_{i})=t\) between \(\nu (\pi _i^j,\text {tr}^{j}_{i})\) and \(\text {se}^{j}_{i}\), and a path of length \(\text {dist}(\nu (\pi _i^j,\text {bl}^{j}_{i}),\text {ne}_i^{j-1})=2t-1\) between \(\nu (\pi _i^j,\text {bl}^{j}_{i})\) and \(\text {nw}_i^{j-1}\). Similarly, we add a path of length \(\text {dist}(\nu (\rho _i^j\), \(\text {tr}^{j}_{i}),\text {sw}^{j}_{i})=2t-1\) between \(\nu (\rho _i^j,\text {tr}^{j}_{i})\) and \(\text {se}^{j}_{i}\), and a path of length \(\text {dist}(\nu (\rho _i^j,\text {bl}^{j}_{i}),\text {ne}_i^{j-1})=t\) between \(\nu (\rho _i^j,\text {bl}^{j}_{i})\) and \(\text {nw}_i^{j-1}\). We added these four paths so that no forced vertex resolves any critical pair in the propagation gadgets \(P_i^{j-1,j}\) and \(P_i^{j,j+1}\).

Finally we add an edge between \(\nu (g_j,\text {nw}^{j}_{i})\) and \(\nu (c_j,\text {bc}^{j}_{i})\) whenever \(V_i^j\) have exactly three cyan vertices. We do that to resolve the pair \(\{\nu (c_j,\text {tc}^{j}_{i}), \nu (c_j,\text {bc}^{j}_{i})\}\), and more generally every pair \(\{x,y\} \in P(c_j,\text {tc}^{j}_{i}) \times P(c_j,\text {bc}^{j}_{i})\) such that \(\text {dist}(c_j,x)=\text {dist}(c_j,y)\). This finishes the construction of the instance \((G'',k'' := 15\,{\mathrm{km}}+14\,{\mathrm{m}})\) of Metric Dimension (Fig. 5).

Fig. 5
figure 5

The different gadgets attached to \(V_i^j\) (recall that \({\mathcal {G}}(e_j)\) is only optionally linked to \(V_i^j\)). Gray edges are the edges in the propagation gadgets already depicted in Fig. 3. Black vertices are forced vertices. For the sake of clarity, we did not represent the paths already in the \(k\)-MRS-instance from the blue vertices to \(g_j\), and the full forced set gadget of Fig. 4 (it is only symbolized with the dash-dotted edges). A forced vertex is added to each neighbor of the red vertices, except \(p_i^j, q_i^j, r_i^j, s_i^j, c_j, c'_j\). Finally we will add four more paths and potentially two edges (see the finishing touches of Sect. 5.1.3) (Color figure online)

5.2 Correctness of the Reduction

The two next lemmas will be crucial in Sect. 5.2.1. The first lemma shows how the forcing set gadget simulates the action of former set \({\mathcal {X}}\).

Lemma 5.1

For every \(i \in [k]\) and \(j \in [m]\),

  • \(\forall v \in V_i^j\), v resolves both pairs \(\{p_i^j, q_i^j\}\) and \(\{r_i^j, s_i^j\}\),

  • \(\forall v \notin V_i^j\), v resolves at most one pair of \(\{p_i^j, q_i^j\}\) and \(\{r_i^j, s_i^j\}\),

  • \(\forall v \notin V_i^j \cup P(v_{i,1}^j,p_i^j) \cup P(v_{i,t}^j,r_i^j) \cup \{q_i^j, s_i^j\}\), v does not resolve \(\{p_i^j, q_i^j\}\) nor \(\{r_i^j, s_i^j\}\).

Proof

Let \(Y := \{\text {tl}^{j}_{i},\text {tr}^{j}_{i},\text {bl}^{j}_{i},\text {br}^{j}_{i} \} \cup (X_j \cap N(V_i^j)) \cup (N(\{\pi _i^j,\rho _i^j\}) {\setminus} \{p_i^j, q_i^j, r_i^j, s_i^j\})\), and recall that \(X_j \cap N(V_i^j)\) is the set of cyan vertices neighbors of \(V_i^j\) (if they exist). Let us assume that these cyan vertices exist (otherwise the proof is just simpler). In particular, there are at least two cyan neighbors \(\text {tc}^{j}_{i}, \text {bc}^{j}_{i} \in X_j \cap N(V_i^j)\). Let X be the connected component of \(G-Y\) containing \(\{\pi _i^j,\rho _i^j\}\). For every vertex \(u \in \{\text {tl}^{j}_{i},\text {tr}^{j}_{i},\text {bl}^{j}_{i},\text {br}^{j}_{i},\text {tc}^{j}_{i},\text {bc}^{j}_{i} \}\), by the way we chose the length of \(P(u,\pi _i^j)\) (resp. \(P(u,\rho _i^j)\)), there is a shortest path from u to \(p_i^j\) (resp. \(r_i^j\)) that goes through \(\pi _i^j\) (resp. \(\rho _i^j\)). Thus \(\text {dist}(u,p_i^j)=\text {dist}(u,\pi _i^j)+1 =\text {dist}(u,q_i^j)\) and \(\text {dist}(u,r_i^j)=\text {dist}(u,\rho _i^j)+1 =\text {dist}(u,s_i^j)\).

Let \(\text {mc}_i^j\) be the middle cyan vertex if it exists (the one which is not the top nor the bottom one). There is shortest a path from \(\text {mc}_i^j\) to \(p_i^j\) (resp. \(r_i^j\)) going via \(\text {tc}^{j}_{i}\) (resp. \(\text {bc}^{j}_{i}\)) and then \(\pi _i^j\) (resp. \(\rho _i^j\)). This is where the edges \(\text {mc}_i^j\text {tc}^{j}_{i}\) and \(\text {mc}_i^j\text {bc}^{j}_{i}\) are useful. Hence \(\text {mc}_i^j\) does not resolve \(\{p_i^j, q_i^j\}\) nor \(\{r_i^j, s_i^j\}\), either. It is direct that no vertex of \(N(\{\pi _i^j,\rho _i^j\}) {\setminus} \{p_i^j, q_i^j, r_i^j, s_i^j\}\) resolves \(\{p_i^j, q_i^j\}\) nor \(\{r_i^j, s_i^j\}\). Thus no vertex of Y resolves any of \(\{p_i^j, q_i^j\}\) and \(\{r_i^j, s_i^j\}\). Therefore by Lemma 4.1, no vertex outside X resolves any of \(\{p_i^j, q_i^j\}\) and \(\{r_i^j, s_i^j\}\).

We observe that \(X = V_i^j \cup P(v_{i,1}^j,p_i^j) \cup P(v_{i,t}^j,r_i^j) \cup \{\pi _i^j, q_i^j, \rho _i^j, s_i^j\}\). Because of the path from the top brown vertex to \(\rho _i^j\), vertices of \(P(v_{i,1}^j,p_i^j) {\setminus} \{v_{i,1}^j\} \cup \{q_i^j\}\), which do resolve \(\{p_i^j, q_i^j\}\), do not resolve \(\{r_i^j, s_i^j\}\). Similarly because of the path from the bottom brown vertex to \(\pi _i^j\), vertices of \(P(v_{i,t}^j,r_i^j) {\setminus} \{v_{i,t}^j\} \cup \{s_i^j\}\), which do resolve \(\{r_i^j, s_i^j\}\), do not resolve \(\{p_i^j, q_i^j\}\). Finally for every \(u \in V_i^j\), \(\text {dist}(u,q_i^j) = \text {dist}(u,p_i^j)+2\) and \(\text {dist}(u,r_i^j) = \text {dist}(u,s_i^j)+2\). Therefore vertices of \(V_i^j\) are the only ones resolving both \(\{p_i^j, q_i^j\}\) and \(\{r_i^j, s_i^j\}\), while no vertex of \(G-X\) resolves any of these pairs. \(\square\)

We denote by f(v) the forced vertex attached to a vertex v. For Sect. 5.2.1, we also need the following lemma, which states that the forced vertices do not resolve critical pairs.

Lemma 5.2

No forced vertex resolves a pair of \({\mathcal {P}}\).

Proof

We first show that no critical pair in some \(P_i^{j,j+1}\) is resolved by a forced vertex. We use a similar plan as for the proof of Lemma 4.2. Let \(Y := \{\text {nw}_i^{j-1}, \text {se}_i^{j-1}, \text {nw}_i^{j+1}, \text {se}_i^{j+1}\} \cup C_e\), where \(C_e\) comprises \(\{c_j,g_j\}\) if \(e_j\) has an endpoint in \(V_i\) and \(\{c_{j+1},g_{j+1}\}\) if \(e_{j+1}\) has an endpoint in \(V_i\). Let X be the connected component of \(G'' - Y\) containing \(P_i^{j,j+1}\). Note that the distances between the vertices of Y and the critical pairs in \(P_i^{j,j+1}\) are the same between \(G'\) and \(G''\). Hence as we showed in Lemma 4.2, no vertex of Y resolves a critical pair in \(P_i^{j,j+1}\). Thus by Lemma 4.1 no vertex outside X resolves a critical pair in \(P_i^{j,j+1}\).

We now check that no forced vertex in X resolves a critical pair in \(P_i^{j,j+1}\). We show that every forced vertex in X has a shortest path to \(\{\text {nw}^{j}_{i},\text {ne}^{j}_{i} \}\) ending in \(\text {nw}^{j}_{i}\), and a shortest path to \(\{\text {sw}^{j}_{i},\text {se}^{j}_{i} \}\) ending in \(\text {se}^{j}_{i}\). It is clear for \(f(\text {nw}^{j}_{i})\) and for \(f(\text {se}^{j}_{i})\), as well as for all the forced vertices attached to neighbors of \(g_j\) (in case \(e_j\) has an endpoint in \(V_i\)). Indeed recall that the length of \(P(g_j,\text {nw}^{j}_{i})\) (resp. \(P(g_j,\text {se}^{j}_{i})\)) is four less than the distance to \(\text {nw}^{j}_{i}\) (resp. \(\text {sw}^{j}_{i}\)) ignoring the path \(P(g_j,\text {nw}^{j}_{i})\) (resp. \(P(g_j,\text {se}^{j}_{i})\)). So the shortest paths from the latter forced vertices go to \(g_j\) and then to \(\text {nw}^{j}_{i}\) (resp. \(\text {se}^{j}_{i}\)). Similarly in case \(e_{j+1}\) has an endpoint in \(V_i\), the shortest paths from the forced vertices attached to the neighbors of \(c_{j+1}\) to \(\{\text {nw}^{j}_{i},\text {ne}^{j}_{i} \}\) (resp. \(\{\text {sw}^{j}_{i},\text {se}^{j}_{i} \}\)) go to \(g_{j+1}\), then to \(\text {nw}_i^{j+1}\) and \(\text {nw}^{j}_{i}\) (resp. then to \(\text {se}_i^{j+1}\) and \(\text {se}^{j}_{i}\)).

Note that all the forced vertices attached to neighbors of \(\pi _i^j\) and \(\rho _i^j\) (resp. \(\pi _i^{j+1}\) and \(\rho _i^{j+1}\)) have a shortest path to \(\{\text {nw}^{j}_{i},\text {ne}^{j}_{i} \}\) ending in \(\text {nw}^{j}_{i}\) (resp. to \(\{\text {sw}^{j}_{i},\text {se}^{j}_{i} \}\) ending in \(\text {se}^{j}_{i}\)). Finally due to the paths \(P(\nu (\pi _i^j,\text {tr}^{j}_{i}),\text {se}^{j}_{i})\) and \(P(\nu (\rho _i^j,\text {tr}^{j}_{i}),\text {se}^{j}_{i})\), all the forced vertices attached to neighbors of \(\pi _i^j\) and \(\rho _i^j\) have a shortest path to \(\{\text {sw}^{j}_{i},\text {se}^{j}_{i} \}\) ending in \(\text {se}^{j}_{i}\). And due to the paths \(P(\nu (\pi _i^{j+1},\text {bl}_i^{j+1}),\text {nw}^{j}_{i})\) and \(P(\nu (\rho _i^{j+1},\text {bl}_i^{j+1}),\text {nw}^{j}_{i})\), all the forced vertices attached to neighbors of \(\pi _i^{j+1}\) and \(\rho _i^{j+1}\) have a shortest path to \(\{\text {nw}^{j}_{i},\text {ne}^{j}_{i} \}\) ending in \(\text {nw}^{j}_{i}\).

We now show that no critical pair \(\{c_j,c'_j\}\) is resolved by a forced vertex. We set \(Y' := \{\text {tl}^{j}_{i}, \text {tr}^{j}_{i}, \text {bl}^{j}_{i}, \text {br}^{j}_{i}\), \(\text {tl}_{i'}^j, \text {tr}_{i'}^j, \text {bl}_{i'}^j, \text {br}_{i'}^j, \text {nw}^{j}_{i}, \text {se}^{j}_{i}, \text {nw}_{i'}^j, \text {se}_{i'}^j, \pi _i^j, \rho _i^j, \pi _{i'}^j, \rho _{i'}^j\}\), with \(e_j \in E(V_i,V_{i'})\), and \(X'\) be the connected component of \(G'' - Y'\) containing \(g_j\). We showed in Lemma 4.2, and it remains true in \(G''\), that no vertex of \(Y' {\setminus} \{\pi _i^j, \rho _i^j, \pi _{i'}^j, \rho _{i'}^j\}\) resolves \(\{c_j,c'_j\}\). We observe that \(\pi _i^j\) and \(\rho _i^j\) have shortest paths to \(c_j\) going through \(g_j\) (via a vertex of \(\{\text {tl}^{j}_{i},\text {tr}^{j}_{i},\text {bl}^{j}_{i},\text {br}^{j}_{i} \}\)). Similarly \(\pi _{i'}^j\) and \(\rho _{i'}^j\) have shortest paths to \(c_j\) going through \(g_j\). Therefore no vertex of \(\{\pi _i^j, \rho _i^j, \pi _{i'}^j, \rho _{i'}^j\}\) resolves the pair \(\{c_j,c'_j\}\). Hence by Lemma 4.1, no vertex outside \(X'\) resolves \(\{c_j,c'_j\}\). The only forced vertices in \(X'\) are attached to neighbors of \(g_j\), thus they do not resolve \(\{c_j,c'_j\}\). \(\square\)

5.2.1 MD-Instance has a Solution \(\Rightarrow\) \(k\)-MRS-Instance has a Solution

Let S be a resolving set for the Metric Dimension-instance. We show that \(S' := S \cap \bigcup _{i \in [k], j \in [m]} V_i^j\) is a solution for \(k\)-Multicolored Resolving Set. The set \(S {\setminus} S'\) is made of 14 km + 14 m forced vertices, none of which is in some \(V_i^j \cup P(v_{i,1}^j,p_i^j) \cup \{q_i^j\} \cup P(v_{i,t}^j,r_i^j) \cup \{s_i^j\}\). Thus by Lemma 5.1, \(S {\setminus} S'\) does not resolve any pair \(\{p_i^j, q_i^j\}\) or \(\{r_i^j, s_i^j\}\). Now \(S'\) is a set of \(k''-(14\,{\mathrm{km}}+14\,{\mathrm{m}})={\mathrm{km}}\) vertices resolving all the 2 km pairs \(\{p_i^j, q_i^j\}\) and \(\{r_i^j, s_i^j\}\). Again by Lemma 5.1, this is only possible if \(|S' \cap V_i^j|=1\). Thus \(S'\) is a legal set of size \(k' = {\mathrm{km}}\). Let us now check that \(S'\) resolves every pair of \({\mathcal {P}}\) in the graph \(G'\).

By Lemma 5.2, \(S {\setminus} S'\) does not resolve any pair of \({\mathcal {P}}\) in the graph \(G''\). Thus \(S'\) resolves all the pairs of \({\mathcal {P}}\) in \(G''\). Since the distances between \(V_i^j\) and the critical pairs in the edge and propagation gadgets \(V_i^j\) is attached to are the same in \(G'\) and in \(G''\), \(S'\) also resolves every pair of \({\mathcal {P}}\) in \(G'\). Thus \(S'\) is a solution for the \(k\)-MRS-instance.

5.2.2 \(k\)-MRS-Instance has a Solution \(\Rightarrow\) MD-Instance has a Solution

For every \(i \in [k]\), \(j \in [m]\), let

$$\begin{aligned}&F_i^j := \bigcup _{u \in \{\text {nw}^{j}_{i},\text {se}^{j}_{i} \} \cup N(\{\pi _i^j,\rho _i^j\}) {\setminus} \{p_i^j, q_i^j, r_i^j, s_i^j\}} \{f(u)\},\ \text {and}\\&F_j := \bigcup _{u \in N(g_j) {\setminus} \{c_j,c'_j\}} \{f(u)\}. \end{aligned}$$

Let S be a solution for \(k\)-Multicolored Resolving Set. Thus \(|S|={\mathrm{km}}\). Let \(F := \bigcup _{i \in [k], j \in [m]} F_i^j \cup \bigcup _{j \in [m]} F_j\). We show that \(S' := S \cup F\) is a solution of Metric Dimension. First we observe that \(|S'|={\mathrm{km}}+14\,{\mathrm{km}}+14\,{\mathrm{m}}=k''\). Since the distances between the sets \(V_i^j\) and the critical pairs (of \({\mathcal {P}}\)) are the same in \(G'\) and in \(G''\), the pairs of \({\mathcal {P}}\) are resolved by S. In what follows, we show that F resolves all the other pairs. For every \(i \in [k]\), \(j \in [m]\), we define the subset of vertices:

$$\begin{aligned}&\Pi _i^j := \bigcup _{u \in \{\text {tr}^{j}_{i},\text {tl}^{j}_{i},\text {br}^{j}_{i},\text {bl}^{j}_{i},\text {bb}^{j}_{i},\text {tc}^{j}_{i} \}} P(\pi _i^j,u) \cup P(v_{i,1}^j,p_i^j) \cup \{q_i^j\},\\&R_i^j := \bigcup _{u \in \{\text {tr}^{j}_{i},\text {tl}^{j}_{i},\text {br}^{j}_{i},\text {bl}^{j}_{i},\text {tb}^{j}_{i},\text {bc}^{j}_{i} \}} P(\rho _i^j,u) \cup P(v_{i,t}^j,r_i^j) \cup \{s_i^j\}, \text {and}\\&G_j := \bigcup _{u \in \{\text {tr}^{j}_{i},\text {tl}^{j}_{i},\text {br}^{j}_{i},\text {bl}^{j}_{i},\text {tl}_{i'}^j, \text {tr}_{i'}^j,\text {bl}_{i'}^j,\text {br}_{i'}^j,\text {nw}^{j}_{i},\text {se}^{j}_{i}, \text {nw}_{i'}^j,\text {se}_{i'}^j\}} P(g_j,u) \cup E_i^j \cup E_{i'}^j \cup \{c'_j\}. \end{aligned}$$

Informally \(\Pi _i^j\) (\(R_i^j\), \(G_j\), respectively) consists of the vertices on the paths incident to \(\pi _i^j\) (\(\rho _i^j\), \(g_j\), respectively). Our objective is the following result.

Lemma 5.3

Every vertex in \(G''\) is distinguished by \(S'\).

We start with the forced vertices and their true twin. We denote by \(f'(v)\) the true twin of the forced vertex f(v).

Lemma 5.4

All the vertices f(v) and \(f'(v)\) are distinguished by F.

Proof

Any vertex f(v) is distinguished by being the only vertex at distance 0 of itself \(f(v) \in F\). Since f(v) has only two neighbors \(f'(v)\) and v, it also resolves every pair \(\{f'(v),w\}\) where w is not v. The pair \(\{f'(v),v\}\) is resolved by any vertex \(f \in F {\setminus} \{f(v)\}\). Indeed \(\text {dist}(f,f'(v)) =\text {dist}(f,v)+1\). Thus \(f'(v)\) is distinguished. \(\square\)

In general, to show that all the vertices in a set X are distinguished, we proceed in two steps. First we show that every internal pair of X is resolved. Then, we prove that every pair of \(X \times \overline{X}\) is also resolved. Let us recall that \(\overline{X}\) is the complement of x, here \(V(G'') {\setminus} X\). For instance, the two following lemmas show that every vertex of \(\Pi _i^j\) is distinguished by \(S'\).

Lemma 5.5

Every pair of distinct vertices \(x, y \in \Pi _i^j\) is resolved by \(S'\).

Proof

Let \(U_i^j\) be the set \(\{\text {tl}^{j}_{i},\text {tr}^{j}_{i},\text {bl}^{j}_{i},\text {br}^{j}_{i},\text {tc}^{j}_{i},\text {bb}^{j}_{i} \}\). We first consider two vertices \(x \ne y \in P(\pi _i^j,u)\), for some \(u \in U_i^j\). As \(\text {dist}_{G''}(\pi _i^j,u)\) is equal to the length of \(P(\pi _i^j,u)\), it holds that \(\text {dist}_{G''}(\pi _i^j,x) =\text {dist}_{P(\pi _i^j,u)}(\pi _i^j,x) \ne \text {dist}_{P(\pi _i^j,u)}(\pi _i^j,y) = \text {dist}_{G''}(\pi _i^j,y)\). Without loss of generality, we assume that \(\text {dist}(\pi _i^j,x) < \text {dist}(\pi _i^j,y)\). If \(x \ne \pi _i^j\), then x and y have distinct distances to \(\nu (\pi _i^j,u)\). Hence \(\text {dist}(f(\nu (\pi _i^j,u)),x) \ne \text {dist}(f(\nu (\pi _i^j,u)),y)\) and \(S'\) resolves \(\{x,y\}\). Now if \(x = \pi _i^j\), then \(f(\nu (\pi _i^j,u'))\) resolves \(\{x,y\}\) for any \(u' \in U_i^j {\setminus} \{u\}\).

Secondly we consider \(x \in P(\pi _i^j,u)\) and \(y \in P(\pi _i^j,u')\), for some \(u \ne u' \in U_i^j\). If \(\text {dist}(\pi _i^j,x) \ne 2+\text {dist}(\pi _i^j,y)\), then \(f(\nu (\pi _i^j,x))\) resolves \(\{x,y\}\). Indeed \(\text {dist}(f(\nu (\pi _i^j,x)),x) = \text {dist}(\pi _i^j,x) \ne 2 + \text {dist}(\pi _i^j,y) = \text {dist}(f(\nu (\pi _i^j,x)),y)\). Else if \(\text {dist}(\pi _i^j,x) = 2+\text {dist}(\pi _i^j,y)\), then \(f(\nu (\pi _i^j,y))\) resolves \(\{x,y\}\) (since \(\text {dist}(\pi _i^j,y) \ne 2+\text {dist}(\pi _i^j,x)\)).

Two distinct vertices on \(P(v_{i,1}^j,p_i^j)\) are resolved by, say, \(f(\nu (\pi _i^j,\text {br}^{j}_{i})) \in F\). A vertex of \(P(v_{i,1}^j,p_i^j)\) and a vertex of \(P(\pi _i^j,u)\), for some \(u \in U_i^j\), are resolved by either \(f(\nu (\pi _i^j,u))\) or \(f(\nu (\pi _i^j,u'))\) for a \(u' \in U_i^j {\setminus} \{u\}\). Finally \(q_i^j\) and a vertex in \(P(v_{i,1}^j,p_i^j) {\setminus} \{p_i^j\}\) are resolved by, say, \(f(\nu (\pi _i^j,\text {br}^{j}_{i}))\), whereas \(q_i^j\) and a vertex in \(P(p_i^j,u)\) is resolved by either \(f(\nu (\pi _i^j,u))\) or \(f(\nu (\pi _i^j,u'))\) for a \(u' \in U_i^j {\setminus} \{u\}\). Therefore every pair of distinct vertices in \(\Pi _i^j\) is resolved by F, except \(\{p_i^j,q_i^j\}\) which is resolved by S. \(\square\)

Lemma 5.6

Every pair \(\{x,y\} \in \Pi _i^j \times \overline{\Pi _i^j}\) is resolved by F.

Proof

Again let \(U_i^j\) be the set \(\{\text {tl}^{j}_{i},\text {tr}^{j}_{i},\text {bl}^{j}_{i},\text {br}^{j}_{i},\text {tc}^{j}_{i},\text {bb}^{j}_{i} \}\). We first assume x is in \(P(\pi _i^j,u)\) for some \(u \in U_i^j {\setminus} \{\text {tr}^{j}_{i},\text {bl}^{j}_{i} \}\). Let y be a vertex of \(\overline{\Pi _i^j}\) such that \(\text {dist}(f(\nu (\pi _i^j,u)),x) =\text {dist}(f(\nu (\pi _i^j,u)),y)\), otherwise \(f(\nu (\pi _i^j,u))\) already resolves \(\{x,y\}\). Every shortest path from \(f(\nu (\pi _i^j,u))\) to y go through \(\pi _i^j\). One can observe that there is a \(u' \in U_i^j {\setminus} \{u\}\) such that \(f(\nu (\pi _i^j,u'))\) has a shortest path also going through \(\pi _i^j\). Hence \(f(\nu (\pi _i^j,u'))\) has the same distance to y (as \(f(\nu (\pi _i^j,u))\)) but a larger distance to x. Hence \(f(\nu (\pi _i^j,u'))\) resolves \(\{x,y\}\).

We now consider an \(x \in P(\pi _i^j,u)\) for some \(u \in \{\text {tr}^{j}_{i},\text {bl}^{j}_{i} \}\). Again let y be a vertex of \(\overline{\Pi _i^j}\) such that \(\text {dist}(f(\nu (\pi _i^j,u)),x) = \text {dist}(f(\nu (\pi _i^j,u)),y)\). If all the shortest paths of \(f(\nu (\pi _i^j,u))\) to y goes through \(\pi _i^j\), we conclude as in the previous paragraph. So they go through \(P(\nu (\pi _i^j,u),\text {se}^{j}_{i})\) (if \(u=\text {tr}^{j}_{i}\)) or \(P(\nu (\pi _i^j,u),\text {nw}_i^{j-1})\) (if \(u=\text {bl}^{j}_{i}\)). Since \(\text {dist}(f(\nu (\pi _i^j,u)),x) \leqslant 2t-1\), it also holds that \(\text {dist}(f(\nu (\pi _i^j,u)),y) \leqslant 2t-1\). The path \(P(\nu (\pi _i^j,\text {tr}^{j}_{i}),\text {se}^{j}_{i})\) has length t and the path \(P(\nu (\pi _i^j,\text {bl}^{j}_{i}),\text {nw}_i^{j-1})\) has length \(2t-1\). Therefore one of \(f(\text {se}^{j}_{i})\), \(f(\text {se}_i^{j-1})\), \(f(\text {nw}^{j}_{i})\), \(f(\text {nw}_i^{j-1})\) resolves \(\{x,y\}\).

We now assume x is in \(P(v_{i,1}^j,p_i^j) \cup \{q_i^j\}\) and \(y \in \overline{\Pi _i^j}\). Then \(f(\nu (\pi _i^j,\text {br}^{j}_{i}))\) resolves \(\{x,y\}\) if y is not in the path \(P(\nu (\pi _i^j,\text {tr}^{j}_{i}),\text {se}^{j}_{i})\) or \(P(\nu (\pi _i^j,u),\text {nw}_i^{j-1})\). Otherwise at least one of \(f(\nu (\pi _i^j,\text {br}^{j}_{i}))\), \(f(\nu (\pi _i^j,\text {tr}^{j}_{i}))\), \(f(\nu (\pi _i^j,\text {bl}^{j}_{i}))\) resolves \(\{x,y\}\). In conclusion, every pair of vertices \(\{x,y\} \in \Pi _i^j \times \overline{\Pi _i^j}\) is resolved by F. \(\square\)

Lemmas 5.5 and 5.6 prove that every vertex in \(\Pi _i^j\) is distinguished by \(S'\). Using the same arguments, we get symmetrically that every vertex of \(R_i^j\) is distinguished by \(S'\).

Lemma 5.7

All the vertices in the paths \(P(\nu (\pi _i^j,\text {tr}^{j}_{i}),\text {se}^{j}_{i})\), \(P(\nu (\rho _i^j,\text {tr}^{j}_{i}), \text {se}^{j}_{i})\), \(P(\nu (\pi _i^j,\text {bl}^{j}_{i})\), \(\text {nw}_i^{j-1})\), \(P(\nu (\rho _i^j,\text {bl}^{j}_{i}),\text {nw}_i^{j-1})\) are distinguished by F.

Proof

Any vertex \(x \in P(\nu (\pi _i^j,\text {tr}^{j}_{i}),\text {se}^{j}_{i})\) is uniquely determined by its distances to \(f(\text {se}^{j}_{i})\), \(f(\text {se}_i^{j-1})\), and \(\nu (\pi _i^j,\text {tr}^{j}_{i})\). Any vertex \(x \in P(\nu (\pi _i^j,\text {bl}^{j}_{i}),\text {nw}_i^{j-1})\) is uniquely determined by its distances to \(f(\text {nw}^{j}_{i})\), \(f(\text {nw}_i^{j-1})\), and \(\nu (\pi _i^j,\text {bl}^{j}_{i})\). The two other cases are symmetric. \(\square\)

So far we showed that the vertices added in the forced set and forced vertex gadgets are all distinguished. We now focus on the vertices in propagation gadgets. Let \(\Delta _i := A_i^j \cup \{\text {nw}^{j}_{i},\text {ne}^{j}_{i},\text {sw}^{j}_{i},\text {se}^{j}_{i} \}\).

Lemma 5.8

Every pair of distinct vertices \(x, y \in \Delta _i^j\) is resolved by \(S'\).

Proof

Since the distances between vertices of \(V_i^j\) and vertices of \(\Delta _i^j\) are the same between \(G'\) and \(G''\), S resolves all the critical pairs \(\{a_{i,\gamma }^j,\alpha _{i,\gamma }^j\}\). Thus we turn our attention to the pairs which are not critical pairs. Since \(\text {dist}(\text {nw}^{j}_{i},a_{i,\gamma }^j)=\gamma\) and \(\text {dist}(\text {nw}^{j}_{i},\alpha _{i,\gamma }^j)=\gamma\), every pair \(\{a_{i,\gamma }^j,a_{i,\gamma '}^j\}\), \(\{a_{i,\gamma }^j,\alpha _{i,\gamma '}^j\}\), or \(\{\alpha _{i,\gamma }^j,\alpha _{i,\gamma '}^j\}\), with \(\gamma \ne \gamma '\) is resolved by \(f(\text {nw}^{j}_{i})\).

Gate \(\text {nw}^{j}_{i}\) (resp. \(\text {se}^{j}_{i}\)) and any other vertex in \(\Delta _i^j\) is resolved by \(f(\text {nw}^{j}_{i})\) (resp. \(f(\text {se}^{j}_{i})\)). Gate \(\text {ne}^{j}_{i}\) (resp. \(\text {sw}^{j}_{i}\)) is resolved from any vertex of \(\Delta _i^j {\setminus} \{a_{i,1}^j,\alpha _{i,1}^j\}\) (resp. \(\Delta _i^j {\setminus} \{a_{i,t}^j,\alpha _{i,t}^j\}\)) by \(f(\text {nw}^{j}_{i})\) (resp. \(f(\text {se}^{j}_{i})\)). Finally, \(\text {ne}^{j}_{i}\) (resp. \(\text {sw}^{j}_{i}\)) and a vertex of \(\{a_{i,1}^j,\alpha _{i,1}^j\}\) (resp. \(\{a_{i,t}^j, \alpha _{i,t}^j\}\)) is resolved by \(f(\text {se}^{j}_{i})\) (resp. \(f(\text {nw}^{j}_{i})\)). \(\square\)

Now when we check that a pair made of a vertex in \(\Delta _i^j\) and a vertex outside \(\Delta _i^j\) is resolved, we can further assume that the second vertex is not in some \(\Pi _i^j \cup R_i^j\) since we already showed that these vertices were distinguished.

Lemma 5.9

Every pair \(\{x,y\} \in \Delta _i^j \times \overline{\Delta _i^j}\) is resolved by \(S'\).

Proof

We may assume that y is not a vertex that was previously shown distinguished. Thus y is not in some \(\Pi _i^j \cup R_i^j\) nor in a path of Lemma 5.7. Then we claim that the pair \(\{x,y\}\) is resolved by at least one of \(f(\text {se}^{j}_{i})\), \(f(\text {se}_i^{j-1})\), \(f(\text {se}_i^{j+1})\), \(f(\text {nw}^{j}_{i})\). Indeed assume that \(f(\text {se}^{j}_{i})\) does not resolve \(\{x,y\}\), and consider a shortest path from \(f(\text {se}^{j}_{i})\) to y. Either this shortest path goes through \(\text {se}_i^{j-1}\) (resp. \(\text {se}_i^{j+1}\)), and in that case \(f(\text {se}_i^{j-1})\) (resp. \(f(\text {se}_i^{j+1})\)) resolves \(\{x,y\}\). Either it takes the path to \(g_j\) (if \(e_j\) has an endpoint in \(V_i\)) or to \(\text {tl}_i^{j+1}\), and then \(f(\text {nw}^{j}_{i})\) resolves \(\{x,y\}\). Or it takes a path to \(V_i^j\), and then \(f(\text {se}_i^{j-1})\) resolves \(\{x,y\}\). \(\square\)

Lemmas 5.8 and 5.9 show that that every vertex in \(\Delta _i^j\) is distinguished by \(S'\). The common neighbor of \(\text {se}_i^{j-1}\) and \(\text {tl}^{j}_{i}\) is distinguished by \(\{f(\text {se}_i^{j-1}),f(\nu (\pi _i^j,\text {tl}^{j}_{i}))\}\). We are now left with showing that the vertices in the edge gadgets, in the sets \(V_i^j\), and in the paths incident to the edge gadgets, are distinguished.

Lemma 5.10

Every pair of distinct vertices \(x, y \in G_j\) is resolved by \(S'\).

Proof

Let \(v_{i,\gamma }\) and \(v_{i',\gamma '}\) be the two endpoints of \(e_j\), and \(U_i^j :=\{\text {tl}^{j}_{i},\text {tr}^{j}_{i},\text {bl}^{j}_{i},\text {br}^{j}_{i},\text {tl}_{i'}^j, \text {tr}_{i'}^j,\text {bl}_{i'}^j\), \(\text {bl}_{i'}^j,\text {nw}^{j}_{i},\text {se}^{j}_{i}\), \(\text {nw}_{i'}^j,\text {se}_{i'}^j,v_{i,\gamma }^j,v_{i',\gamma '}^j\}\). Every pair in \(\bigcup _{u \in U_i^j} P(g_j,u)\) is resolved. Indeed, similarly to Lemma 5.5, two distinct vertices xy on a path \(P(g_j,u)\) (\(u \in U_i^j\)) are resolved by \(f(\nu (g_j,u))\), while two vertices on distinct paths \(P(g_j,u)\) and \(P(g_j,u')\) (\(u \ne u' \in U_i^j\)) are resolved by at least one of \(f(\nu (g_j,u))\) and \(f(\nu (g_j,u'))\).

We now show that any pair in \(\Gamma _i^j := E_i^j \cup E_{i'}^j {\setminus} \{P(g_j,v_{i,\gamma }^j),P(g_j,v_{i,\gamma }^j)\}\) is resolved. Two distinct vertices \(x, y \in \Gamma _i^j\) are resolved by, say, \(f(\nu (g_j,\text {se}^{j}_{i}))\) if they are on the same path, or more generally if they have different distances to \(c_j\). Thus let us assume that x and y are at the same distance from \(c_j\). If \(x \in E_i^j\) and \(y \in E_{i'}^j\) (or vice versa) then the pair \(\{x,y\}\) is resolved by the vertex in \(S \cap V_i^j\) or the vertex in \(S \cap V_{i'}^j\). If \(x \ne y \in E_i^j\) (resp. \(\in E_{i'}^j\)), then \(\{x,y\}\) is resolved by \(f(\nu (g_j,\text {nw}^{j}_{i}))\) (resp. \(f(\nu (g_j,\text {nw}_{i'}^j))\)). This is the reason why we added an edge between \(\nu (g_j,\text {nw}^{j}_{i})\) and \(\nu (c_j,\text {bc}^{j}_{i})\) (recall Sect. 5.1.3).

We now consider pairs \(\{x,y\}\) of \(\bigcup _{u \in U_i^j} P(g_j,u) \times \Gamma _i^j\). Any of these pairs are resolved by at least one of \(f(\nu (g_j,u))\), \(f(\nu (g_j,u'))\), \(f(\nu (g_j,\text {nw}^{j}_{i}))\), \(f(\nu (g_j,\text {nw}_{i'}^j))\), where x is on the path \(P(c_j,u)\) and \(u'\) is any vertex in \(U_i^j {\setminus} \{u,\text {nw}^{j}_{i},\text {nw}_{i'}^j\}\). Finally \(c'_j\) is distinguished from all the other vertices in \(G''\) but \(c_j\) by the forced vertices attached to the neighbors of \(g_j\).

Thus every pair \(\{x,y\}\) in \(G_j\) is resolved by F, except \(\{c_j,c'_j\}\) which is resolved by S. \(\square\)

Lemma 5.11

Every pair \(\{x,y\} \in G_j \times \overline{G_j}\) is resolved by F.

Proof

Consider an arbitrary pair \(\{x,y\} \in G_j \times \overline{G_j}\). We can assume that x is not \(c'_j\), and that y is in one different \(G_{j'}\) or in one \(V_{i''}^{j''}\) (since we already showed that the other vertices are distinguished). Again let \(v_{i,\gamma }\) and \(v_{i',\gamma '}\) be the two endpoints of \(e_j\), and \(U_i^j :=\{\text {tl}^{j}_{i},\text {tr}^{j}_{i},\text {bl}^{j}_{i},\text {br}^{j}_{i},\text {tl}_{i'}^j, \text {tr}_{i'}^j,\text {bl}_{i'}^j\), \(\text {bl}_{i'}^j,\text {nw}^{j}_{i}, \text {se}^{j}_{i},\text {nw}_{i'}^j,\text {se}_{i'}^j,v_{i,\gamma }^j,v_{i',\gamma '}^j\}\). If x is on a path \(P(g_j,u)\), then at least one of \(f(\nu (g_j,u))\) and \(f(\nu (g_j,u'))\), with \(u'\) being any vertex in \(U_i^j {\setminus} \{u\}\), resolves \(\{x,y\}\). If instead x is on a path \(P(c_j,u)\) with \(u \in \{v_{i,\gamma -1}^j,v_{i,\gamma +1}^j,v_{i',\gamma '-1}^j, v_{i',\gamma '+1}^j\}\), then at least one of \(f(\nu (g_j,\text {nw}^{j}_{i}))\), \(f(\nu (g_j,\text {nw}_{i'}^j))\), \(f(\nu (g_j,u'))\), with \(u'\) being any vertex in \(U_i^j\), resolves \(\{x,y\}\). \(\square\)

Lemmas 5.10 and 5.11 show that every vertex in \(G_j\) is distinguished by \(S'\). We finally show that the vertices in \(V_i^j\) are distinguished. A pair of distinct vertices \(x, y \in V_i^j\) is resolved by \(f(\text {nw}^{j}_{i})\). We thus consider a pair \(\{x, y\} \in V_i^j \times \overline{V_i^j}\). We can further assume that y is in some \(V_{i'}^{j'}\), since all the other vertices have already been shown distinguished. Then \(\{x,y\}\) is resolved by at least one of \(f(\text {nw}^{j}_{i})\), \(f(\text {nw}_{i'}^{j'})\), the vertex in \(S \cap V_i^j\), and the vertex in \(S \cap V_{i'}^{j'}\). This finishes the proof of Theorem 5.3. Thus \(S'\) is a solution of the Metric Dimension-instance.

The reduction is correct and it takes polynomial-time in |V(G)| to compute \(G''\). The maximum degree of \(G''\) is 16. It is the degree of the vertices \(g_j\) (\(\text {nw}^{j}_{i}\) and \(\text {se}^{j}_{i}\) have degree at most 11, \(\pi _i^j\) and \(\rho _i^j\) have degree 8, and the other vertices have degree at most 5). The last element to establish Theorem 3.1 is to show that \(\text {pw}(G'')\) is in O(k). Then solving Metric Dimension on constant-degree graphs in time \(f(\text {pw})n^{o(\text {pw})}\) could be used to solve \(k\)-Multicolored Independent Set in time \(f(k)n^{o(k)}\), disproving the ETH.

5.3 \(G''\) has Pathwidth O(k)

We use the pathwidth characterization of Kirousis and Papadimitriou [19] mentioned in the preliminaries, and give a strategy with O(k) searchers cleaning all the edges of \(G''\). A basic and useful fact is that the searching number of a path is two.

Lemma 5.12

Two searchers are enough to clean a path \(u_1u_2 \ldots u_n\).

Proof

We place two searchers at \(u_1\) and \(u_2\). This cleans the edge \(u_1u_2\). Then we move the searcher in \(u_1\) to \(u_3\). This cleans \(u_2u_3\) (while \(u_1u_2\) remains clean). Then we move the searcher in \(u_2\) to \(u_4\), and so on. \(\square\)

Lemma 5.13

\(\text {pw}(G'') \leqslant 90k+83\).

Proof

For every \(j \in [m]\), let \(S_j := N[g_j]\ \cup \ X_j\ \cup \ \bigcup _{i \in [k]} N[\{v_{i,1}^j,v_{i,t}^j,\pi _i^j,\rho _i^j\}] \cup \{\text {nw}^{j}_{i},\text {ne}^{j}_{i},\text {sw}^{j}_{i}, \text {se}^{j}_{i} \}\). We notice that \(|S_j| \leqslant 17+6+30k+4=30k+27\). Another important observation is that \(S_1 \cup S_j\) disconnects the first j columns of \(G''\) from the rest of \(G''\). Finally the connected components \(G''-(S_j \cup S_{j+1})\) that are not the main component (i.e., containing more than half of the graph if \(m \geqslant 4\)) are all paths.

We now suggest the following cleaning strategy with at most \(90k+83\) searchers. We place one searcher at each vertex of \(S_1 \cup S_2 \cup S_3\). This requires \(90k+81\) searchers. By Lemma 5.12, with two additional searchers we clean all the connected components of \(G'' - (S_1 \cup S_2 \cup S_3)\) that are paths. We then move all the searchers from \(S_2\) to \(S_4\), and clean all the connected components of \(G'' - (S_1 \cup S_3 \cup S_4)\) that are paths. Since \(S_1 \cup S_3\) is a separator, the edges that were cleaned during the first phase are not recontaminated when we move from \(S_2\) to \(S_4\). We then move the searchers of \(S_3\) to \(S_5\), and so on. Eventually the searchers reach \(S_1 \cup S_{m-1} \cup S_m\), and the last contaminated edges are cleaned. \(\square\)

6 Perspectives

The main remaining open question is whether or not Metric Dimension can be solved in polynomial time on graphs with constant treewidth. In the parameterized complexity language, now we know that MD/\(\text {tw}\) is W[1]-hard, is it in XP or paraNP-hard? We believe that the tools and ideas developed in this paper could help answering this question negatively. The FPT algorithm of Belmonte et al. [3] also implies that Metric Dimension is FPT with respect to \(\text {tl}+k\) were k is the size of the resolving set, due to the bound \(\Delta \leqslant 2^k+k-1\) [18]. What about the parameterized complexity of Metric Dimension with respect to \(\text {tw}+k\)? We conjecture that this problem is W[1]-hard as well, and once again, treewidth will contrast with tree-length.

It appears that bounded connected treewidth or tree-length is significantly more helpful than the mere bounded treewidth when it comes to solving MD. We wish to ask for the parameterized complexity of Metric Dimension with respect to \(\text {ctw}\) only (on graphs with arbitrarily large degree). Finally, it would be interesting to determine if planarity can sometimes help to compute a metric basis. Therefore we also ask all the above questions in planar graphs.