Manuscript Offprint
arXiv:2608.24336On the Maximum Number of Vertices that Belong to Every Metric Basis
Abstract
Metric bases of graphs have been widely studied since their introduction in the 1970's by Slater and, independently, by Harary and Melter. In this paper, we concentrate on the existence of vertices in a graph G that belong to all metric bases of G. We call these basis forced vertices, and denote the number of them by . We show that for any connected nontrivial graph G of order n having k vertices in each metric basis. In addition, we show that this bound can be attained. Furthermore, the previous result implies the bound formulated in terms of the order n of the graph for any nontrivial connected graph G. This result answers a question posed by Bagheri et al. in 2016. Moreover, we provide a complete realization of the parameters n, and within the previous bounds. We consider some extremal cases related to basis forced vertices in a graph, in particular, we give a full characterization of the graphs with and .
Keywords: Metric dimension; metric basis; basis forced vertices, realization, extremal graphs
AMS Subj. Class. (2020): 05C12
1 Introduction
A resolving set in a graph represents a structure with the capability of uniquely recognizing all the vertices in throughout a vector of distances to the vertices of . The vertices of resolving sets are usually called “landmarks” and the optimization of the quantity of vertices in any resolving set has led to the notion of a metric basis, which is a resolving set of the smallest possible cardinality in . These notions were first and separately introduced in [18] by Slater, and in [11] by Harary and Melter, but they remained almost without any attention until the work [3], which created a breaking point in the interest on them. Nowadays, the metric dimension of graphs is a very well-known topic and there is a huge amount of information about it. Some recent and interesting works on this parameter are for instance [4,5,13,15–17,21,22]. Moreover, for more information on this area, we suggest the very interesting survey [20].
The paper has been presented in part in CALDAM 2025 [7].
Turku Collegium for Science, Medicine and Technology (TCSMT), University of Turku, Finland
Department of Mathematics and Statistics, University of Turku, Finland
Department of Mathematics, Universidad de Cádiz (Algeciras Campus), Spain
Several applications of resolving sets have been proposed in literature. The connections of these structures to robot navigation already appeared in [11], and have been further developed in several other works. A recent and novel location property was presented in [19], where (certain kind of) resolving sets were used while identifying biological sequence data. In order to avoid presenting a large list of such works, any interested reader might simply check the recent survey [20], which contains a fairly complete compendium of applications, and combinatorial or computational properties of resolving sets and metric bases.
An interesting fact, regarding the metric bases of a given graph G, relates to the possible existence of vertices of G such that they are required to be landmarks in every metric basis, in order to locate or resolve the vertices of G. This fact means that a vertex satisfying this property plays a crucial role as a landmark, and thus, identifying such vertices is worthwhile. However, one cannot efficiently decide that a given vertex of a graph possesses such a property since, as proved in [9], it is a co-NP-hard problem to check whether a given vertex of a graph belongs to every metric basis of a graph. The vertices of a graph satisfying the previously mentioned property were called basis forced vertices in [9].
This suggests that finding tight bounds on the number of basis forced vertices in a given graph deserves attention. Hence, the aim of this work is to make significant contributions to this direction. Notice that in [1] Bagheri et al. studied graphs with unique metric bases, that is, graphs with a metric basis where all the vertices are basis forced. They provided bounds and posed a question on the maximum cardinality of a unique metric basis in any graph. In this paper, as a byproduct of Corollary 8, we are able to fully answer that open question. Some previous bounds for the number of basis forced vertices were already given in [9], and some other ones for specific families of graphs recently appeared in [10], but the former ones (and more general), were indeed not the best possible. We significantly improve them in this work.
Formally, given a connected graph , it is said that a vertex resolves two vertices (or that are resolved by ), if , where represents the distance between and , which is the number of edges in a shortest path in . A set is a resolving set for if all the vertices of are pairwise resolved by a vertex of . A resolving set having the smallest possible cardinality in is called a metric basis. The cardinality of a metric basis is the metric dimension of , and denoted by .
Now, a basis forced vertex of a graph is understood as a vertex such that it belongs to every metric basis of . The term “basis forced vertex” was first used in [9], although it has some antecedents in the articles [1,2], where the graphs that have a unique metric basis were studied. From now on, we represent the number of basis forced vertices of by . Notice that we can have for many graphs. For example, a nontrivial path has . We also need the following concept from [9]. A vertex is a void vertex if it is in no metric basis of . It is easy to see that there are void vertices in a path of order ; indeed, all the vertices not in the beginning or in the end of the path are such.


(b)
Figure 1: (a) The graph G with the resolving set and (b) the colour graph .
denoted by . The cardinality of a set is denoted by . The notation means the order of a graph . We use as a shorthand notation for the edge .
Given a graph and a set , in [9], the colour graph of (with respect to ) is defined as follows. Let . We denote
In other words, the set consists of the pairs of vertices for which is the unique element in that resolves the pairs.
With this in mind, the graph has the vertex set and the edge set
Each is assigned a colour (or a label), and we colour the edges in given by with the colour associated with . Observe that the graph can be disconnected while is connected. Moreover, note that this graph might be constructed for any set of vertices , although for our purposes, we will require that such is a resolving set (or a metric basis). If there is no edge between and in , then there are at least two elements in a resolving set that resolve and . If is a metric basis of , then the graph has at least one edge of the colour associated with each . In other words, the set is nonempty for all .
For an example (see [9]), consider the graph illustrated in Figure 1(a) and its resolving set . For the colour graph , we first form the following sets: and . Then we obtain the colour graph , where and . In Figure 1(b) illustrating the colour graph , the edges corresponding to and are associated with black and “dashed” edges, respectively.
2 Properties of the Colour Graph and Bounds for the Metric Dimension
The colour graph regarding a resolving set in a graph plays an important role in the proofs of this paper. Therefore, we begin by giving some properties of the graph stated in the next technical lemmas. The results of the Lemma 1 are already known from [9], whereas the claims in Lemma 2 are new. In this section, we also provide (in Proposition 3) bounds on the metric dimension when there are basis forced vertices in . We will need these bounds for our main results in Sections 3 and 4.
Lemma 1 ([9]). Let G be a graph and let R be a resolving set of G. Then the following properties hold for .
(i) A colour that appears in a cycle of appears at least twice in that cycle.
(ii) Let . If the edges and have the same colour in , then the edge also has the same colour in .
(iii) If is a basis forced vertex of G and R is a metric basis of G, then the graph has at least two edges of the colour associated with b.
(iv) If is a basis forced vertex of G and R is a metric basis of G, then the graph has at least one edge xy, where , of the colour associated with b.
(v) The set of vertices R forms an independent set in .
(vi) If there is an edge in incident to , then the edge has the colour associated with .
Proof. The items (i)–(iv) are from Lemma 25 in [9] and the items (v)–(vi) are basic observations of the colour graph discussed at the beginning of Section 4 in [9].
We next show some new properties of the colour graph of a graph with respect to some resolving set or metric basis . If we replace a vertex in by a vertex (while keeping otherwise intact), then we denote the new set by . In other words,
Lemma 2. Let G be a graph and let R be a resolving set of G. Then the following properties hold for .
(i) If is a basis forced vertex of G and R is a metric basis of G, then the graph has at least two edges xy, where , of the colour associated with b.
(ii) If is a metric basis of and the only edge of the colour associated with in is of type , where , then is a metric basis of .
Proof. (i) Let us assume that is a basis forced vertex. By Lemma 1(iv) we know that there is at least one edge, say such that associated with the colour and, by Lemma 1(iii), there is also at least one more edge, say , of the same colour. If , we are done. Clearly, by Lemma 1(v), we cannot have , so it suffices to assume that . Moreover, by Lemma 1(vi). Next we consider separately two possible cases, namely, or .
Case 1: . If there is a third edge of colour , then it is enough to assume that it is where . However, in that case, by Lemma 1(ii) there exists an edge with and the claim follows. Hence, we may assume that and are the only edges of colour . The set cannot be a metric basis, since is a basis forced vertex which must be in every metric basis. Therefore, as the pair and is the only one that cannot be resolved with respect to (indeed, all the other pairs of vertices in apart from the pair and and the pair and were resolved by other elements of than ). Similarly, as (resp. ) cannot be a metric basis, we have (resp. ). These three distance equations imply together that . However, this is a contradiction, since was the (only) vertex resolving the vertices and , that is .
Case 2: . Without loss of generality, assume . Recall that by Lemma 1(ii) there is a third edge associated with the colour , namely, by in . If there is yet another
(fourth) edge of colour , then we can assume that it is where . Due to Lemma 1(ii), this implies that there is an edge with of colour , and we are done. Hence we may assume that we have only the three edges mentioned above. Because is a basis forced vertex, the set is not a metric basis and, hence, . Analogously, cannot be a metric basis. Hence, we obtain . Now we have , a contradiction, since resolves the pair and .
(ii) Let be a metric basis (when in only a resolving set, the claim follows by an analogous argument). Assume further that , and with is the only edge of colour associated with (clearly, is not a basis forced vertex). If we remove from , then the only pair of vertices that can have the same distances to all the elements of is and . But with respect to the set , they have different distances to . Therefore, the set is a metric basis in .
The next result shows that if we have basis forced vertices in a graph G, then there are some limitations for the metric dimension .
Proposition 3. If G is a graph such that , then .
Proof. Assume that is a graph with at least one basis forced vertex. Recall that paths are the only graphs with . Hence, as the paths do not have basis forced vertices, it immediately follows that . Let us look at the claim . Suppose to the contrary that (and ). Let be a metric basis of . By Lemma 2(i), for each basis forced vertex , there exist at least two edges associated with the colour in between vertices of . Hence, as otherwise at most one edge can occur in . Thus, and there are exactly three vertices, say , and , in . In addition, we know that there exists a unique basis forced vertex in , say . Indeed, if , then Lemma 2(i) would imply that .
By Lemma 2(i), there exist at least two edges associated with the colour in between the vertices of . Without loss of generality, we may assume that and are such edges. By Lemma 1(ii), this further implies that is also such an edge. Let be a vertex in . Since is a metric basis of , there exists at least one edge in associated with the colour . Due to the fact that the edges between , and are associated with the colour , the edges of the colour have to be of type , where due to claims (vi) and (v) in Lemma 1. Moreover, there exists exactly one such edge since otherwise a contradiction (with the fact that the edges between , and are coloured with ) follows by Lemma 1(ii). For each , we define
It is immediate that the sets , , and form a partition of . Furthermore, we have the following observations on :
(1) By Lemma 2(ii), the set is a metric basis for each .
(2) For each , we have as the vertices and are solely resolved by . Thus, the basis forced vertex has the same distance to all .
Since the vertices , and are resolved from each other by the vertex , we may without loss of generality assume that . Thus, based on the partition , , and , we have that , and . Hence, by the observation (2) above, it happens , and for all , and .
Let be a shortest path of length 3 from b to z. It is immediate that and ; note that and can be x and y, respectively. By the observation (1), is a resolving set of G. As above, we may deduce that the edges , and have colour b in . Moreover, in there exists exactly one edge of colour , namely, . Therefore, by the observation (1), is a metric basis of G. Now . Furthermore, is a metric basis of G since , and . However, this contradicts the fact that b is a basis forced vertex. Thus, the claim follows.
Notice that there exist graphs attaining the upper bound of the proposition. For example, the graph G of order 6 in Figure 1 satisfies and . In Section 5, we give a full characterization of the graphs with and .
3 The Main Bounds for the Maximum Number of Basis Forced Vertices
The main result of this section presents a bound for the number of basis forced vertices of a graph G in terms of the metric dimension and the order n of G (see Theorem 7). As a special case, another bound for such quantity is given only in terms of the order of G (see Corollary 8).
A cactus is a graph in which no two cycles share an edge. In what follows, we want to show that a cactus graph appears as a certain subgraph of the colour graph . To make the proof of Lemma 5 simpler, we present the following lemma, the proof of which is based on an iterative idea with an algorithmic flavour. The lemma shows that given a graph with two cycles sharing an edge, we can obtain a pair of cycles such that their intersection is a path (forming a so called theta graph). Recall that we define cycle as a closed walk with no repeated vertices. In the next lemma, we use the term simple cycle to emphasise the fact that cycles have no repeated vertices. Moreover, we “abuse” the notation and use the intersection notation of two cycles (as subgraphs) to represent the subgraph induced by the vertices of the intersection .
Lemma 4. Let be a graph and let and be simple cycles in . If contains at least one edge, then there exist a third cycle in such that is a nontrivial path (a path of length at least 2).
Proof. If the intersection is a nontrivial path, then we are done. Otherwise contains two or more connected components. We denote the vertices of by starting from the beginning of a section that shares with , or more formally, and . Such edges exist because and share at least one edge and they are distinct cycles. We use the notation to denote the path from to in which the vertices are in ascending order with respect to their indices. The notation is just the vertex . The concatenation of paths and is denoted naturally by .


(b)
Figure 2: The cycles and can intersect in essentially two different ways. The cycle is drawn with a dashed line. The lines represent nontrivial paths (not necessarily edges), with the exception of the line from to if .
Let be the largest index such that the path is contained in . Let be the smallest index and the largest index such that the path is contained in . In other words, the paths and are the first two connected components that the cycles and have in common with respect to the numbering of the vertices of . Notice that it is possible that . The vertices (if there are any) are not in the cycle .
We number the vertices of so that the numbering satisfies , , ..., . The rest of the vertices along are then numbered in order. Then we define the notation analogously to .
The choice of a new cycle depends on how the shared paths and are arranged in .
Case 1: If the vertex appears before in the numbering of , or if (see Figure 2(a)), we choose
Case 2: If the vertex appears after in the numbering of (see Figure 2(b)), we choose
Let us observe that the closed walk is a simple cycle in both cases. Indeed, there are no repeated vertices in the sections of the form because is a simple cycle. By the choice of and , the path does not intersect in vertices other than its endpoints.
In both cases, the intersection has at least one fewer connected component than does. The disconnected paths and are replaced by one (nontrivial) path, (in Case 1) or (in Case 2). In addition, the path (or ) may intersect with in vertices other than the endpoints (see Figure 2(a)). Such intersecting sections are absent from .
If the intersection of and is a nontrivial path, then the cycle satisfies the claim. If not, then we repeat the procedure described above for and with the same numbering of , and (or ) in the role of . After a finite number of iterations, we obtain a cycle that satisfies the claim.
From now on, given a graph and a resolving set of , we will consider a subgraph of that will be “conveniently chosen” for our purposes. We consider a subgraph of the colour graph defined as follows. The vertex set of is and the edge set is a (possibly not proper) subset of satisfying that there are either 0 or 2 edges of each colour in , i.e., there are either 0 or 2 edges of each color in .
Despite the fact that several possible configurations for such subgraph of could exist, we next show that the connected components of each are bipartite cacti.
Lemma 5. Let be a graph and let be a resolving set of . Then the following claims follow for .
(i) The graph is bipartite.
(ii) The connected components of are cacti.
Proof. (i) Since is a subgraph of , if is a cycle in , then it is also a cycle in . By Lemma 1(i), a colour that appears in a cycle of appears at least twice in that cycle. Hence, by the choice of edges of , a colour that appears in a cycle of , appears exactly twice in that cycle. Therefore, as all edges have a colour, all cycles in have even length. It is well known that this implies that is bipartite.
(ii) Suppose to the contrary that is not composed of cacti, in other words, that there exist cycles in that have edges in common. By Lemma 4, we may assume that and are cycles such that their intersection is a path, denoted . Now consider any colour that appears on . Clearly (as shown above), such colour must appear exactly twice in the cycle , by the choice of the edges of . If appears in , then is a cycle in which appears only once, a contradiction. Therefore, the second occurrence of must be in as well.
Denote the vertices of by so that vertices and are adjacent (with the notation that ) and assume that where . Now consider the sequence of distances for some . A difference in consecutive distances and (say, ) corresponds to an -coloured edge in . If consecutive distances are equal, the corresponding edge in has a colour other than . By the choice of the edges of , there can be at most two indices and where consecutive distances differ. Since the first and last elements of the sequence are equal, we must have and for some .
For colours that do not appear in , we have . For colours that do appear in , we have , since appears twice in . Now the distinct vertices and have for all , contradicting the assumption that is a resolving set of . Therefore, cycles in do not have edges in common, in other words, is composed of cacti.
The following result regarding the largest number of edges in a graph whose components are bipartite cacti shall be needed.
Lemma 6 ([12, Lemma 2]). If is a bipartite graph with such that all of its connected components are cacti, then .
With the tools above in hand, we are then able to present our main theorem. By the notation we mean the graph induced by the vertices of not including the set .
Theorem 7. Let G be a graph of order n with . Then
Proof. Let be a metric basis of . Let be a subgraph of (as previously described) with vertices and for the edges of , we select two edges of with the colour for each basis forced vertex . Indeed, at least two such edges exist in by Lemma 2(i) for each basis forced vertex. By definition, and . Since we assumed that , Proposition 3 gives us that , and consequently, . By Lemma 5, the graph is bipartite and its connected components are cacti. We can now use Lemma 6 to get
which completes the proof.
In [1], Bagheri et al. studied those graphs with a unique metric basis, that is, graphs G satisfying . Among other results, they showed that for any even there exists a graph G such that , where n denotes the order of G. Furthermore, they stated as an open question whether the metric dimension could be larger with respect to n. In the following corollary, we answer the question by stating that this is not possible.
Corollary 8. Let G be a graph of order n. Then
Moreover, if and or , then has a unique metric basis.
Proof. The first result follows immediately by the bound of Theorem 7, due to the fact that . Based on Theorem 7, we further obtain that . Therefore, assuming and denoting by , we have
The proof now divides into different cases based on the remainder of when divided by 5. The lower and upper bounds in these cases are given in Table 1. Thus, by the table, we obtain that if or , then and has a unique metric basis.
Recall that if and or , then (and has a unique metric basis). However, this is not the case for or . By Table 1, we observe that the following values are possible for : if or , then , and for . Later, in Theorem 12, it will be shown that all these values can be realized, i.e., there exist graphs for all the possible combinations of and . For example, if , then (using the notation introduced in the proof of Theorem 12) each of the graphs , , and has vertices of which are basis forced, and their metric dimensions are , , and , respectively.
| n | ||
|---|---|---|
| 5q | 2q-1 | 2q |
| 5q+1 | 2q | 2q |
| 5q+2 | 2q | 2q+1 |
| 5q+3 | 2q | 2q+2 |
| 5q+4 | 2q+1 | 2q+1 |
Table 1: The upper and lower bounds on of Inequality (2) given for different remainders when divided by 5.
4 Realization of Possible Parameters
In the previous sections, we have considered the relations between , and . In particular, we obtained the following lower and upper bounds for :
-
If , then by Proposition 3.
-
If , then by Theorem 7.
In what follows, we show that achieves all the values indicated by the previous inequalities.
We build a graph step by step, first establishing the basis forced vertices, then building up the metric dimension, and finally, adding a path to reach the desired number of vertices. In the construction, we need the concept of a universal vertex, which is a vertex that is adjacent to all other vertices of the graph. For the realization, we borrow two graphs from Bagheri et al. [1] and Buczkowski et al. [2], illustrated in Figure 3. Formally, we define the graph , where and
The graph has a unique metric basis (as shown in [2]). Consequently, the vertices and are basis forced vertices. The vertex is universal.
Then, we define , where and
The graph has a unique metric basis (as shown in [1]). Consequently, the vertices and are basis forced vertices. The vertex is universal. The graphs and have a maximum number of basis forced vertices with respect to the order of the graph, meeting the bound of Corollary 8.
The following iterative construction can be used to obtain a graph with any number of basis forced vertices ( ).
Lemma 9 ( [1, Theorem 7]). Let and be graphs with unique metric bases and , respectively. Let and be universal vertices, i.e., vertices of degree , in their respective graphs. Then the graph , where and
has a unique metric basis . In addition, the vertex is a universal vertex in .

(a) A graph on 6 vertices with 2 basis forced vertices.

(b) A graph on 9 vertices with 3 basis forced vertices.
Figure 3
Notice that we may use Lemma 9 repeatedly to join any number of graphs that have a universal vertex and a unique metric basis. If the target number of basis forced vertices is odd, then we take one copy of the graph and copies of the graph and join them by identifying their universal vertices. If is even, then we join copies of the graph in a similar manner. A graph constructed in this way meets the upper bound of Corollary 8.
To increase the metric dimension of a graph with a universal vertex and a unique metric basis, we duplicate the universal vertex to obtain a sufficiently large set of twin vertices.
Lemma 10. Let be a graph with a unique metric basis and a universal vertex . We define a graph with and
In other words, we add universal vertices. Then has metric dimension and its metric bases are , where and .
Proof. By [9, Lemma 17], we know that universal vertices are never forced. Since is the only metric basis of , we know that . Next, we observe that adding another universal vertex does not change the distances in a graph; in other words, for all pairs of vertices . Since a universal vertex has distance 1 to all vertices other than itself, it cannot resolve pairs that do not contain . The sets are resolving sets of for all and therefore, .
Let be a metric basis of . Since the vertices are twins, at least of them must be in . Let us first assume that all the vertices are in . Then the set is a resolving set of with vertices, since no pair of vertices in is resolved by the universal vertices . We established that , or equivalently, , and hence, is a metric basis of . However, we assumed that has a unique metric basis , which does not contain , and since , we reached a contradiction.
Let us now assume that exactly of the vertices are in , and denote , where . Next, we argue that the set is a resolving set of with vertices. For this purpose, notice that for all there exists a vertex such that . Due to the fact that all vertices of are universal, we obtain that . Therefore, we also have . Furthermore, it is immediate that distinct vertices and are resolved by . Thus,

(a) The graph is within the dotted line. The graph is obtained by attaching a path to .

(b) The graph , with . The edges from the universal vertices are omitted for illustrative purposes.
Figure 4: Sketches of the constructions. The black vertices are basis forced and the gray vertices are in some but not all metric bases.
is a resolving set of . We established that , or equivalently, , and hence, is a metric basis of . We assumed that has only one metric basis, namely , so it must be that . Therefore, the metric bases of are , where .
Notice that the vertices in the unique metric basis remain basis forced in the new graph .
Finally, with and fixed, we need to adjust . We do this by attaching a path of suitable length to a vertex in such a way that the number of basis forced vertices and the metric dimension of the graph does not change.
Theorem 11 ([10, Theorem 2]). Let be a connected graph, and let be the set of basis forced vertices of . Let , and let be such that . Let be the path . Let be the graph with and . Then, is also the set of basis forced vertices of and .
With the tools above, we can prove the following theorem, which discusses the possible values of the parameters , and .
Theorem 12. Let f, k and n be positive integers.
• If , then for each there exists a graph such that , and .
• If , then for each there exists a graph such that , and .
Proof. We will provide a method to construct a graph with the desired values of , and .
First, we consider the case . By Proposition 3, we know that . Consider the graph illustrated in Figure 4(a), where . Since the vertices in are twins, a metric basis must contain at least of them. The set is not a resolving set for any since the vertices and are not resolved. It follows that . It is easy to verify that is a resolving set of
for all . The sets , and are not resolving sets for any choice of or since the pairs , and are not resolved, respectively. Therefore, , the vertex is basis forced, and the vertex is not basis forced and has . Choosing , and attaching a path of length to the vertex , we get the graph with vertices (see Figure 4(a)). By Theorem 11, the graph has the same metric dimension and basis forced vertices as , and therefore, the graph has metric dimension and one basis forced vertex (namely, ). We assumed that and, naturally, that . Hence, when and are chosen as defined, this construction realizes the values of and such that and .
Now assume that . If is odd, then and) we take one copy of the graph and copies of the graph and join them by identifying their universal vertices. (Note that if , then there are no copies of in the graph.) If is even, then we join copies of the graph in a similar manner. Let us call the universal vertex of the resulting graph . So far, our graph has vertices if is odd and vertices if is even; to simplify the notation ahead, we denote this number of vertices by . By Lemma 9, the basis forced vertices of the joined graphs form the unique metric basis of the resulting graph and there are of them.
Next, we duplicate the universal vertex in the spirit of Lemma 10 times. The metric dimension of our graph is now . Finally, we attach a path of vertices to some vertex in a copy of (or , in case and there are no copies of ), resulting in a graph denoted by . Theorem 11 guarantees that the graph has metric dimension and that the basis forced vertices remain basis forced.
Choosing and gives us the graph with vertices, , and . The construction requires that and . The choices of and are possible if and only if and , or equivalently, when . When we substitute and for (depending on the parity of ), we get the upper bounds and , which can be combined into , as claimed.
5 A Characterization of Graphs With Two Basis Forced Vertices and
In this section, we consider the graphs containing exactly two basis forced vertices with metric dimension . We searched for small such graphs with a computer and found out that the smallest among them have six vertices. Through an exhaustive search of graphs of order 6 (based on the data available on Brendan McKay's website [14]), we were able to establish that the graphs , and in Figure 5 are the only graphs with , and two basis forced vertices.
Let be a graph family defined as follows. A graph if either is the graph from Figure 5, or contains a clique and the vertices of the clique can be partitioned into four nonempty sets , satisfying the following two properties: (i) the two vertices and that are not in the clique are such that is adjacent to the vertices in but not to the vertices in , and is adjacent to the vertices in but not to the vertices in ; (ii) the vertices and may or may not be adjacent to each other (see Figure 6 for a representative example of a graph in ). The graphs and from with


(b)

Figure 5: The smallest graphs with and two basis forced vertices (illustrated in black).

Figure 6: An example graph G from the family F.
the smallest order are given in Figure 5. We next give the characterization of graphs with and .
Theorem 13. Let be a connected graph with . Then and contains two basis forced vertices if and only if . Moreover, the two basis forced vertices of are and , as denoted in the definition of the family .
Proof. For the purposes of this proof, we define a distance-2 partition of a graph with respect to two vertices x and y as follows. The sets , , and form a distance-2 partition of G with respect to x and y if
•
• for all ,
• if , then and .
Observation 1: If can be distance-2 partitioned with respect to two vertices and , then any set where , , and is a resolving set of .
Proof of Observation 1: All vertices in are clearly resolved from all other vertices in . The vertices and are all in different partition sets, and thus and resolve them from each other. Therefore, is a resolving set of . ()
We next proceed to show both implications in our result.
(⇔) Assume that . We will prove that and that contains two basis forced vertices, which indeed are the vertices and from the definition of the graph .
If , then the claim holds according to an exhaustive computer search (the only metric basis of this graph is in Figure 5(c)).

Figure 7: The colour graph .
Assume that and let be a metric basis of . Since can clearly be distance-2 partitioned with respect to (the vertices used in the definition of ), we have due to Observation 1, and thus . The vertices within each partition set are twins, and thus at most one vertex from each set is not in . Suppose that . If also , then all elements of are within the clique . Since , there are two vertices in the clique that are not in . However, these vertices are not resolved from each other by any vertex of , a contradiction. Thus, we can assume that . Since , the sets and both contain a vertex that is not in or the sets and both contain a vertex that is not in . This pair is not resolved by due to being either adjacent to or at distance 2 from both of them. Neither is this pair resolved by any vertex in that is in the clique , since the pair is also included in the same clique. Thus, there is a pair of vertices that does not resolve, a contradiction. Hence, (and by similar arguments). Since each partition set contains at most one vertex that is not in , we now have . Therefore, . Moreover, observe that any metric basis of is formed by vertices from the clique , together with the two vertices , which are hence basis forced vertices of , which completes the proof of this implication.
( ) Let G be a graph with and such that it contains two basis forced vertices and .
Claim 1: G can be distance-2 partitioned with respect to and .
Proof of Claim 1: Let be a metric basis of . Consider the graph . Due to the case (i) of Lemma 2 and the cases (i) and (ii) of Lemma 1, we obtain that where the labels and alternate. Let us denote and let the edges of the aforementioned be , , and where and have the label and and have the label (see Figure 7). Notice that the edges and do not appear in as the corresponding pairs of vertices are resolved by both and . Hence, for each (if such a vertex exists), there is exactly one edge of label in , namely the edge where (due to Lemma 1 (ii)).
Let us consider the distances from to the vertices not in R. Since the edge has the label in , the only vertex in R that resolves and is . In particular, this means that . Similarly, since the edge has the label in , we have . The edges and have, however, the label , which means that and . Therefore, the vertices not in can be partitioned into two sets and where vertices in the same set are at the same distance from but vertices in different sets are at different distances from .
Let us then consider the distances from to the vertices in . As stated before, the only edge with the label in where is of the form where . This means that the vertex is the only vertex in that resolves and , and thus . By combining this with the partition of the vertices not in , we obtain the following partition for :
We will then consider the exact distances from to the partition sets and . Consider the vertices and . One of the partition sets is closer to than the other. Let us assume without loss of generality that . We will prove that now and .
Suppose to the contrary that . The (unique) shortest path from to is now necessarily since all other vertices in the graph are at equal or greater distance from compared to . Now and, since the edge has label in , also . This implies that the path is also present in , which contradicts the fact that . Therefore, and consequently for all .
Suppose then that . Since the vertices in are all at distance 1 from , a shortest path from to is of the form , where . Recall that . Now there is a shortest path , where . Thus, both and are at distance 1 from . However, the edge has the label in , and thus , a contradiction. Therefore, and consequently for all .
Thus, the partition sets and are simply the vertices at distance 1 and 2 (respectively) from .
A similar partitioning can be done with respect to . By similar arguments as for , we can partition into and where
Notice that now and (and and ) are in different partition sets. Without loss of generality, the set is closer to than . By similar arguments as for and , the vertices in are at distance 1 from and the vertices in are at distance 2 from .
By combining the two partitions, we obtain a distance-2 partition where , , and . Notice that each of the sets , , and is nonempty since , , and . ( )
Thus, we will consider the distance-2 partition of G with respect to and for the remainder of the proof.
Claim 2: If for some , then each is adjacent to all vertices in .
Proof of Claim 2: Since , the set , where , is a metric basis of due to Observation 1. Let be a partition set such that . Now contains an element of , say, . Due to the labels of the edges in the cycle in , we have
According to Observation 1, we can choose the vertices , , and to be any vertices in their respective partition sets. Therefore, the vertex is adjacent to either all or none of the vertices in . (The freeness of the choice of also implies that the vertices in are twins.)
Suppose that is not adjacent to any vertices in . Since is connected, we have . If , then is a leaf and is a cut-vertex. However, in [9] Corollary 7, it was shown that any finite graph has a metric basis that does not contain any cut-vertices. Thus, the cut-vertex cannot be a basis forced vertex, a contradiction. Similarly, if , then is a cut-vertex, a contradiction. Thus, suppose that . Now , but which is a contradiction with (3). Therefore, the vertex is adjacent to all vertices in and the claim follows from the free choice of (or the vertices in being twins). Notice that now the vertices in are true twins. (◇)
Claim 3: .
Proof of Claim 3: When n = 6, the claim holds according to an exhaustive computer search.
Let . Now there exists a such that . Let be the graph we obtain from by removing a vertex from a partition set such that (recall that the vertices in are true twins by Claim 2, so it does not matter which vertex we remove). The distances between vertices in are exactly the same as the distances between the corresponding vertices in , and thus if is a metric basis of , then is a resolving set of . Conversely, if is a metric basis of , then is a resolving set of . Therefore, and and are basis forced vertices also in , as otherwise we would obtain a metric basis in such that or (or both) were not included in it. Let be the graph we obtain from when we repeat the vertex removal until there is exactly one vertex left in each partition set. By the arguments above, it must happen that , , and has two basis forced vertices and . Since , it must be that is one of , or , and so, . If or , then clearly , by the constructive arguments used.
Suppose that . Now and are adjacent in and the partition sets and in must have only one element each due to Claim 2. Let us then consider the graph that we obtain by repeating the same vertex removal process as above until we are left with a graph on seven vertices for which a next vertex removal would lead to the graph . Now, without loss of generality, we can assume that the partition sets in are such that and otherwise. Thus, is as depicted in Figure 8. By the arguments above, the graph should have two basis forced vertices. However, has two disjoint metric bases (which are illustrated in Figure 8) and thus no basis forced vertices, a contradiction. Therefore, . ( )
To end the proof, we only need to remark that the arguments above allow to confirm that the two basis forced vertices and play the roles of u and v as defined in the graphs of the family F.

Figure 8: The graph with two disjoint metric bases illustrated as black and gray vertices.
6 Concluding remarks
We close our exposition with the following open questions that, in our opinion, might be of interest to continue this investigation.
-
It would be desirable to characterize (even at least partially) all the graphs G for which . Specifically, the cases and would be of interest.
-
In the light of Theorem 13, it would be interesting to characterize graphs with different metric dimensions and number of basis forced vertices.
-
In view of Theorem 7, if , then G must also have at most two basis forced vertices. In this sense, a weaker version of the item above concerns finding the graphs G of order n with metric dimension and one or two basis forced vertices.
Acknowledgements
Ville Junnila, Tero Laihonen and Havu Miikonen have been partially supported by Research Council of Finland grant number 338797. Ismael G. Yero has been partially supported by the Spanish Ministry of Science and Innovation through the grant PID2023-146643NB-I00.
References
[1] B. Bagheri Gh., M. Jannesari, and B. Omoomi. Unique basis graphs. Ars Comb., 129:249–259, 2016.
[2] P. S. Buczkowski, G. Chartrand, C. Poisson, and P. Zhang. On k-dimensional graphs and their bases. Period. Math. Hung., 46:9–15, 2003. doi: 10.1023/A:1025745406160
[3] G. Chartrand, L. Eroh, M. A. Johnson, and O. R. Oellermann. Resolvability in graphs and the metric dimension of a graph. Discrete Appl. Math., 105:99–113, 2000. doi:10.1016/S0166-218X(00)00198-0
[4] M. Claverol, A. García, G. Hernández, C. Hernando, M. Maureso, M. Mora, and J. Tejel. Metric dimension of maximal outerplanar graphs. Bull. Malays. Math. Sci. Soc., 44:2603–2630, 2021. doi: 10.1007/s40840-020-01068-6
[5] B. Foster-Greenwood, Ch. Uhl. Metric dimension of a direct product of three complete graphs. Electron. J. Combin., 31:Paper No. 2.13, 2024. doi: 10.37236/12399
[6] A. Hakanen, V. Junnila, and T. Laihonen. The solid-metric dimension. Theor. Comput. Sci., 806:156–170, 2020. doi: 10.1016/j.tcs.2019.02.013
[7] A. Hakanen, V. Junnila, T. Laihonen, H. Miikonen, and I. G. Yero. On a tight bound for the maximum number of vertices that belong to every metric basis. In the proceedings of CALDAM 2025, Lecture Notes in Comput. Sci., 15536:173–184, 2025. doi: 10.1007/978-3-031-83438-7_15
[8] A. Hakanen, V. Junnila, T. Laihonen, and M. L. Puertas. On the metric dimensions for sets of vertices. Discuss. Math. Graph Theory, 43(1):245–275, 2023. doi: 10.7151/dmgt.2367
[9] A. Hakanen, V. Junnila, T. Laihonen, and I. G. Yero. On vertices contained in all or in no metric basis. Discrete Appl. Math., 319:407–423, 2022. doi: 10.1016/j.dam.2021.12.004
[10] A. Hakanen, V. Junnila, T. Laihonen, and I. G. Yero. On the unicyclic graphs having vertices that belong to all their (strong) metric bases. Discrete Appl. Math., 353:191–207, 2024. doi: 10.1016/j.dam.2024.04.020
[11] F. Harary and R. Melter. On the metric dimension of a graph. Ars Combin., 2:191–195, 1976.
[12] C. Hernando, M. Mora, and I. M. Pelayo. Locating domination in bipartite graphs and their complements. Discrete Appl. Math., 263:195–203, 2019. doi: 10.1016/j.dam.2018.09.034
[13] S. Mashkaria, G. Ódor, and P. Thiran. On the robustness of the metric dimension of grid graphs to adding a single edge. Discrete Appl. Math., 316:1–27, 2022 doi: 10.1016/j.dam.2022.02.014
[14] B. McKay. Combinatorial Data. https://users.cecs.anu.edu.au/~bdm/data/graphs.html. Accessed: 2025-03-14.
[15] J. Sedlar and R. Škrekovski. Bounds on metric dimensions of graphs with edge disjoint cycles. Appl. Math. Comput., 396:125908, 2021. doi: 10.1016/j.amc.2020.125908.
[16] J. Sedlar and R. Škrekovski. Metric dimensions vs. cyclomatic number of graphs with minimum degree at least two. Appl. Math. Comput., 427:127147, 2022. doi: 10.1016/j.amc.2022.127147
[17] J. Sedlar and R. Škrekovski. Vertex and edge metric dimensions of unicyclic graphs. Discrete Appl. Math., 314:81–92, 2022. doi: 10.1016/j.dam.2022.02.022
[18] P. J. Slater. Leaves of trees. Congr. Numer., 14:549–559, 1975.
[19] R. C. Tillquist and M. E. Lladser. Low-dimensional representation of genomic sequences. J. Math. Biol., 79:1–29, 2019. doi: 10.1007/s00285-019-01348-1
[20] R. C. Tillquist, R. M. Frongillo, and M. E. Lladser, Getting the lay of the land in discrete space: A survey of metric dimension and its applications, SIAM Rev., 65(4):919–962, 2023. doi: 10.1137/21M1409512
[21] J. Wang, F. Tian, Y. Liu, J. Pang and L. Miao. On graphs of order n with metric dimension n-4. Graphs Combin., 39:Paper No. 29, 2023. doi: 10.1007/s00373-023-02627-x
[22] J. Wu, L. Wang, and W. Yang. Learning to compute the metric dimension of graphs. Appl. Math. Comput., 432:127350, 2022. doi: 10.1016/j.amc.2022.127350