Abstract
The distance between two vertices of a simple connected graph G, denoted as , is the length of the shortest path from u to v and is always symmetrical. An ordered subset of is a resolving set for G, if for ∀, there exists ∋ . A resolving set with minimal cardinality is called the metric basis. The metric dimension of G is the cardinality of metric basis of G and is denoted as . For the graph and , their join is denoted by . The vertex set of is and the edge set is . In this article, we show that the metric dimension of the join of two path graphs is unbounded because of its dependence on the size of the paths. We also provide a general formula to determine this metric dimension. We also develop algorithms to obtain metric dimensions and a metric basis for the join of path graphs, with respect to its symmetries.
MSC:
05C35; 05C12; 05C99
1. Introduction
The study of metric dimension, , was first initiated by Slater and Peter [1,2]. They were studying the problem of determining the exact location of an intruder in a network. They used the terms “locating set” and “location number” to define their concepts. Independently, Hararay and Melter [3] studied the same concepts and used the term “metric dimension”. They calculated the metric dimensions of trees and grid graphs and gave a characterization of graphs with small metric dimensions.
In this article, we use the terminology developed by Hararay and Melter. The metric dimension is defined to be the cardinality of the smallest “resolving set” [3]. Chartrand et al. [4] used the term “metric basis” for the smallest resolving set. An ordered subset is a metric basis for a simple graph G, and then the k-vector, , is termed as the representation of the vertex v with respect to the ordered subset W and is denoted as .
The concept of metric dimension in graphs has drawn a lot of interest from researchers. Chartrand et al. [4] calculated the metric dimensions of trees and unicyclic graphs. They also gave the characterization of graphs with metric dimensions 1, and . Klien and Yi [5] studied the metric dimensions of para-line graphs. They also compared the metric dimensions of graphs, line graphs and para-line graphs. Ahmed et al. [6] calculated the exact values for the metric dimensions of the kayak paddles graph. They also calculated the metric dimensions of cycles with a chord. Sedlar and Skrekovski [7] showed that the vertex and edge metric dimensions of unicyclic graphs obtain values from two particular consecutive integers, which can be determined from the structure of the graph. Abrishami et al. [8] calculated the local metric dimensions for graphs having small clique numbers. Hayat et al. [9] determined the exact values of metric dimensions of multi-partite graphs, effectively generalizing the already established results of bipartite graphs. For further studies on metric dimensions, we refer the reader to [10,11,12,13,14,15,16,17,18] and the references therein.
The metric basis and metric dimensions have also been studied under numerous graph operations. Cáceres et al. [19] studied the metric dimensions of the Cartesian product of graphs. They established that there is a family of graphs G with bounded metric dimensions such that the metric dimension of is unbounded. Jiang and Polyanskii [20] showed that the metric dimensions of the Cartesian product of n copies of G of order q, is . Fehr et al. [21] studied the metric dimensions of Cayley digraphs. Nazeer et al. [22] calculated the metric dimensions of path-related graphs for applications in network optimization. Eroh et al. [23] studied the effect on metric dimensions of a graph G when a vertex and/or edge is deleted from G. Sebő et al. [24] used the concept of metric dimensions, strong metric generators and isometric embedding to show that the existence of connected joins of graphs can be solved in polynomial time.
Metric dimensions of graphs have applications in robot navigation and drug discovery [4], combinatorial optimization [24] and strategies for the mastermind game [25]. It was observed by Khuller et al. in [26] that the metric dimension of an arbitrary n-vertex graph may be approximated in polynomial time. An obvious question is, can we reduce this calculation time for some special types of graphs? In this article, we try to answer this for the join of two path graphs.
1.1. Motivation
Metric dimension of the join of two graphs was studied by Shahida and Sunitha [27]. They considered two paths of lengths m and n and showed that
If we consider and , then by Equation (1), . Let us assume that the vertices are labelled as ; then it is an easy exercise to show that the set is a resolving set for , implying that .
Rawat and Pradhan [28] improved the results of Shahida and Sunitha and calculated that
Let us now consider and . Then, by Equation (2), . Again, assuming that the vertices are labeled as , one can easily see that the set is a resolving set for . One can also verify that the above result does not hold whenever or .
The above discussion shows that there is an obvious vacuum in the literature for the calculation of metric dimension of join of two path graphs. Haryanto et al. [29] tried to fill this gap and calculated the metric dimensions of . The question of is still open when .
The present study was aimed at calculating the metric dimensions of for all values of m and n. This enabled the calculation of in constant time. We also provide an algorithm of complexity to calculate the metric bases for . Since the joining of graphs is a symmetric operation, we can see that is siomorphic to .
1.2. Preliminaries
Let be a simple, connected and undirected graph. The number of vertices in a graph is said to be the order of the graph. The distance between two vertices of a graph G, denoted by , is the length of the shortest path between them. It is clear that , since the distance is always symmetrical. The representation of a vertex with respect to an ordered set , denoted by , is the k-tuple . We say that resolves the graph G, if for any two vertices , there exists at least one such that ; equivalently, W resolves G if for any two vertices , we have, . A resolving set W of minimum cardinality is called the metric basis for the graph G, and is the metric dimension of G.
Let and be simple, connected and non-trivial graphs. The join of these graphs, , is a graph with and From the definition of a join of graphs, we see that the join operation is a symmetric operation. We can also easily conclude that whenever .
Two graphs G and H are said to be isomorphic, denoted as , if there exists a bijection, , such that in G if and only if in H.
In what follows, for simplicity we will write to represent the union of a set and a single vertex.
2. Metric Dimension of the Join of Two Path Graphs
In this section we study the resolving set of the join of two path graphs. Let and be paths of order s and t respectively; then, the join of these two paths is as given in the following.
Note that for , if or (equivalently ), and otherwise. On the other hand, , we have . We also consider , whenever n is considered as an order of this graph. These concepts can be clarified from Figure 1. The join operation for graphs is a symmetric operation since , and
Figure 1.
Join of and .
We provide a concrete short example of the symmetry at work in this operation.
Example 1. 
Let us consider the joins and when and . Their figure is provided below.

Let us define a mapping , where , , , , , , and .
It can be easily verified that under the mapping Φ. This ensures that and are the same graph with respect to their symmetry. It can also be concluded that if a set W is a resolving set for , then is a resolving set for , owing to the symmetry between them.
We now move on to state and prove our results for this section.
Theorem 1.
For and
Proof.
For this proof, we will discuss all the cases of s and t separately. Note that the vertices are labeled as .
Case 1.
When . For and 2, the results are obvious, since and . We discuss the remaining cases of t in the following.
- [a.]
- : From Equation (1), . Let ; then, and , ‘indicating that is a resolving set for . Let us consider the set . In that case, , and if we consider the set , we can see that , implying that these two sets do not resolve , and hence .In the remaining cases, we only show that a resolving set of stated cardinality exists. These resolving sets are very small and well structured, and it can be easily shown that a smaller resolving set does not exist. We will omit this part of the proof from all other cases.
Case 2.
When . For and 2, the results are again obvious, since and . Following the same pattern as above, we discuss the remaining cases of t as follows.
Case 3.
When . When , we obtain , which is isomophic to , and the result follows from Case 1.a. Similarly, when , we have , and the result follows from Case 2.a. The remaining cases for different values of t are given in the following.
Case 4.
When . When , we obtain , which is isomophic to , and the result follows from Case 1.d. Similarly when , we have (Case 2.d), and when , we have , and is the same as in Case 3.d.
Theorem 2.
When and ; then,
Proof.
We again discuss this for all cases of s and t seperately.
Case 1.
When . When , we obtain , which is isomophic to , and the result follows from Theorem 3.1 Case 1.b. Similarly, when , we have (Theorem 1, Case 2.b), and gives (Theorem 1, Case 3.b).
Case 2.
When . When , we obtain , which is isomophic to , and the result follows from Theorem 1, Case 1.c. Similarly, when , we have (Theorem 1, Case 2.c); when , we have (Theorem 1, Case 3.c); when , we obtain (Same Theorem, Case 1.b); and when , we have (Theorem 1, Case 4.b).
- [a.]
- , by Equation (6), . Let ; then, , , , , and , implying □
We now move on to when and . Before proceeding further, we define some new notation and concepts which will be used later on.
Let and , where . The term is used for the remainder, when is divided by 5. Using these concepts, we partition the vertex set of from Figure 1 as follows:
We also partition the vertex set of from Figure 1 along the same lines. This partition is given in the following:
From the definition of , we can easily deduce certain properties which will be helpful later on. We provide them in the following.
- (I)
- When , we obtain . This gives , implying, for .
- (II)
- For , for .
- (III)
- When , we obtain ⇒.
- (IV)
- When , and .
- (V)
- When , and .
Similarly, for the partitions , we list the following properties.
- (VI)
- Since , for .
- (VII)
- When , .
- (VIII)
- When , and .
- (IX)
- When , and .
We also claim that . To realize this, we proceed as follows.
Since , . Now
Next, we investigate the last vertex of , i.e., , when . Now,
Hence, .
It is worthwhile to mention here that, at the end of this article, we provide an algorithm based on our results. The loops counters in the algorithm work in such a way that the above-stated properties of and are handled inherently, and the end user does not need to worry about these finer points of mathematics.
Armed with this knowledge, we now proceed to state and prove the main result of this article.
Theorem 3.
For and (or vice versa), the metric dimension of is
Proof.
This proof is completed in two parts. In part 1, we establish that we can in fact generate a resolving set W of of the above cardinality. In part 2, we show that there does not exist any resolving set of having fewer vertices than W.
Part I
Let . Here, and and and , where and are defined as:
It is easy to calculate that . We will prove that the set W, generated above, is indeed a resolving set for . For this, we will show that, for any pair of distinct vertices , there exists , such that .
Let , ; then, without loss of generality, , since otherwise, we can just rename the indices to obtain the same. We only consider the case when . From the fact that , it is obvious that enjoys any one of the following forms:
- (1)
- ; equivalently;
- (2)
- ; equivalently;
- (3)
- ; equivalently;
- (4)
- ; equivalently;
- (5)
- ; equivalently;
- (6)
- ; equivalently;
- (7)
- ; equivalently;
- (8)
- ; equivalently;
It should be noted that ensures that also adheres to the above given forms, and since , we will use the index to denote different forms of .
The proof is divided into different cases. The proof for every case follows a set pattern, wherein for every , we find , such that . This ensures that the representations .
Case 1.
When , since , can assume any one of the forms (1) to (4). We discuss all these cases separately.
- [a.]
- Suppose that is of the form as given in (1); then, . Let us take ; then, .Given that , it can assume any of the forms (1) to (4). For all of them, it is given that , and we will be using this information to solve all four cases of in one go. We will not be repeating this information in all the other cases, but it is inherently present in there.Now , and since , we obtain .
- [b.]
- Let be of the form given in (2); then, .Now, if , then by letting , we obtain . Since and , we obtain . Again, ⇒, while .If , then defining w as above gives us . For this case, let . From the structure of , it is clear that , while . Hence, , while .
- [c.]
- If is of the form given in (3), then . Let . Now . Again, since and , we obtain , giving us .
- [d.]
- If is of the form given in (4), then . Let . We obtain . It is again an easy task to show that for all and .
Case 2.
When , following the same proof techniques as in Case 1, it can be easily shown that there always exists a , belonging to , such that .
Case 3.
When and :
- [a.]
- Let be of the form as given in (1); then, . From here, we obtain that .When s is odd, .When s is even, .Let us consider the set ; then, . The above argument ensures that the smallest element of the set is . Let ; then, , since if s is odd, and if s is even.On the other hand, since , , since .
- [b.]
- Let be of the form given in (2); then, . Let ; then, by construction of , we obtain and for all .
- [c.]
- If is of the form given in (3); then, . Let for some specific . Let such that . Consider the vertex . Since , , giving us and for all .
- [d.]
- If is of the form given in (4), then . Let ; then, by construction of , we obtain and for all .
We have completed our argument to establish that W, as defined above, is indeed a resolving set for . In the next part, we will show that is not a resolving set. This will ensure that there does not exist a resolving set smaller than W and is the metric dimension for .
Part II
Since , we obtain . We now calculate the distance for all . Different cases arise for such a .
Case I.
When , depending on the value of s, changes. We discuss these different cases in the following.
- [a.]
- When , we obtain , and there is no distance to calculate.
- [b.]
- When , then , i.e., . If , then ; otherwise, .
- [c.]
- When , again ; i.e., and .
- [d.]
- When , we obtain, ; i.e., or . If , we obtain and , and for all other such values of s.
- [e.]
- When , we again see that —i.e., or and —for all such values of s.
Case II.
When . Then, . We claim that for all . Contrarily, let us suppose that . Since is the last vertex of path and , we only have the possibility that the vertex with the largest index in is adjacent to , implying
Using the values from the equation set 7, we obtain , which is a contradiction. Hence, , implying for all , giving us for all .
Case III.
When . Then, . We claim that for all . On the contrary, let us suppose that . Since is the last vertex of path and , we only have the possibility that the vertex with the largest index in is adjacent to , implying
Again, using the values from equation set 7, we obtain , which is a contradiction. Hence, , implying for all , giving us for all .
It is our aim to show that whenever we formulate the set , there exists a vertex, say , such that . Again, different cases arise depending on .
Case A.
When , depending on the value of s, changes. We discuss these different cases in the following.
- [a.]
- When , we obtain , and there is nothing to discuss.
- [b.]
- When , ; i.e., .If , then , since all elements of are in . Since , by letting , we see that , since again, all elements of are in . Hence, is not a resolving set.On the other hand, if and , we again see that . Let . Then, by the argument in Cases II and III and by the fact that for all , we obtainConsidering the vertex , since , all elements of W occur after ; i.e., all elements of occur after ; hence,Hence, is not a resolving set.
- [c.]
- When , again . Considering the vertex and proceeding in the same way as above, we see that, .
- [d.]
- When , ; i.e., or .If , we can formulate in two ways; i.e., or . If , by comparing and , we see that is not a resolving set. On the other hand, if , comparing and gives us that is not a resolving set.If but , letting and comparing and gives us that is not a resolving set.
- [e.]
- When , again, —i.e., or . As in the case, and , by letting and comparing the representations of and with respect to , we see that is not a resolving set.
Case B.
When , it is again an easy task to show that
where . Similarly,
This again shows that is not a resolving set.
Case C.
When , considering the representations and , where , we see that , and again, is not a resolving set.
For the part where is not a resolving set for all , the procedure is the same as for .
This completes the second part of our theorem. Combining these two together, we see that W is indeed a resolving set with minimal cardinality. Hence, . This completes our result. □
The above results conclude that the metric dimension of is not an exact number and increases with the size of both paths—i.e., the metric dimension of is unbounded.
3. Algorithms for Metric Bases and Metric Dimensions of
Theorems 1–3 enable us to calculate the metric dimensions of in constant time. An algorithm is developed in the following.
| Algorithm 1 Calculating the metric dimension of for and . |
| Input s and t |
|
| Output |
It can be readily observed that the algorithm uses assignment and if–else statements only. Each of these steps has a complexity of . Combining their complexities together gives us a complexity of for the whole algorithm.
These theorems also provide us a way to calculate the metric bases for . Theorems 1 and 2 establish that the metric bases for can be calculated in constant time for . Based on Theorem 3, we developed the following algorithm to calculate the metric bases for when and .
| Algorithm 2 Calculating the metric basis of for and . |
| Input s and t |
|
| Output W |
The first five statements of the above algorithm are assignments, each having a complexity of . Loops in steps 6, 9, 12 and 15 are not nested. The counter ensures that every loop runs less than times, with a maximum complexity of . By adding these complexities together, we again obtain ; i.e., the algorithm runs in linear time.
The metric basis we calculated in the algorithm will work for both and because of isomorphism and symmetry. Let us use this algorithm to solve an example already mentioned in introduction.
Example 2.
Let and ; then, and . Again, and . Loops in steps 6 and 12 do not satisfy the condition, and hence will not contribute anything to W. The loop in step 9 will run twice and will give us . Similarly, the loop in step 15 will run twice, and we will then obtain .
4. Conclusions
We considered the join of two path graphs and and calculated their metric dimensions and metric basis.
We also provided algorithms to calculate the metric dimensions and metric basis of . We concluded that the metric-dimension algorithm has a complexity of , and the metric-basis algorithm runs with complexity.
Since the metric dimension of an arbitrary n-vertex graph can be approximated in polynomial time [26], we have effectively reduced a lot of computational complexity for the case of , and by symmetry, that of .
Author Contributions
Conceptualization, G.H., M.U.I.K.; formal analysis, C.Z., G.H., M.U.I.K., F.Y., K.H., A.U.I.K.; Funding acquisition, C.Z.; methodology, M.U.I.K., F.Y., K.H.; validation, C.Z., G.H., M.U.I.K., F.Y., K.H., A.U.I.K., writing—original draft preparation, G.H., M.U.I.K., F.Y.; writing—review and editing, C.Z., G.H., M.U.I.K., F.Y., K.H., A.U.I.K.; visualization, G.H., M.U.I.K., K.H.; supervision, M.U.I.K., K.H.; software, G.H., M.U.I.K., K.H. All authors have read and agreed to the published version of the manuscript.
Funding
This work was supported by the Natural Science Research Projects of Department of Education of Guizhou Provincial (No. QianJiaoHe KY[2021]250), the Basic Research Programs of Guizhou Province (No. QianKeHe ZK[2023]279), the Social Science Research Base Project of Department of Education of Guizhou Provincial (No. 2021JD040), the Education Science Planning Project of Guizhou Province (No. 2020B196), the Doctoral Program of Guizhou Normal College in (No. 2022BS001).
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Not applicable.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Slater, P.J. Leaves of trees. Congr. Numer. 1975, 14, 37. [Google Scholar]
- Slater, P.J. Dominating and reference sets in a graph. J. Math. Phys. Sci 1988, 22, 445–455. [Google Scholar]
- Melter, F.; Harary, F. On the metric dimension of a graph. Ars. Combin. 1976, 2, 191–195. [Google Scholar]
- Chartrand, G.; Eroh, L.; Johnson, M.A.; Oellermann, O.R. Resolvability in graphs and the metric dimension of a graph. Discret. Appl. Math. 2000, 105, 99–113. [Google Scholar] [CrossRef]
- Klein, D.J.; Yi, E. A comparison on metric dimension of graphs, line graphs, and line graphs of the subdivision graphs. Eur. J. Pure Appl. Math. 2012, 5, 302–316. [Google Scholar]
- Ahmad, A.; Bača, M.; Sultan, S. Computing the metric dimension of kayak paddles graph and cycles with chord. Proyecciones (Antofagasta) 2020, 39, 287–300. [Google Scholar] [CrossRef]
- Sedlar, J.; Škrekovski, R. Bounds on metric dimensions of graphs with edge disjoint cycles. Appl. Math. Comput. 2021, 396, 125908. [Google Scholar] [CrossRef]
- Abrishami, G.; Henning, M.A.; Tavakoli, M. Local metric dimension for graphs with small clique numbers. Discret. Math. 2022, 345, 112763. [Google Scholar] [CrossRef]
- Hayat, S.; Khan, A.; Zhong, Y. On Resolvability—And Domination-Related Parameters of Complete Multipartite Graphs. Mathematics 2022, 10, 1815. [Google Scholar] [CrossRef]
- Bailey, R.F.; Meagher, K. On the metric dimension of Grassmann graphs. arXiv 2010, arXiv:1010.4495. [Google Scholar] [CrossRef]
- Feng, M.; Wang, K. On the metric dimension of bilinear forms graphs. Discret. Math. 2012, 312, 1266–1268. [Google Scholar] [CrossRef]
- Geneson, J.; Kaustav, S.; Labelle, A. Extremal results for graphs of bounded metric dimension. Discret. Appl. Math. 2022, 309, 123–129. [Google Scholar] [CrossRef]
- Mashkaria, S.; Odor, G.; Thiran, P. On the robustness of the metric dimension of grid graphs to adding a single edge. Discret. Appl. Math. 2022, 316, 1–27. [Google Scholar] [CrossRef]
- Rehman, S.U.; Imran, M.; Javaid, I. On the Metric Dimension of Arithmetic Graph of a Composite Number. Symmetry 2020, 12, 607. [Google Scholar] [CrossRef]
- Hussain, Z.; Munir, M.; Chaudhary, M.; Kang, S.M. Computing Metric Dimension and Metric Basis of 2D Lattice of Alpha-Boron Nanotubes. Symmetry 2018, 10, 300. [Google Scholar] [CrossRef]
- Knor, M.; Sedlar, J.; Škrekovski, R. Remarks on the Vertex and the Edge Metric Dimension of 2-Connected Graphs. Mathematics 2022, 10, 2411. [Google Scholar] [CrossRef]
- Barragán-Ramírez, G.A.; Estrada-Moreno, A.; Ramírez-Cruz, Y.; Rodríguez-Velázquez, J. The Simultaneous Local Metric Dimension of Graph Families. Symmetry 2017, 9, 132. [Google Scholar] [CrossRef]
- Imran, S.; Siddiqui, M.K.; Imran, M.; Hussain, M.; Bilal, H.M.; Cheema, I.Z.; Tabraiz, A.; Saleem, Z. Computing the Metric Dimension of Gear Graphs. Symmetry 2018, 10, 209. [Google Scholar] [CrossRef]
- Cáceres, J.; Hernando, C.; Mora, M.; Pelayo, I.M.; Puertas, M.L.; Seara, C.; Wood, D.R. On the metric dimension of cartesian products of graphs. SIAM J. Discret. Math. 2007, 21, 423–441. [Google Scholar] [CrossRef]
- Jiang, Z.; Polyanskii, N. On the metric dimension of Cartesian powers of a graph. J. Comb. Theory Ser. A 2019, 165, 1–14. [Google Scholar] [CrossRef]
- Fehr, M.; Gosselin, S.; Oellermann, O.R. The metric dimension of Cayley digraphs. Discret. Math. 2006, 306, 31–41. [Google Scholar] [CrossRef]
- Nazeer, S.; Hussain, M.; Alrawajeh, F.A.; Almotairi, S. Metric Dimension on Path-Related Graphs. Math. Probl. Eng. 2021, 2021, 2085778. [Google Scholar] [CrossRef]
- Eroh, L.; Feit, P.; Kang, C.X.; Yi, E. The effect of vertex or edge deletion on the metric dimension of graphs. J. Comb. 2015, 6, 433–444. [Google Scholar] [CrossRef]
- Sebo, A.; Tannier, E. On metric generators of graphs. Math. Oper. Res. 2004, 29, 383–393. [Google Scholar] [CrossRef]
- Chvátal, V. Mastermind. Combinatorica 1983, 3, 325–329. [Google Scholar] [CrossRef]
- Khuller, S.; Raghavachari, B.; Rosenfeld, A. Landmarks in graphs. Discret. Appl. Math. 1996, 70, 217–229. [Google Scholar] [CrossRef]
- Shahida, A.; Sunitha, M. On the metric dimension of joins of two graphs. Int. J. Sci. Eng. Res 2014, 5, 33–38. [Google Scholar]
- Rawat, B.; Pradhan, P. Metric dimension of some graphs under joint operation. Glob. J. Pure Appl. Math. 2017, 13, 3331–3348. [Google Scholar]
- Haryanto, L.; Nurdin, N.; Hasmawati, H. Metric Dimension of Graph Join P2 and Pt. J. Indones. Math. Soc. 2019, 25, 75–84. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).