In graph theory, the metric dimension of a graph G is the minimum cardinality of a subset S of vertices such that all other vertices are uniquely determined by their distances to the vertices in S. Finding the metric dimension of a graph is an NP-hard problem; the decision version, determining whether the metric dimension is less than a given value, is NP-complete.
For an ordered subset
W=\{w1,w2,...,wk\}
r(v|W)=(d(v,w1),d(v,w2),...,d(v,wk))
If a tree is a path, its metric dimension is one. Otherwise, let L denote the set of leaves, degree-one vertices in the tree. Let K be the set of vertices that have degree greater than two, and that are connected by paths of degree-two vertices to one or more leaves. Then the metric dimension is |L| - |K|. A basis of this cardinality may be formed by removing from L one of the leaves associated with each vertex in K.[1] The same algorithm is valid for the line graph of the tree, and thus any tree and its line graph have the same metric dimension.
In, it is proved that:
Ks+\overline{Kt}(s\geq1,t\geq2)
Ks+(K1\cupKt)(s,t\geq1)
prove the inequality
n\leqD\beta+\beta
D
\beta
\beta
D
D\beta
D\leq3
\beta=1
For specific graph classes, smaller bounds can hold. For example, proved that
n\leq(\betaD+4)(D+2)/8
n=O(D2\beta)
n\leq(D\beta+1)t-1
n=O(D\beta2)
n=O(D\beta)
Deciding whether the metric dimension of a graph is at most a given integer is NP-complete. It remains NP-complete for bounded-degree planar graphs, split graphs, bipartite graphs and their complements, line graphs of bipartite graphs, unit disk graphs, interval graphs of diameter 2 and permutation graphs of diameter 2, and graphs of bounded treewidth.
For any fixed constant k, the graphs of metric dimension at most k can be recognized in polynomial time, by testing all possible k-tuples of vertices, but this algorithm is not fixed-parameter tractable (for the natural parameter k, the solution size). Answering a question posed by, show that the metric dimension decision problem is complete for the parameterized complexity class W[2], implying that a time bound of the form nO(k) as achieved by this naive algorithm is likely optimal and that a fixed-parameter tractable algorithm (for the parameterization by k) is unlikely to exist. Nevertheless, the problem becomes fixed-parameter tractable when restricted to interval graphs, and more generally to graphs of bounded tree-length, such as chordal graphs, permutation graphs or asteroidal-triple-free graphs.
Deciding whether the metric dimension of a tree is at most a given integer can be done in linear time[2] Other linear-time algorithms exist for cographs, chain graphs, and cactus block graphs (a class including both cactus graphs and block graphs). The problem may be solved in polynomial time on outerplanar graphs. It may also be solved in polynomial time for graphs of bounded cyclomatic number, but this algorithm is again not fixed-parameter tractable (for the parameter "cyclomatic number") because the exponent in the polynomial depends on the cyclomatic number. There exist fixed-parameter tractable algorithms to solve the metric dimension problem for the parameters "vertex cover", "max leaf number", and "modular width". Graphs with bounded cyclomatic number, vertex cover number or max leaf number all have bounded treewidth, however it is an open problem to determine the complexity of the metric dimension problem even on graphs of treewidth 2, that is, series–parallel graphs.
The metric dimension of an arbitrary n-vertex graph may be approximated in polynomial time to within an approximation ratio of
2logn
\tbinom{n}{2}
logn+loglog2n+1
(1-\epsilon)logn
\epsilon>0