Next Article in Journal
Implementation of Voltage Sag Relative Location and Fault Type Identification Algorithm Using Real-Time Distribution System Data
Previous Article in Journal
Research Status of Nonlinear Feedback Shift Register Based on Semi-Tensor Product
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Identifying the Exact Value of the Metric Dimension and Edge Dimension of Unicyclic Graphs

1
Institute of Computing Science and Technology, Guangzhou University, Guangzhou 510006, China
2
School of Computer Science and Technology, Dalian University of Technology, Dalian 116024, China
*
Author to whom correspondence should be addressed.
Mathematics 2022, 10(19), 3539; https://doi.org/10.3390/math10193539
Submission received: 14 July 2022 / Revised: 16 August 2022 / Accepted: 23 September 2022 / Published: 28 September 2022

Abstract

:
Given a simple connected graph G, the metric dimension dim ( G ) (and edge metric dimension edim ( G ) ) is defined as the cardinality of a smallest vertex subset S V ( G ) for which every two distinct vertices (and edges) in G have distinct distances to a vertex of S. It is an interesting topic to discuss the relation between these two dimensions for some class of graphs. This paper settles two open problems on this topic for unicyclic graphs. We recently learned that Sedlar and Škrekovski settled these problems, but our work presents the results in a completely different way. By introducing four classes of subgraphs, we characterize the structure of a unicyclic graph G such that dim ( G ) and edim ( G ) are equal to the cardinality of any minimum branch-resolving set for unicyclic graphs. This generates an approach to determine the exact value of the metric dimension (and edge metric dimension) for a unicyclic graph.
MSC:
05c69; 05c70

1. Introduction

This paper focuses on the unicyclic graphs [1]. In what follows, we first describe some notations and definitions that are used in the following sections, and then give a brief review on the history of (edge) metric dimension.
Throughout the paper, we only consider graphs that are finite, simple, and undirected. We use V ( G ) and E ( G ) to denote the vertex set and edge set of a graph G, respectively. The degree of a vertex v V ( G ) in G, denoted by d G ( v ) , is the number of vertices adjacent to v. If a vertex has degree k (respectively, at least k) in G, then we call it a k-vertex (respectively, k + -vertex) of G. The distance  d G ( u 1 , u 2 ) between two vertices u 1 , u 2 V ( G ) of a connected graph G is the length of a shortest path from u 1 to u 2 , and the distance d G ( v , e ) between a vertex v V ( G ) and an edge e E ( G ) is defined as d G ( v , e ) = min { d G ( v , v 1 ) , d G ( v , v 2 ) } , where e = v 1 v 2 . A path from a vertex v to an edge e refers to a path from v to an arbitrary endpoint of e. Throughout this paper, the notation P u , v (respectively, P u , e ) is used to denote a shortest path from vertex u to vertex v (respectively, vertex u to edge e). Let G be a connected graph and S V ( G ) . For any u , u V ( G ) (respectively, e , e E ( G ) ), we say that S distinguishes u and u (respectively, e and e ) if there exists a vertex v S such that d G ( v , u ) d G ( v , u ) (respectively, d G ( v , e ) d G ( v , e ) ); it is also said that v distinguishes u , u (respectively, e , e ). Then, S is referred to as a metric generator if S distinguishes any two vertices of G. Similarly, we call S an edge metric generator of G if S distinguishes any two edges of G. The minimum k for which G has a metric (respectively, edge metric) generator of cardinality k is called the metric (respectively, edge metric) dimension of G, denoted by dim(G) (respectively, edim(G)).
One of the first people to define metric dimension was Slater [2], who used the term ‘location number’ originally in connection with a location problem of uniquely determining the position of an intruder in a network. This concept was independently discovered by Harary and Melter [3], who were the first to use the term ‘metric dimension’. Metric dimension is an important concept in graph theory, and has many applications in diverse areas, such as image processing and pattern recognition [4,5], and robot navigation [6], to name a few. The problem of determining the metric dimension of a graph is NP-complete. Recently, motivated by an observation that there exist graphs where any metric generator does not distinguish all pairs of edges, Kelenc et al. [7] proposed the concept of the edge metric generator, which aims to distinguish edges instead of vertices, and made a comparison between these two dimensions. They also proved that determining the edge metric dimension is NP-hard, and proposed some open problems, most of which have been settled subsequently [8,9]. Since then, researchers have shown an increased interest in determining edge metric dimension for special classes of graphs, for example, generalized Petersen graphs [10,11], convex polytopes [12,13], graph operations [14], hollow coronoid [15], windmill graphs [16], möbius networks [17], etc. For more information on edge metric dimension, please refer to recent papers [18,19].
By the similarity of the metric dimension and the edge metric dimension, it is interesting to study the relation between them. In [7], it was found that there exist graphs whose metric dimension is less than, equal to, or greater than their edge metric dimension. In [8], it was proved that dim ( G ) edim ( G ) is not bounded from above. More recently, Knor et al. [20] further studied the ratio dim ( G ) edim ( G ) , and by constructing graphs based on a family of special unicyclic graphs they proved that there are graphs G for which both dim ( G ) edim ( G ) and edim ( G ) dim ( G ) can be arbitrarily large. They also posed two problems on how to characterize a unicyclic graph G with dim ( G ) > edim ( G ) or dim ( G ) = edim ( G ) + 1 .
Problem 1
([20]). Determine unicyclic graphs G with dim ( G ) > edim ( G ) or dim ( G ) = edim ( G ) + 1 .
For a unicyclic graphs G, Sedlar and Škrekovski [21] obtained the bounds on metric and edge metric dimensions, and proved that | dim ( G ) edim ( G ) | 1 . Furthermore, they proposed a similar problem to Problem 1.
Problem 2
([21]). Determine unicyclic graphs G when the difference edim ( G ) dim ( G ) = 1 , edim ( G ) dim ( G ) = 0 , and edim ( G ) dim ( G ) = 1 .
In this paper, for a unicyclic graph G, by introducing four classes of subgraphs, we obtain the exact values of edim ( G ) and dim ( G ) . Our results settle the above two problems. Although these problems were addressed in a recent published paper [1], our work presents the results in a completely different way. It is a pity that we did not find the work in [1] until recently. We still want to make it clear that we did not copy anything from [1] and the configurations of unicyclic graphs characterized in our paper are different from those in [1]. More specifically, the approach in [1] was to characterize indistinguishable configurations of vertices (respectively, edges) in a unicyclic graph and then determine the vertex metric generator (respectively, edge metric generator). Our approach is to construct a configuration in which all vertices or edges can be distinguished in a unicyclic graph, and then characterize the odd graphs and even graphs with respect to the cardinality of a smallest vertex metric generator (respectively, edge metric generator).
The section below describes terminologies and notation we adopt in our proofs and some (known and new) conclusions.

2. Preliminaries

We follow the same notations in [21] with a slight change. Given a graph G, we use G V and G E to denote the resulting graph obtained from G by deleting all vertices in V (and all of their incident edges) and all edges in E , respectively, where V V ( G ) and E E ( G ) . Especially, when V = { v } and E = { e } , we replace them with G v and G e , respectively. For two integers i , j such that 0 i < j , we use [ i , j ] to denote the set { i , i + 1 , , j } . The focus of this paper is on unicyclic graphs, which are graphs containing exactly one cycle. Let G be a unicyclic graph. For the sake of convenience, we use C ( G ) and ( G ) (or simply C and when G is clear from the context) to denote the unique cycle of G and the length of C , respectively, and denote by O ( ) and E ( ) the sets of unicyclic graphs with 1 (mod 2) and 0 (mod 2), respectively. Clearly, 3 .
In what follows, for any unicyclic graph G, we always let C = a 0 a 1 a 1 a 0 . Note that G E ( C ) is a forest. For each i [ 0 , 1 ] , we denote by T a i the component of G E ( C ) containing a i , and call a i the master of every vertex of T a i (it is necessary here to clarify that a i is also its own master). For any S V ( G ) , we say that a i V ( C ) , i [ 0 , 1 ] is S-active if T a i contains a vertex of S, and use A ( S ) to denote the set of all S-active vertices on C ( G ) . For a vertex u V ( G ) , if u V ( C ) is a 3 + -vertex or u V ( C ) is a 4 + -vertex, then we call u a branching vertex of G. Clearly, if T a i contains no branching vertex, then T a i is a path. For every vertex u with d G ( u ) 3 , a thread attached to u is a path u 1 u k such that u i is a 2-vertex for i [ 1 , k 1 ] , u k is an 1-vertex, and u 1 u E ( G ) , where k 1 . By S ( u ) we denote the set of threads that are attached to u. A 4 + -vertex u V ( C ) is called a bad vertex of G if there is a thread attached to u. A branch-resolving set of G is a set S V ( G ) such that for every 3 + -vertex v, at least | S ( v ) | 1 threads in S ( v ) contain a vertex of S. Indeed, we are interested in the branch-resolving set containing the minimum number of vertices. Obviously, the cardinality of any minimum branch-resolving set, denoted by L ( G ) , is determined by
L ( G ) = v V ( G ) , | S ( v ) | > 1 ( | S ( v ) | 1 ) .
Observe that each thread has exactly one 1-vertex; therefore, we can choose a minimum branch-resolving set which consists of only 1-vertices. We use B ( G ) to denote the set of all such minimum branch-resolving sets of G. When S ( B ( G ) ) , we can label vertices on C in a specific way: a 0 A ( S ) and the maximum i such that a i is an S-active vertex and should be as small as possible. Such labeling is called normal labeling with respect to S of C (or simply normal labeling of C ).
Let G be a unicyclic graph and a i , a j , a k be three vertices on C . If d G ( a i , a j ) + d G ( a j , a k ) + d G ( a k , a i ) = , then a i , a j , a k are said to form a geodesic triple. Let S B ( G ) and r = max { i | a i is S-active}. Notice that when C is labeled normally, if r > 2 , then a 0 , a p , and a q form a geodesic triple for p = max { i | i [ 1 , 2 ] and a i A ( S ) } and q = min { i | i [ 2 + 1 , 1 ] and a i A ( S ) } . In addition, if 0 (mod 2) and r = 2 , then either A ( S ) = { a 0 , a r } or A ( S ) contains three vertices that form a geodesic triple.
The following part of this section moves on to describe some basic conclusions. We first present three known results given by Sedlar and Škrekovski [21].
Lemma 1
([21]). Let G be a unicyclic graph. If S is a metric generator (respectively, edge metric generator), then | A ( S ) | 2 and S is a branch-resolving set.
Lemma 2
([21]). Let G be a unicyclic graph and S V ( G ) a branch-resolving set of G. If A ( S ) contains three vertices that form a geodesic triple, then S is a metric generator (and also an edge metric generator) of G.
Lemma 3
([21]). Let G be a unicyclic graph. If S V ( G ) is a branch-resolving set of G such that | A ( S ) | 2 , then any two vertices (also any two edges) from each T a i , i [ 0 , 1 ] , can be distinguished by S.
What follows are three useful lemmas by which we derive our main results in the subsequent sections.
Lemma 4.
Suppose that G is a unicyclic graph with | A ( S ) | 2 , where S B ( G ) . Let a i , a j be two S-active vertices such that 0 < | j i | 1 2 ( C is labeled normally). If neither a i nor a j is a bad vertex, then any two vertices v 1 , v 2 (respectively, any two edges e 1 , e 2 ) such that { v 1 , v 2 } ( V ( T a i V ( T a j ) ) (respectively, { e 1 , e 2 } ( E ( T a i E ( T a j ) ) ) can be distinguished by S.
Proof. 
Let i = 0 and i < j 1 2 . It suffices to deal with { v 1 , v 2 } V ( T a 0 ) (respectively, { e 1 , e 2 } E ( T a 0 ) ), since the case that { v 1 , v 2 } V ( T a j ) (respectively, { e 1 , e 2 } E ( T a j ) ) can be addressed in a similar way. Without loss of generality, assume that v 1 V ( T a 0 ) (respectively, e 1 E ( T a 0 ) ) and let v 2 V ( T a j ) (respectively, e 2 E ( T a j ) or e 2 = a j a j + 1 E ( C ) ), where j [ 0 , 1 ] and a = a 0 . By Lemma 3, we only consider the case v 2 V ( T a 0 ) (respectively, e 2 E ( T a 0 ) ). Let u ( V T a 0 S ) and v ( V T a j S ) . In the remainder of the proof, we suppose that d G ( u , v 1 ) = d G ( u , v 2 ) (respectively, d G ( u , e 1 ) = d G ( u , e 2 ) ). Clearly, v 1 V ( P u , a 0 ) (respectively, e 1 E ( P u , a 0 ) , otherwise d G ( u , v 1 ) < d G ( u , v 2 ) (respectively, d G ( u , e 1 ) < d G ( u , e 2 ) ). Moreover, since d G ( u ) = 1 , u V ( P a 0 , v 1 ) (respectively, u E ( P a 0 , e 1 ). We denote by x V ( P u , v 1 ) V ( P u , a 0 ) (respectively, x V ( P u , e 1 ) V ( P u , a 0 ) ) the vertex that has the minimum distance with a 0 ( x = a 0 is possible).
d G ( u , v 1 ) = d G ( u , x ) + d G ( x , v 1 ) d G ( u , v 2 ) = d G ( u , x ) + d G ( x , a 0 ) + d G ( a 0 , v 2 ) d G ( v , v 1 ) = d G ( v , a j ) + j + d G ( x , a 0 ) + d G ( x , v 1 ) d G ( v , v 2 ) = d G ( v , a j ) + d G ( a j , a j ) + d G ( a j , v 2 )
(respectively, d G ( u , e 1 ) = d G ( u , x ) + d G ( x , e 1 ) d G ( u , e 2 ) = d G ( u , x ) + d G ( x , a 0 ) + d G ( a 0 , e 2 ) d G ( v , e 1 ) = d G ( v , a j ) + j + d G ( a 0 , x ) + d G ( x , e 1 ) d G ( v , e 2 ) = d G ( v , a j ) + d G ( a j , e 2 ) )
Beginning with the premise d G ( u , v 1 ) = d G ( u , v 2 ) (respectively, d G ( u , e 1 ) = d G ( u , e 2 ) ), we have d G ( x , v 1 ) = d G ( x , a 0 ) + d G ( a 0 , a j ) + d G ( a j , v 2 ) (respectively, d G ( x , e 1 ) = d G ( x , a 0 ) + d G ( a 0 , e 2 ) ). Now, suppose that d G ( v , v 1 ) = d G ( v , v 2 ) (respectively, d G ( v , e 1 ) = d G ( v , e 2 ) ). Then,
d G ( a j , a j ) = j + 2 d G ( x , a 0 ) + d G ( a 0 , a j ) ( r e s p e c t i v e l y , d G ( a j , e 2 ) = j + 2 d G ( x , a 0 ) + d G ( a 0 , e 2 ) )
Case 1. x a 0 . Then, d G ( x , a 0 ) > 0 . By Equation (1), j > 2 . Thus, d G ( a 0 , a j ) = j (respectively, d G ( a 0 , e 2 ) = j + d G ( a j , e 2 ) when e 2 E ( C ) and d G ( a 0 , e 2 ) = j 1 when e 2 E ( C ) ). If j j 1 2 , then d G ( a j , a j ) = j j (respectively, d G ( a j , e 2 ) = j j + d G ( a j , e 2 ) when e 2 E ( C ) and d G ( a j , e 2 ) = j j when e 2 E ( C ) ), which implies (by Equation (1)) that 2 d G ( x , a 0 ) = 2 j 2 j 0 (or 2 d G ( x , a 0 ) = 2 j 2 j + 1 0 when e 2 E ( C ) , since 1 (mod 2) in this case), a contradiction. If j j > 1 2 , then d G ( a j , a j ) = j + j (respectively, d G ( a j , e 2 ) = j + j + d G ( a j , e 2 ) when e 2 E ( C ) and d G ( a j , e 2 ) = j 1 + j when e 2 E ( C ) ), which implies (by Equation (1)) that d G ( x , a 0 ) = 0 , a contradiction.
Case 2. x = a 0 . Then, d G ( u , v 1 ) = d G ( u , v 2 ) (respectively, d G ( u , e 1 ) = d G ( u , e 2 ) ) implies that d G ( a 0 , v 1 ) = d G ( a 0 , v 2 ) (respectively, d G ( a 0 , e 1 ) = d G ( a 0 , e 2 ) ). Notice that v 1 a 0 (respectively, e 1 E ( P u , a 0 ) ). We have that T a 0 a 0 is disconnected. Let T be the component of T a 0 a 0 that contains v 1 (respectively, e 1 or one endpoint of e 1 when a 0 V ( e 1 ) ). Clearly, u V ( T ) . Since a 0 is not a bad vertex, V ( T ) S . Let w ( V ( T ) S ) and let w ( V ( P w , v 1 ) V ( P a 0 , v 1 ) ) (respectively, w ( V ( P w , e 1 ) V ( P a 0 , v 1 ) ) ) be the vertex that has the minimum distance with a 0 . Clearly, w a 0 . Observe that d G ( w ) = 1 . Thus, w V ( P a 0 , v 1 ) (except for the case that w = v 1 , for which d G ( w , v 1 ) = 0 < d G ( w , v 2 ) ) and w V ( P a 0 , e 1 ) . We also assume that v 1 (respectively, e 1 ) is not on P a 0 , w ; otherwise d G ( w , v 1 ) < d G ( w , v 2 ) (respectively, d G ( w , e 1 ) < d G ( w , e 2 ) ). Thus, d G ( w , v 1 ) = d G ( w , w ) + d G ( w , v 1 ) and d G ( a 0 , v 1 ) = d G ( a 0 , w ) + d G ( w , v 1 ) (respectively, d G ( w , e 1 ) = d G ( w , w ) + d G ( w , e 1 ) and d G ( a 0 , e 1 ) = d G ( a 0 , w ) + d G ( w , e 1 ) ). As a result, d G ( w , v 2 ) = d G ( w , w ) + d G ( w , a 0 ) + d ( a 0 , v 2 ) = d G ( w , w ) + d G ( w , a 0 ) + d G ( a 0 , v 1 ) (respectively, d G ( w , e 2 ) = d G ( w , w ) + d G ( w , a 0 ) + d G ( a 0 , e 1 ) ). If d G ( w , v 1 ) = d G ( w , v 2 ) (respectively, d G ( w , e 1 ) = d G ( w , e 2 ) ), then d G ( a 0 , w ) = 0 , i.e., a 0 = w , a contradiction. □
Lemma 5.
Let G E ( ) and S B ( G ) . Suppose that A ( S ) contains two vertices, say a 0 , a j , such that 1 j 2 2 . Then, each vertex w ( V ( T a k ) S ) for k [ 1 , j 1 ] can distinguish two vertices v 1 V ( T a i ) and v 2 V ( T a j ) (respectively, two edges e 1 E ( T a i ) and e 2 V ( T a j ) ) for i [ 1 , j 1 ] and j [ 2 + 1 , 2 + j ] such that d G ( a 0 , v 1 ) = d G ( a 0 , v 2 ) and d G ( a j , v 1 ) = d G ( a j , v 2 ) (respectively, d G ( a 0 , e 1 ) = d G ( a 0 , e 2 ) and d G ( a j , e 1 ) = d G ( a j , e 2 ) ).
Proof. 
For convenience, we use x i to denote v i or e i for i [ 1 , 2 ] , and let d G ( a i , v i ) = m i (respectively, d G ( a i , e i ) = m i ). Then, for any x i { v i , e i } ( i [ 1 , 2 ] ), d G ( a 0 , x 1 ) = i + m 1 , d G ( a 0 , x 2 ) = j + m 2 , d G ( a j , x 1 ) = j i + m 1 , and d G ( a j , x 2 ) = j j + m 2 . By d G ( a 0 , v 1 ) = d G ( a 0 , v 2 ) and d G ( a j , v 1 ) = d G ( a j , v 2 ) (respectively, d G ( a 0 , e 1 ) = d G ( a 0 , e 2 ) and d G ( a j , e 1 ) = d G ( a j , e 2 ) ), we deduce that m 1 m 2 = ( i + j ) and = 2 ( i + j j ) . Let d G ( w , a k ) = m , where a k is the master of vertices of T a k , k ( 1 , j 1 ) .
Case 1. k i . In this case, d G ( w , x 1 ) = m + | k i | + m 1 . When j k 2 , d G ( w , x 2 ) = m + j k + m 2 . If d G ( w , x 1 ) = d G ( w , x 2 ) , then either = 2 ( i + j k ) (when k > i ) which implies that k = j , or j = 2 (when k < i ). When j k > 2 , d G ( w , x 2 ) = m + k + j + m 2 . If d G ( w , x 1 ) = d G ( w , x 2 ) , then either i = 0 (when k > i ), or k = 0 (when k < i ). Clearly, each of these cases yields a contradiction.
Case 2. k = i . If x 1 is on P w , a i , it is clear that d G ( w , v 1 ) < d G ( w , v 2 ) (respectively, d G ( w , e 1 ) < d G ( w , e 2 ) ). Thus, suppose that x 1 is not on P w , a i . Let w be the common vertex shared by P w , a i and P w , x 1 that has the minimum distance with a i . Then, d G ( w , x 1 ) = d G ( w , w ) + d G ( w , x 1 ) and m 1 = d G ( a i , w ) + d G ( w , x 1 ) . Note that j 2 + 1 , m 2 = m 1 + ( i + j ) , and d G ( w , x 1 ) m 1 . When j i 2 , we have that d G ( w , x 2 ) = d G ( w , w ) + d G ( w , a i ) + j i + m 2 = d G ( w , w ) + d G ( w , a i ) + ( 2 j ) + m 1 > d G ( w , x 1 ) . When j i > 2 , we have that d G ( w , x 2 ) = d G ( w , w ) + d G ( w , a i ) + j + i + m 2 = d G ( w , w ) + d G ( w , a i ) + 2 i + m 1 > d G ( w , x 1 ) . □
Lemma 6.
Suppose that G is a unicyclic graph. Then, for any 0 < j 1 2 , two vertices v 1 V ( T a i ) and v 2 V ( T a j ) (respectively, two edges e 1 E ( T a i ) and e 2 E ( T a j )) such that i , j [ 0 , 1 ] { i , j } , say i = 0 and i < j cannot be distinguished by { a 0 , a j } if and only if one of the following conditions holds, where m 1 = d G ( a i , v 1 ) and m 2 = d G ( a i , v 2 ) (respectively, m 1 = d G ( a i , e 1 ) and m 2 = d G ( a i , e 2 ) ).
(i) 
j [ j + 1 , 2 ] , i > j , and m 1 m 2 = j i ;
(ii) 
j [ 2 + 1 , 2 + j ] , i < j , = 2 i + 2 j 2 j , and m 1 m 2 = j i ;
(iii) 
j [ 2 + j + 1 , 1 ] , = 2 ( i j ) , and m 1 m 2 = i j ; or i > 2 + j and m 1 m 2 = i j .
Proof. 
Notice that when (i) holds, d G ( a 0 , v 1 ) = i + m 1 , d G ( a 0 , v 2 ) = j + m 2 , d G ( a j , v 1 ) = i j + m 1 , and d G ( a j , v 2 ) = j j + m 2 ; when (ii) holds, d G ( a 0 , v 1 ) = i + m 1 , d G ( a 0 , v 2 ) = j + m 2 , d G ( a j , v 1 ) = j i + m 1 , and d G ( a j , v 2 ) = j j + m 2 ; when (iii) holds, d G ( a 0 , v 1 ) = i + m 1 , d G ( a 0 , v 2 ) = j + m 2 , d G ( a j , v 1 ) = 2 + m 1 , and d G ( a j , v 2 ) = + j j + m 2 ; or d G ( a 0 , v 1 ) = i + m 1 , d G ( a 0 , v 2 ) = j + m 2 , d G ( a j , v 1 ) = i + j + m 1 , and d G ( a j , v 2 ) = + j j + m 2 . One can readily check that d G ( a 0 , v 1 ) = d G ( a 0 , v 2 ) and d G ( a j , v 1 ) = d G ( a j , v 2 ) when one of the above three conditions holds.
Now, suppose that v 1 , v 2 (respectively, e 1 , e 2 ) cannot be distinguished by S, i.e., d G ( a 0 , a i ) + m 1 = d G ( a 0 , a j ) + m 2 and d G ( a j , a i ) + m 1 = d G ( a j , a j ) + m 2 . Then,
d G ( a 0 , a i ) d G ( a 0 , a j ) = d G ( a j , a i ) d G ( a j , a j ) , and m 1 m 2 = d G ( a 0 , a j ) d G ( a 0 , a i )
Clearly, j > j (otherwise, d G ( a 0 , a i ) d G ( a 0 , a j ) < 0 but d G ( a j , a i ) d G ( a j , a j ) > 0 , a contradiction).
Case 1. j [ j + 1 , 2 ] . Then, d G ( a 0 , a i ) = i , d G ( a 0 , a j ) = j , d G ( a j , a i ) = | j i | , and d G ( a j , a j ) = j j . By Equation (2), if i < j , then we derive i = j , a contradiction. Therefore, i > j , and hence m 1 m 2 = j i .
Case 2. j [ 2 + 1 , 2 + j ] . When i > 2 , d G ( a 0 , a i ) = i , d G ( a 0 , a j ) = j , d G ( a j , a i ) = i j , and d G ( a j , a j ) = j j . By Equation (2), we derive i = j , a contradiction. When i 2 , d G ( a 0 , a i ) = i , d G ( a 0 , a j ) = j , d G ( a j , a i ) = | j i | , and d G ( a j , a j ) = j j . By Equation (2), if i > j , then = 2 j , a contradiction. Therefore, it holds that i < j , by which we derive = 2 i + 2 j 2 j and m 1 m 2 = j i .
Case 3. j [ 2 + j + 1 , 1 ] . When i 2 , d G ( a 0 , a i ) = i , d G ( a 0 , a j ) = j , d G ( a j , a i ) = | j i | , and d G ( a j , a j ) = j + j . By Equation (2), we deduce that either i = 0 (when i < j ) or j = 0 (when i > j ), a contradiction. Therefore, i > 2 . Moreover, when 2 < i 2 + j , d G ( a 0 , a i ) = i , d G ( a 0 , a j ) = j , d G ( a j , a i ) = i j , and d G ( a j , a j ) = j + j . By Equation (2), we deduce that = 2 i 2 j and m 1 m 2 = i j . When i > 2 + j , then d G ( a 0 , a i ) = i and d G ( a 0 , a j ) = j , which implies that m 1 m 2 = i j . □

3. Metric Dimension

This section is devoted to the argument of our main results for metric dimension. Similar conclusions for edge metric dimension are presented in the next section. To achieve our purpose, we need to construct four families of graphs G for which dim(G) = L ( G ) or edim(G) = L ( G ) . The first two families of graphs (for metric dimension) are described here (Definition 1), while the other two families of graphs (for edge metric dimension) are introduced in the following section (Definition 2).
Definition 1.
Suppose that G is a unicyclic graph of length ( 3 ) and j [ 1 , 1 2 ] . If G O ( ) satisfies either j = 1 2 or the following two conditions (i) and (ii) hold, then we call G an odd- ( , j ) graph; if G E ( ) satisfies the following three conditions, (i), (ii), and (iii), then we call G an even- ( , j ) graph.
(i) 
Neither a 0 nor a j is a bad vertex.
(ii) 
If j < 2 2 , V ( T a k ) = { a k } for every k { 1 , , ( 2 2 j ) } { j + 1 , , j + ( 2 2 j ) } .
(iii) 
If j > 1 and T a k contains no branching vertex for every k [ 1 , j 1 ] , then the length of T a k is at most 2 2 j .
We use O ( , j ) and E ( , j ) to denote the set of all odd- ( , j ) graphs and even- ( , j ) graphs, respectively. See Figure 1 for some examples of odd- ( , j ) graphs and even- ( , j ) graphs.
We observe that when G O ( ) , { a 0 , a 1 2 } is enough to distinguish two vertices not in the same T a i for i [ 0 , 1 ] , by which we obtain the following conclusion, but this result does not hold for G E ( ) .
Lemma 7.
Let G O ( ) . Then, S B ( G ) is a metric generator if there are two S-active vertices with distance 1 2 .
Proof. 
By symmetry, let a 0 A ( S ) and a γ A ( S ) , where γ = 1 2 . Let x , y V ( G ) be two distinct vertices, and a i and a j ( i , j [ 0 , 1 ] ) be the masters of x and y, respectively. By Lemma 3, let i j . Moreover, if { i , j } { 0 , γ } , say i = 0 (the other cases can be discussed in the same way), then under the condition of d G ( a 0 , x ) = d G ( a 0 , y ) we deduce that d G ( a γ , x ) = d ( a 0 , x ) + γ = d ( a 0 , y ) + γ = d G ( a 0 , a j ) + d G ( a j , y ) + γ > d G ( a j , y ) + d G ( a j , a γ ) = d G ( a γ , y ) (since d G ( a 0 , a j ) > 0 and d G ( a j , a γ ) < γ ). Therefore, we assume i < j and i , j [ 0 , 1 ] { 0 , γ } . Then, by Lemma 6, x and y can be distinguished by { a 0 , a γ } , i.e., d G ( x , a 0 ) d G ( y , a 0 ) and d G ( x , a γ ) d G ( y , a γ ) . Moreover, since a 0 and a γ are S-active vertices, we let s 1 = V ( T a 0 S ), s 2 = V ( T a γ S ), m 1 = d G ( s 1 , a 0 ) , and m 2 = d G ( s 2 , a γ ) . Then, d G ( x , a 0 ) + m 1 d G ( y , a 0 ) + m 1 and d G ( x , a γ ) + m 2 d G ( y , a γ ) + m 2 . This implies that x and y can be distinguished by S. □
Let us now turn to a more general sufficient condition for a unicyclic graph G satisfying dim ( G ) = L ( G ) .
Lemma 8.
Suppose that G is a unicyclic graph such that | A ( S ) | 2 , where S B ( G ) . Label C ( G ) normally. If there exists an integer j [ 1 , 1 2 ] such that a j A ( S ) and G O ( , j ) E ( , j ) , then dim ( G ) = L ( G ) .
Proof. 
By Lemma 1, it suffices to prove that S is a metric generator. If 1 (mod 2) and j = 1 2 , then the conclusion follows from Lemma 7. Thus, assume that 1 j 2 2 . Let x , y be two distinct vertices in G, whose masters are a i and a j ( i , j [ 0 , 1 ] ), respectively. By Lemmas 3 and 4, assume that i j (say i < j ) and { i , j } { 0 , j } = . Let u V ( T a 0 ) S , v V ( T a j ) S , m 1 = d G ( x , a i ) , and m 2 = d G ( y , a j ) . In the below, we suppose that
d G ( a 0 , x ) = d G ( a 0 , y ) a n d d G ( a j , x ) = d G ( a j , y )
By Lemma 6, one of the following conditions holds: (i) j [ j + 1 , 2 ] , i > j , and m 1 m 2 = j i ; (ii) j [ 2 + 1 , 2 + j ] , i < j , = 2 i + 2 j 2 j , and m 1 m 2 = j i ; (iii) j [ 2 + j + 1 , 1 ] , = 2 ( i j ) , and m 1 m 2 = i j ; or i > 2 + j and m 1 m 2 = i j .
For (i), by G O ( , j ) E ( , j ) (Definition 1 (ii)), we deduce that m 1 = 0 and m 2 = i j < 0 , a contradiction. For (ii), we have that 0 (mod 2) and m 1 = 2 j + m 2 2 j . Therefore, by G E ( , j ) (Definition 1 (iii)), there exists a vertex k [ 1 , j 1 ] such that T a k contains a branching vertex. Thus, S V ( T a k ) , say w S V ( T a k ) . By Lemma 5, x and y can be distinguished by w. For (iii), we have that j + 2 2 + j and m 2 = j i + m 1 > 0 (which implies that | V ( T a j ) | > 1 ), a contradiction to G E ( , j ) (Definition 1 (ii)). □
Based on Lemma 8, we can obtain one of our main results (for metric dimension) as follows.
Theorem 1.
Suppose that G is a unicyclic graph with | A ( S ) | 2 , where S B ( G ) . Label C ( G ) normally and let j = max { i : a i A ( S ) } . S is a metric generator if and only if G O ( , j ) E ( , j ) or A ( S ) contains three vertices that form a geodesic triple.
Proof. 
By Lemmas 2 and 8, it suffices to consider the necessity. Let S be a metric generator. Suppose that A ( S ) does not contain three vertices that form a geodesic triple, which implies j 2 . In particular, when j = 2 and G E ( ) , it has that A ( S ) = { a 0 , a j } and d G ( s , a i ) = d G ( s , a i ) for every i [ 1 , 2 2 ] and every s S , a contradiction. In the below, we assume that j 1 2 and we prove that G O ( , j ) E ( , j ) .
Suppose, to the contrary, that G O ( , j ) (respectively, G E ( , j ) ). Then, at least one of the following conditions (i) and (ii) (respectively, (i), (ii), and (iii)) holds.
(i)
a 0 or a j is a bad vertex.
(ii)
When j < 2 2 , there exists a k ( { 1 , , ( 2 2 j ) } { j + 1 , , j + ( 2 2 j ) such that | V ( T a k ) | > 1 .
(iii)
When j > 1 and T a k contains no branching vertex for every k [ 1 , j 1 ] , there exists some k [ 1 , j 1 ] such that the length of T a k is at least 2 j .
For (i), suppose that a 0 is a bad vertex (the case for a j can be discussed similarly). By the selection of S, there is a thread T attached to a 0 which contains no vertex of S. Let u V ( T ) be the vertex adjacent to a 0 , 0 j j . Then, d G ( u , s ) = 1 + j + d G ( a j , s ) = d G ( a 1 , s ) for any s S ( 0 j j V ( T a j ) ) . Thus, S cannot distinguish u and a 1 , a contradiction.
For (ii), consider the vertex u V ( T a k ) that is adjacent to a k . If k { 1 , , ( 2 2 j ) } , then k 1 2 + j , and hence d G ( u , s ) = 1 + ( k ) + j + d G ( a j , s ) = d G ( a k 1 , s ) for any s S ( 0 j j V ( T a j ) ) . Thus, S cannot distinguish u and a 1 , a contradiction. If k { j + 1 , , j + ( 2 2 j ) , then k + 1 2 , and hence d G ( u , s ) = 1 + ( k j ) + d G ( a j , s ) = d G ( a k + 1 , s ) for any s S ( 0 j j V ( T a j ) ) . Thus, S cannot distinguish u and a 1 , a contradiction.
For (iii), S contains only vertices in V ( T a 0 ) V ( T a j ) . Let u V ( T a k ) be the vertex that has distance 2 j with a k . Consider the vertex a 2 + j k . Since 2 + j k > 2 and 2 + j k j = 2 k < 2 , we have that d G ( a 2 + j k , s ) = 2 j + k + d ( a 0 , s ) = d G ( u , a 0 ) for any s S V ( T a 0 ) and d G ( a 2 + j k , s ) = ( 2 j ) + ( j k ) + d G ( a j , s ) = d G ( u , a j ) for any s S V ( T a j ) . Thus, S cannot distinguish u and a 2 + j k , a contradiction. □
Notice that for every two distinct vertices a p , a q V ( C ) we can always find a vertex a r V ( C ) { a p , a q } such that a p , a q , a r form a geodesic triple. Thus, by Lemmas 1 and 2, we have that 2 ≤ dim(G) 3 when L ( G ) = 0 , L ( G ) + 1 dim(G) L ( G ) + 2 when L ( G ) = 1 , and L ( G ) dim(G) L ( G ) + 1 when L ( G ) 2 . Then, the following result holds by Theorem 1.
Corollary 1.
Given a unicyclic graph G and S B ( G ) , we label C ( G ) normally and let j = max { i : a i A ( S ) } when | A ( S ) | 2 . If G O ( ) , it holds that
(1) 
When A ( S ) = , dim ( G ) = 2 .
(2) 
When | A ( S ) | = 1 , dim ( G ) = L ( G ) + 1 .
(3) 
When | A ( S ) | 2 , if G O ( , j ) or A ( S ) contains three vertices that form a geodesic triple, then dim ( G ) = L ( G ) ; otherwise, dim ( G ) = L ( G ) + 1 .
Moreover, if G E ( ) , it holds that
(1) 
When A ( S ) = , if there are two vertices on C (say a 0 and a k ) such that G E ( , k ) , then dim(G) = 2; otherwise dim(G) = 3.
(2) 
When | A ( S ) | = 1 , let A ( S ) = { a k } . If there exists a vertex a k V ( C ) { a k } such that G E ( , k ) (let k = 0 ) or G E ( , k ) (let k = 0 ), then dim(G)= L ( G ) + 1 ; otherwise, dim(G) = L ( G ) + 2.
(3) 
When | A ( S ) | 2 , if G E ( , j ) or A ( S ) contains three vertices that form a geodesic triple, then dim(G) = L ( G ) ; otherwise, dim(G) = L ( G ) + 1 .

4. Edge Metric Dimension

The previous section showed that the metric dimension of unicyclic graphs can be exactly determined by the aid of odd- and even- ( , j ) graphs. This section moves on to consider the edge metric dimension of unicyclic graphs. Before proceeding further, it is important to introduce the other two families of graphs.
Definition 2.
Suppose that G is a unicyclic graph of length ( 3 ) and j [ 1 , 1 2 ] . If G O ( ) satisfies the following condition (i), (ii), and (iii), then we call G an edge-odd- ( , j ) graph; if G E ( ) satisfies the following conditions (i), (ii), and (iv), then we call G an edge-even- ( , j ) graph.
(i) 
Neither a 0 nor a j is a bad vertex.
(ii) 
When j < 1 2 , V ( T a k ) = { a k } for every k { 1 , , ( 1 2 j ) } { j + 1 , , j + ( 1 2 j ) } .
(iii) 
When j > 1 and T a k contains no branching vertex for every k [ 1 , j 1 ] , then the length of T a k is at most 1 2 j .
(iv) 
When j > 1 and both T a k and T a k contain no branching vertex for every k [ 1 , j 1 ] and k = 2 + j k , if | V ( T a k ) | > 1 , then the length of T a k is at most 2 j .
We use O e ( , j ) and E e ( , j ) to denote the set of all edge-odd- ( , j ) graphs and edge-even- ( , j ) graphs, respectively. See Figure 2 for some examples of edge-odd- ( , j ) graphs and edge-even- ( , j ) graphs.
Let us now turn to the discussion of the edge metric dimension of unicyclic graphs based on edge-odd and edge-even graphs. Although the conclusions (and their proofs) in this section are analogous to those in Section 3, there are still a number of important differences between them. Thus, we fully describe them as well.
Lemma 9.
Let G be a unicyclic graph with | A ( S ) | 2 , where S B ( G ) . Label C ( G ) normally. If there exists a j [ 1 , 1 2 ] such that a j A ( S ) and G O e ( , j ) E e ( , j ) , then edim ( G ) = L ( G ) .
Proof. 
By Lemma 1, it suffices to show that S is an edge metric generator. Note that C is labeled normally. If there exists some r > 2 for which a r A ( S ) , then A ( S ) contains three vertices that form a geodesic triple, and S is an edge metric generator of G by Lemma 2. Thus, we assume that T a r contains no branching vertex for every 2 < r 1 .
Let e 1 , e 2 be an arbitrary pair of edges in G. Clearly, if both e 1 E ( C ) and e 2 E ( C ) , then e 1 and e 2 can be distinguished by { a 0 , a j } , and also by S. By Lemmas 3 and 4, e 1 and e 2 can be distinguished by S if e 1 E ( T a i ) and e 2 E ( T a i ) for some i [ 0 , 1 ] or { e 1 , e 2 } ( E ( T a 0 ) E ( T a j ) ) . In the below, we assume that e 2 E ( T a j ) for some j [ 0 , 1 ] , { e 1 , e 2 } ( E ( T a 0 ) E ( T a j ) ) = , and there does not exist any i [ 0 , 1 ] such that { e 1 , e 2 } E ( T a i ) . Let e 2 = w 1 w 2 and d G ( a j , e 2 ) = d G ( a j , w 1 ) = m 2 . This also implies that d G ( a 0 , e 2 ) = d G ( a 0 , w 1 ) and d G ( a j , e 2 ) = d G ( a j , w 1 ) . Now, suppose that
d G ( a 0 , e 1 ) = d G ( a 0 , e 2 ) and d G ( a j , e 1 ) = d G ( a j . e 2 )
We derive a contradiction or show that e 1 and e 2 can be distinguished by a vertex in S ( V ( T a 0 ) V ( T a j ) ) .
Case 1. e 1 E ( C ) . Let e 1 = a i a i + 1 , where i [ 0 , 1 ] and a = a 0 . By G O e ( , j ) E e ( , j ) (Definition 2 (ii)), we have that j [ 1 , j 1 ] or 1 2 < j < 1 2 + j (note that j { 0 , j } ). Moreover, when j > 1 2 , it follows that i < j ; otherwise, d G ( a 0 , e 1 ) = d G ( a 0 , a i + 1 ) < d G ( a 0 , a j ) d G ( a 0 , e 2 ) , a contradiction to Equation (4).
Case 1.1. j [ 1 , j 1 ] . Then, d G ( a 0 , e 2 ) = j + m 2 and d G ( a j , e 2 ) = j j + m 2 . If i j , then either d G ( a 0 , e 1 ) < d G ( a 0 , e 2 ) (when i < j ) or d G ( a j , e 1 ) < d G ( a j , e 2 ) (when i j ), a contradiction to Equation (4). If j < i 1 2 , then d G ( a 0 , e 1 ) = i and d G ( a j , e 1 ) = i j . By Equation (4), we deduce that j = j , a contradiction. If 1 2 + j < i 1 , then d G ( a 0 , e 1 ) = ( i + 1 ) and d G ( a j , e 1 ) = ( i + 1 ) +j (notice that in this case i does not exist when 1 (mod 2) and j = 1 2 ). By Equation (4), we deduce that j = 0 , a contradiction.
Moving on now to consider 1 2 < i 1 2 + j , it follows that d G ( a 0 , e 1 ) = i 1 and d G ( a j , e 1 ) = i j . Then, by Equation (4), we derive = 2 i + 2 j 2 j + 1 and m 2 = i + j 2 j = 1 2 j . This shows that there does exist a j [ 1 , j 1 ] for which S V ( T a j ) , since if not, T a i contains no branching vertex for every i [ 1 , j 1 ] while T a j has length of at least m 2 + 1 = 1 2 j + 1 , a contradiction to G O e ( , j ) (Definition 2 (iii)). Let w S V ( T a j ) and we will prove that e 1 and e 2 can be distinguished by w.
For this, we construct a new graph G that is obtained from G by subdividing edge e 1 (i.e., delete e 1 , add a new vertex, say a , and join a to a i and a i + 1 ). Let = + 1 and consider G . Clearly, G E ( ) , j [ 1 , 2 2 ] , and S B ( G ) . With regard to C ( G ) , a normal labeling can be obtained based on C ( G ) by relabeling a with a i + 1 and a i with a i + 1 for every i { i + 1 , , 1 } . Notice that j , j [ 1 , j 1 ] , 2 + 1 i + 1 2 + j , d G ( a 0 , w 2 ) = d G ( a 0 , e 2 ) + 1 , and d G ( a j , w 2 ) = d G ( a j , e 2 ) + 1 . Thus, d G ( a 0 , a i + 1 ) = d G ( a 0 , a i ) = d G ( a 0 , e 1 ) + 1 = d G ( a 0 , e 2 ) + 1 = d G ( a 0 , w 2 ) and d G ( a j , a i + 1 ) = d G ( a j , a i ) + 1 = d G ( a j , e 1 ) + 1 = d G ( a j , e 2 ) + 1 = d G ( a j , w 2 ) . Then, by Lemma 5, d G ( w , a i + 1 ) d G ( w , w 2 ) . For graph G (and also for G ), if e 2 is on P w , a j , then clearly d G ( w , e 2 ) < d G ( w , e 1 ) . We therefore assume that e 2 is not on P w , a j , which implies that d G ( w , e 2 ) = d G ( w , w 1 ) = d G ( w , w 2 ) 1 = d G ( w , w 2 ) 1 . Additionally, when (in G ) i + 1 j 2 , it holds that (in G) i j 1 2 and hence d G ( w , e 1 ) = d G ( w , a i ) = d G ( w , a i + 1 ) 1 ; when (in G ) i + 1 j > 2 , it holds that (in G) i j > 1 2 and hence d G ( w , e 1 ) = d G ( w , a i + 1 ) = d G ( w , a i + 2 ) = d G ( w , a i + 1 ) 1 . As a conclusion, d G ( w , e 1 ) = d G ( w , a i + 1 ) 1 d G ( w , w 2 ) 1 = d G ( w , e 2 ) .
Case 1.2. 1 2 < j < 1 2 + j . Then, i < j 1 2 + j 1 , and d G ( a 0 , e 2 ) = j + m 2 and d G ( a j , e 2 ) = j j + m 2 . Furthermore, if 0 i 1 2 , then d G ( a 0 , e 1 ) = i , and d G ( a j , e 1 ) = i j (when i j ) or d G ( a j , e 1 ) = j ( i + 1 ) (when i < j ). By Equation (4), we derive m 2 = i j < 0 (when i j ) or m 2 = j + 1 2 < 0 (when i < j ), a contradiction. If 1 2 + 1 i < 1 2 + j 1 , then i j < 2 , and d G ( a 0 , e 1 ) = ( i + 1 ) and d G ( a j , e 1 ) = i j . By Equation (4), we have 2 i = 2 j 1 , a contradiction.
Case 2. e 1 E ( C ) . Let e 1 T a i for some i [ 0 , 1 ] { 0 , j , j } and d G ( a i , e 1 ) = m 1 . Without loss of generality, we assume that i < j . Then, by Equation (4) and Lemma 6, one of the following conditions holds: (i) j [ j + 1 , 2 ] , i > j , and m 1 m 2 = j i ; (ii) j [ 2 + 1 , 2 + j ] , i < j , = 2 i + 2 j 2 j , and m 1 m 2 = j i ; (iii) j [ 2 + j + 1 , 1 ] , = 2 ( i j ) , and m 1 m 2 = i j ; or i > 2 + j and m 1 m 2 = i j .
For (i), by G O e ( , j ) E e ( , j ) (Definition 2 (ii)), we deduce that m 1 = 0 and m 2 = i j < 0 , a contradiction. For (ii), we have that 0 (mod 2), j = 2 + j i , and m 1 = 2 j + m 2 2 j (which implies that the length of T a i is at least m 1 + 1 2 j + 1 ). Therefore, by G E e ( , j ) (Definition 2 (iv)), there exists a vertex k [ 1 , j 1 ] such that T a k contains a branching vertex. Thus, S V ( T a k ) , say w S V ( T a k ) . By Lemma 5, x and y can be distinguished by w. For (iii), we have that j + 2 2 + j and | V ( T a j ) | > 1 , a contradiction to G E ( , j ) (Definition 2 (ii)). □
Theorem 2.
Suppose that G is a unicyclic graph such that | A ( S ) | 2 , where S B ( G ) . Label C ( G ) normally and let j = max { i : a i A ( S ) } . S is an edge metric generator if and only if G O e ( , j ) E e ( , j ) or A ( S ) contains three vertices that form a geodesic triple.
Proof. 
The sufficiency follows from Lemmas 2 and 9. Suppose that S is an edge metric generator, and there are not three S-active vertices forming a geodesic triple. This shows that j 2 , and A ( S ) = { a 0 , a j } when j = 2 and G E ( ) (however, in this case d G ( s , a i a i + 1 ) = d G ( s , a i 1 a i ) for every i [ 0 , 2 2 ] and every s S , where a = a 0 , a contradiction). In the below, we assume that j 1 2 and we will prove that G O ( , j ) E ( , j ) . To the contrary, if G O e ( 0 , j ) (respectively, G E e ( 0 , j ) ), then at least one of the following conditions (i), (ii), and (iii) (respectively, (i), (ii), and (iv)) holds.
(i)
a 0 or a j is a bad vertex.
(ii)
When j < 1 2 , there exists a k ( { 1 , , ( 1 2 j ) } { j + 1 , , j + ( 1 2 j ) such that | V ( T a k ) | > 1 .
(iii)
When j > 1 and T a k contains no branching vertex for every k [ 1 , j 1 ] , there exists a k [ 1 , j 1 ] such that T a k is a path of length at least + 1 2 j .
(iv)
When j > 1 and both T a i and T a i contain no branching vertex for every i [ 1 , j 1 ] and i = 2 + j i , there exists a k [ 1 , j 1 ] and a k = 2 + j k such that | V ( T a k ) | > 1 and T a k has length at least 2 j + 1 .
For (i), suppose that a 0 is a bad vertex. By the selection of S, there is a thread T attached to a 0 such that V ( T ) S = . Let u V ( T ) such that u a 0 E ( G ) . Then, d G ( s , u a 0 ) = j + d G ( s , a j ) = d G ( s , a 1 a 0 ) for any s S ( 0 j j V ( T a j ) ) . Therefore, S cannot distinguish u a 0 and a 1 a 0 .
For (ii), consider the vertex u V ( T a k ) that is adjacent to a k . If k { 1 , , ( 1 2 j ) } , then k 1 1 2 + j , and hence d ( s , u a k ) = ( k ) + j + d G ( s , a 0 ) = d ( s , a k 1 a k ) for any s S ( 0 j j V ( T a j ) ) . Therefore, S cannot distinguish u a k and a k 1 a k . If k { j + 1 , , j + ( 1 2 j ) , then d G ( s , u a k ) = d G ( s , a k ) = d ( s , a k a k + 1 ) for any s S ( 0 j j V ( T a j ) ) . Therefore, S cannot distinguish u a k and a k a k + 1 .
For (iii), 1 (mod 2) and S contains only vertices in V ( T a 0 ) V ( T a j ) . Let u u E ( T a k ) be the edge that has distance 1 2 j with a k . Consider edge a k a k + 1 where k = 1 2 + j k . Observe that k [ 1 , j 1 ] ; we have k = 1 2 k + j > 1 2 and k j < 1 2 . Therefore, d G ( s , a k a k + 1 ) = ( k + 1 ) + d G ( a 0 , s ) = 1 2 j + k + d G ( a 0 , s ) = d G ( s , u u ) for any s S V ( T a 0 ) and d G ( s , a k a k + 1 ) = k j + d G ( a j , s ) = ( 1 2 j ) + ( j k ) + d G ( a j , s ) = d G ( s , u u ) for any s S V ( T a j ) . Therefore, S cannot distinguish u u and a k a k + 1 .
For (iv), 0 (mod 2) and S contains only vertices in V ( T a 0 ) V ( T a j ) . Let u u E ( T a k ) be the edge that has distance exactly 2 j with a k , and v a k E ( T a k ) , where k = 2 + j k . Observe that k [ 1 , j 1 ] . We have that k > 2 and k j < 2 . Therefore, d G ( s , v a k ) = k + d G ( a 0 , s ) = ( 2 j ) + k + d G ( a 0 , s ) = d G ( s , u u ) for any s S V ( T a 0 ) and d G ( s , v a k ) = k j + d G ( a j , s ) = ( 2 j ) + ( j k ) + d G ( a j , s ) = d G ( s , u u ) for any s S V ( T a j ) . Therefore, S cannot distinguish u u and v a k . □
Again, since for every two distinct vertices a p , a q V ( C ) we can always find a vertex a r V ( C ) { a p , a q } such that a p , a q , a r form a geodesic triple, it follows by Lemmas 1 and 2 that 2 ≤ edim(G) 3 when L ( G ) = 0 , L ( G ) + 1 edim(G) L ( G ) + 2 when L ( G ) = 1 , and L ( G ) edim(G) L ( G ) + 1 when L ( G ) 2 . Thus, the following result holds by Theorem 2.
Corollary 2.
Given a unicyclic graph G and S B ( G ) , we label C ( G ) normally and let j = max { i : a i A ( S ) } when | A ( S ) | 2 . Then,
(1) 
When A ( S ) = , if there are two vertices on C , say a 0 and a j , such that G O e ( , j ) E e ( , j ) , then edim(G) = 2; otherwise edim(G) = 3.
(2) 
When | A ( S ) | = 1 , let A ( S ) = { a k } . If there exists a vertex a k V ( C ) { a k } such that G O e ( , k ) E e ( , k ) (let k = 0 ) or G O e ( , k ) E e ( , k ) (let k = 0 ), then edim(G)= L ( G ) + 1 ; otherwise, edim(G) = L ( G ) + 2.
(3) 
When | A ( S ) | 2 , if G O e ( 0 , j ) E e ( 0 , j ) or A ( S ) contains three vertices that form a geodesic triple, then edim(G)= L ( G ) ; otherwise, edim(G) = L ( G ) + 1 .

5. Remarks and Conclusions

According to Definitions 1 and 2, we see that O e ( , j ) O ( , j ) and E ( , j ) E e ( , j ) . Therefore, by Corollaries 1 and 2, we can determine the relation between metric dimension and edge metric dimension for unicyclic graphs, as shown in Table 1, and give an answer to Problems 1 and 2. Indeed, by Table 1, we can generate an efficient algorithm to compute the value of dim ( G ) , edim ( G ) , and dim ( G ) edim ( G ) .
It is worth re-emphasizing here that although Sedlar and Škrekovski in [1] described a method to determine the (edge) metric dimension of unicyclic graphs, our work differs from theirs in a number of respects. First, our motivation to construct the four families of graphs was to characterize the structures of graphs G with dim ( G ) = L ( G ) and edim ( G ) = L ( G ) , respectively, which is different from that in [1] (indeed, our approach is completely opposite to that in [1]). Second, in the case of | A ( S ) | 2 , based on the four families of graphs that we constructed, we obtained a necessary and sufficient condition for a set of vertices to be a metric (respectively, edge metric) generator of a unicyclic graph (Theorems 1 and 2). Third, in the case of | A ( S ) | < 2 , we used a straightforward way to determine (edge) metric dimension, while in [1], the authors introduced an indirect definition based on their configurations to accomplish this, namely, A B C -positivity and A B C -negativity (a similar definition for edge metric dimension).
Our approach is more intuitive than the method in [1] and our discussions give a more thorough analysis on (edge) metric generator of a unicyclic graph (we characterize necessary and sufficient conditions for a vertex subset to be a (edge) metric generator). Moreover, our result can also be used to analyze dimensions for cactus graphs, which is left as future work. What follows is a direct application to a class of double-cyclic graphs.
A double-cyclic graph is a graph that contains exactly two edge disjoint cycles. Similarly, for a double-cyclic graph G, a branch-resolving set of G is a set S V ( G ) such that for every 3 + -vertex v, at least | S ( v ) | 1 threads in S ( v ) contain a vertex of S, where S ( v ) is the set of threads that are attached to v, and
L ( G ) = v V ( G ) , | S ( v ) | > 1 ( | S ( v ) | 1 ) .
Clearly, dim ( G ) L ( G ) . Here, we consider a special class of double-cyclic graphs, which are defined as follows.
Definition 3.
Let G 1 and G 2 be two unicyclic graphs such that for i = 1 , 2 , G i O ( , j ) E ( , j ) and | A ( S i ) | 2 for S i B ( G i ) . Now, we construct a class of double-cyclic graph, denoted by D , by connecting two vertices (say x and y respectively, where x V ( G 1 ) and y V ( G 2 ) by an path P x , y with ends x and y such that the resulting graph G satisfies L ( G ) = L ( G 1 ) + L ( G 2 ) . See Figure 3 for an example.
Lemma 10.
Let G D and G i , i = 1 , 2 , is the unicyclic graph defined in Definition 3. Let S i B ( G i ) for i = 1 , 2 . If | A ( S i ) | 2 , then any two vertexes u and v such that u V ( G 1 ) and v V ( G 2 ) can be distinguished by S 1 S 2 .
Proof. 
Denote by u and v the masters of u and v, respectively. Let s S 1 and s is the master of s. Then, d G ( s , u ) = d G ( s , s ) + d G ( s , u ) + d G ( u , u ) and d G ( s , v ) = d G ( s , s ) + d G ( s , x ) + d G ( x , y ) + d G ( y , v ) + d G ( v , v ) . Let t S 2 and t is the master of t.
Notice that d G ( s , u ) d G ( s , x ) + d G ( x , u ) . If d G ( s , u ) = d G ( s , v ) , then d G ( x , u ) + d G ( u , u ) d G ( x , y ) + d G ( y , v ) + d G ( v , v ) . On the other hand, d G ( t , v ) = d G ( t , t ) + d G ( t , v ) + d G ( v , v ) and d G ( t , u ) = d G ( t , t ) + d G ( t , y ) + d G ( y , x ) + d G ( x , u ) + d G ( u , u )   d G ( t , t ) + d G ( t , y ) + d G ( y , x ) + d G ( x , y ) + d G ( y , v ) + d G ( v , v ) = d G ( t , t ) + d G ( t , y ) + 2 d G ( x , y ) + d G ( y , v ) + d G ( v , v ) . Now, suppose that d G ( t , v ) = d G ( t , u ) . We have that d G ( t , v ) d G ( t , y ) + 2 d G ( x , y ) + d G ( y , v ) . Observe that d G ( x , y ) > 0 . It follows that y is not on the path P t , v . Then, d G ( t , v ) d G ( t , y ) + d G ( y , v ) , which indicates that d G ( t , v ) < d G ( t , y ) + 2 d G ( x , y ) + d G ( y , v ) , a contradiction. Thus, d G ( t , v ) d G ( t , u ) . □
Theorem 3.
Let G D , and G i , i = 1 , 2 , is the unicyclic graph defined in Definition 3. Let S i B ( G i ) for i = 1 , 2 . If | A ( S i ) | 2 , then, dim(G) = dim( G 1 ) + dim( G 2 ) = L( G 1 ) + L( G 2 ).
Proof. 
Since G i O ( , j ) E ( , j ) and | A ( S i ) | 2 for i = 1 , 2 , it follows by Lemma 8 that S i is a metric generator of G i and | S i | = dim( G i ) = L( G i ). Let u and v be any two vertices in G. If u and v belong to the same G i for some i { 1 , 2 } , then they can be distinguished by S i . If one of u and v belongs to P x , y , say u, then they can be distinguished by S 1 (when v V ( G 2 ) ) or S 2 (when v V ( G 1 ) ). If u and v belong to G 1 and G 2 , respectively, then by Lemma 10 they can be distinguished by S 1 S 2 . This implies that dim(G) ≤ dim( G 1 ) + dim( G 2 ) = L( G 1 ) + L( G 2 ). On the other hand, since L ( G ) = L ( G 1 ) + L ( G 2 ) , we have that dim(G) ≥ L( G 1 ) + L( G 2 ) = dim( G 1 ) + dim( G 2 ). Therefore, the conclusion holds. □

Author Contributions

Conceptualization, E.Z. and S.P.; investigation, E.Z., S.P. and C.L.; methodology, E.Z. and S.P.; supervision, C.L.; writing—original draft, E.Z. and S.P.; writing—review and editing, E.Z. and C.L. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the National Natural Science Foundation of China under Grants 61872101 and 62102058, in part by the Natural Science Foundation of Guangdong Province of China, under Grant 2021A1515011940, and in part by the Science and Technology Projects in Guangzhou of China.

Data Availability Statement

Not applicable.

Acknowledgments

The authors express their gratitude to the anonymous referees for their constructive comments and remarks, which helped to improve the readability and the correctness of this paper.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Sedlar, J.; Škrekovski, R. Vertex and edge metric dimensions of unicyclic graphs. Discret. Appl. Math. 2022, 314, 81–92. [Google Scholar] [CrossRef]
  2. Slater, P.J. Leaves of trees. Congr. Numer. 1975, 14, 549–559. [Google Scholar]
  3. Harary, F.; Melter, R.A. On the metric dimension of a graph. Ars Comb. 1976, 2, 191–195. [Google Scholar]
  4. Melter, R.A.; Tomescu, I. Metric bases in digital geometry. Comput. Vis. Graph. Image Process. 1984, 25, 113–121. [Google Scholar] [CrossRef]
  5. 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]
  6. Khuller, S.; Raghavachari, B.; Rosenfeld, A. Landmarks in graphs. Discret. Appl. Math. 1996, 70, 217–229. [Google Scholar] [CrossRef]
  7. Kelenc, A.; Tratnik, N.; Yero, I.G. Uniquely identifying the edges of a graph: The edge metric dimension. Discret. Appl. Math. 2018, 251, 204–220. [Google Scholar] [CrossRef]
  8. Zubrilina, N. On the edge dimension of a graph. Discret. Math. 2018, 341, 2083–2088. [Google Scholar] [CrossRef]
  9. Zhu, E.; Taranenko, A.; Shao, Z.; Xu, J. On graphs with the maximum edge metric dimension. Discret. Appl. Math. 2019, 257, 317–324. [Google Scholar] [CrossRef]
  10. Filipović, V.; Kartelj, A.; Kratica, J. Edge metric dimension of some generalized Petersen graphs. Results Math. 2019, 74, 1–15. [Google Scholar] [CrossRef]
  11. Wang, D.G.; Wang, M.M.; Zhang, S. Determining the edge metric dimension of the generalized Petersen graph P (n, 3). J. Comb. Optim. 2022, 43, 460–496. [Google Scholar] [CrossRef]
  12. Zhang, Y.; Gao, S. On the edge metric dimension of convex polytopes and its related graphs. J. Comb. Optim. 2020, 39, 334–350. [Google Scholar] [CrossRef]
  13. Ahsan, M.; Zahid, Z.; Zafar, S.; Rafiq, A.; Sindhu, M.S.; Umar, M. Computing the edge metric dimension of convex polytopes related graphs. J. Math. Comput. Sci. 2021, 22, 174–188. [Google Scholar] [CrossRef]
  14. Peterin, I.; Yero, I.G. Edge metric dimension of some graph operations. Bull. Malays. Math. Sci. Soc. 2020, 43, 2465–2477. [Google Scholar] [CrossRef]
  15. Koam, A.N.; Ahmad, A.; Ibrahim, M.; Azeem, M. Edge metric and fault-tolerant edge metric dimension of hollow coronoid. Mathematics 2021, 9, 1405. [Google Scholar] [CrossRef]
  16. Singh, P.; Sharma, S.; Sharma, S.K.; Bhat, V.K. Metric dimension and edge metric dimension of windmill graphs. AIMS Math. 2021, 6, 9138–9153. [Google Scholar] [CrossRef]
  17. Deng, B.; Nadeem, M.F.; Azeem, M. On the edge metric dimension of different families of möbius networks. Math. Probl. Eng. 2021, 2021, 6623208. [Google Scholar] [CrossRef]
  18. Wei, M.; Yue, J.; Chen, L. The effect of vertex and edge deletion on the edge metric dimension of graphs. J. Comb. Optim. 2022, 44, 331–342. [Google Scholar] [CrossRef]
  19. Iqbal, T.; Rafiq, M.; Azhar, M.N.; Salman, M.; Khalid, I. On the Edge Resolvability of Double Generalized Petersen Graphs. J. Math. 2022, 2022, 6490698. [Google Scholar] [CrossRef]
  20. Knor, M.; Majstorović, S.; Toshi, A.T.M.; Škrekovski, R.; Yero, I.G. Graphs with the edge metric dimension smaller than the metric dimension. Appl. Math. Comput. 2021, 401, 126076. [Google Scholar] [CrossRef]
  21. Sedlar, J.; Škrekovski, R. Bounds on metric dimensions of graphs with edge disjoint cycles. Appl. Math. Comput. 2021, 396, 125908. [Google Scholar] [CrossRef]
Figure 1. (a) Even-(10,1); (b) even-(12,4); (c) odd-(11,2); (d) odd-(13,5).
Figure 1. (a) Even-(10,1); (b) even-(12,4); (c) odd-(11,2); (d) odd-(13,5).
Mathematics 10 03539 g001
Figure 2. (a) Edge-even-(10,1); (b) edge-even-(12,4); (c) edge-odd-(11,2); (d) edge-odd-(13,5).
Figure 2. (a) Edge-even-(10,1); (b) edge-even-(12,4); (c) edge-odd-(11,2); (d) edge-odd-(13,5).
Mathematics 10 03539 g002
Figure 3. A double-cyclic graph, where G 1 and G 2 are odd- ( 13 , 6 ) graphs.
Figure 3. A double-cyclic graph, where G 1 and G 2 are odd- ( 13 , 6 ) graphs.
Mathematics 10 03539 g003
Table 1. Metric dimension and edge metric dimension of unicyclic graphs, and their relation. When A ( S ) does not contain three vertices that form a geodesic triple, we make the following assumptions: if | A ( S ) | 2 , C is labeled normally (which means that a 0 A ( S ) ) and let j = max { i | a i is S-active}; if | A ( S ) | = 1 , let A ( S ) = { a k } , k [ 0 , 1 ] . In addition, we denote by R 1 : C contains two vertices, say a 0 and a k , such that G O e ( , k ) ; R 2 : there is a a k V ( C ) { a k } such that G O e ( , k ) (when let k = 0 ) or G O e ( , k ) (when let k = 0 ); R 3 : G O e ( , j ) or G O ( , j ) ; R 4 : there are two vertices on C (say a 0 and a k ) such that G E ( , k ) , or for every two vertices (also say a 0 and a k ) on C , G E e ( , k ) ; R 5 : there exists a a k V ( C ) { a k } such that G E ( , k ) when let k = 0 (or G E ( , k ) when let k = 0 ), or for every a k V ( C ) { a k } ) G E e ( , k ) (when let k = 0 ) and G E e ( , k ) (when let k = 0 ); R 6 : G E ( , j ) or G E e ( , j ) ; and ¬ R i denotes the negative of R i for i [ 1 , 6 ] .
Table 1. Metric dimension and edge metric dimension of unicyclic graphs, and their relation. When A ( S ) does not contain three vertices that form a geodesic triple, we make the following assumptions: if | A ( S ) | 2 , C is labeled normally (which means that a 0 A ( S ) ) and let j = max { i | a i is S-active}; if | A ( S ) | = 1 , let A ( S ) = { a k } , k [ 0 , 1 ] . In addition, we denote by R 1 : C contains two vertices, say a 0 and a k , such that G O e ( , k ) ; R 2 : there is a a k V ( C ) { a k } such that G O e ( , k ) (when let k = 0 ) or G O e ( , k ) (when let k = 0 ); R 3 : G O e ( , j ) or G O ( , j ) ; R 4 : there are two vertices on C (say a 0 and a k ) such that G E ( , k ) , or for every two vertices (also say a 0 and a k ) on C , G E e ( , k ) ; R 5 : there exists a a k V ( C ) { a k } such that G E ( , k ) when let k = 0 (or G E ( , k ) when let k = 0 ), or for every a k V ( C ) { a k } ) G E e ( , k ) (when let k = 0 ) and G E e ( , k ) (when let k = 0 ); R 6 : G E ( , j ) or G E e ( , j ) ; and ¬ R i denotes the negative of R i for i [ 1 , 6 ] .
A Unicyclic Graph G and S B ( G ) dim ( G ) edim ( G ) dim ( G ) - edim ( G )
A ( S ) contains three vertices
forming a geodesic triple
L ( G ) L ( G ) 0
A ( S )
contains
no
three
vertices
forming
a
geodesic
triple
1
(mod 2)
| A ( S ) | = 0 R 1 220
¬ R 1 23−1
| A ( S ) | = 1 R 2 L ( G ) + 1 L ( G ) + 1 0
¬ R 2 L ( G ) + 1 L ( G ) + 2 −1
| A ( S ) | 2 R 3 L ( G ) (or L(G) + 1) L ( G ) (or L ( G )  + 1)0
¬ R 3 L ( G ) L ( G )  + 1−1
0
(mod 2)
| A ( S ) | = 0 R 4 2 (or 3)2 (or 3)0
¬ R 4 321
| A ( S ) | = 1 R 5 L ( G ) + 1 (or L ( G )  + 2) L ( G ) + 1 (or L ( G )  + 2)0
¬ R 5 L ( G ) + 2 L ( G ) + 1 1
| A ( S ) | 2 R 6 L ( G ) (or L(G) + 1) L ( G ) (or L ( G ) + 1)0
¬ R 6 L ( G ) + 1 L ( G ) 1
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Zhu, E.; Peng, S.; Liu, C. Identifying the Exact Value of the Metric Dimension and Edge Dimension of Unicyclic Graphs. Mathematics 2022, 10, 3539. https://doi.org/10.3390/math10193539

AMA Style

Zhu E, Peng S, Liu C. Identifying the Exact Value of the Metric Dimension and Edge Dimension of Unicyclic Graphs. Mathematics. 2022; 10(19):3539. https://doi.org/10.3390/math10193539

Chicago/Turabian Style

Zhu, Enqiang, Shaoxiang Peng, and Chanjuan Liu. 2022. "Identifying the Exact Value of the Metric Dimension and Edge Dimension of Unicyclic Graphs" Mathematics 10, no. 19: 3539. https://doi.org/10.3390/math10193539

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop