The metric dimension of a graph is the smallest number of vertices from which the vector of distances to every vertex in the graph is unique. It may be regarded as a generalization of the concept of trilateration in the two-dimensional real plane, the idea underpinning the Global Positioning System (GPS).
DefinitionLet G be a graph with vertex set V and edge set E, and let d(u, v) denote the shortest path or geodesic distance between two vertices u, v ∈ V . G is not forced to be simple (though all examples in this article are) and may contain weighted edges, multi-edges, or self loops.In this case r is said to resolve or distinguish u and v. By definition, if an ordering on the vertices of R = {r 1 , . . . , r n } is given, any u ∈ V may be uniquely represented by the vector Φ R (u) := (d(u, r 1 ), . . . , d(u, r n )) (see Figure 1). The metric dimension of G, denoted β(G), is the smallest size of resolving sets on G; formally, β(G) = min{|R| : R ⊆ V, R is resolving}. If R is a resolving set on G and |R| = β(G), R is called a minimal resolving set of G, also called a basis set, or reference set [12,22].Intuitively, this concept is closely related to that employed by the Global Positioning System (GPS), called trilateration, where the location of any object on Earth can be determined by its distances to three satellites in orbit. More generally, given a point x ∈ R 2 , we may partition the space into equivalence classes of points with equal Euclidean distance to x, where y, z ∈ R 2 belong to the same class if and only if d(y, x) = d(z, x) (these classes form circles centered at x). A set of points R ⊂ R 2 may be used to partition the space in a similar way. Now y and z belong to the same class if and only if d(y, r) = d(z, r) for all r ∈ R. When R contains a subset of three affinely independent points, every point in R 2 belongs to its own equivalence class and R may be said to resolve the plane.
Brute Force CalculationGiven an arbitrary graph G = (V, E), the brute force method for determining β(G) requires that every subset of (β(G) − 1) vertices be established as non-resolving and that at least one resolving set of size β(G) be found. Since β(G) ≤ |V | − 1 [6], starting with sets of size one, |V |−2 k=1 |V | k = O(2 |V | ) subsets must be examined in the worst case. In order to determine whether or not R ⊆ V is resolving, every pair of vertices u, v ∈ V must be compared across |R| distances. This requires O(|R||V | 2 ) time, bringing the total time necessary to find β(G) to |V | 2 |V |−2 k=1 |V | k k = O(|V | 3 2 |V | ).