Skip to content

Metric measure

The fact that a measure is a metric allows optimizations in many applications. For example, many efficient algorithms for searching shortest paths in graphs, such as Dijkstra’s algorithm, make use of the fact that the underlying measure is a metric.

d:U×UR+{0}d: U \times U \rightarrow R^+ \cup \{0\} is called metric if the following holds:

  • d(x,y)0d(x,y) \geq 0 non-negativity
  • d(x,y)=d(y,x)d(x,y) = d(y,x) symmetry
  • x=yd(x,y)=0x = y \Leftrightarrow d(x,y) = 0 identity
  • d(x,z)d(x,y)+d(y,z)d(x,z) \leq d(x,y) + d(y,z) triangle inequality

Metric measure sometimes called (mathematical) distance. But not every string measure which is historically called “distance” is a metric, so it’s better to use word metric to avoid confusion.

Minkowski distance

Minkowski distance is an example of metric measure (not typically used as string measure though, given here as an example)

D(X,Y)=(i=1nxiyip)1pD\left(X,Y\right) = \left(\sum_{i=1}^n |x_i-y_i|^p\right)^{\frac{1}{p}}

where X=(x1,x2,,xn) and Y=(y1,y2,,yn)RnX = (x_1,x_2,\ldots,x_n) \text{ and } Y = (y_1,y_2,\ldots,y_n) \in R^n. For p1p \geq 1 , the Minkowski distance is a metric.

  • p=1p = 1 Manhattan distance
  • p=2p = 2 Euclidean distance
  • pp \rightarrow \infty Chebyshev distance