# Diameter of a set

In mathematics, the diameter of a set of points in a metric space is the largest distance between points in the set. As an important special case, the diameter of a metric space is the largest distance between any two points in the space. This generalizes the diameter of a circle, the largest distance between two points on the circle. This usage of diameter also occurs in medical terminology concerning a lesion or in geology concerning a rock.
A bounded set is a set whose diameter is finite. Within a bounded set, all distances are at most the diameter.

## Formal definition

The diameter of an object is the least upper bound (denoted "sup") of the set of all distances between pairs of points in the object. Explicitly, if $S$ is a set of points with distances measured by a metric $\rho$, the diameter is $\operatorname {diam} (S)=\sup _{x,y\in S}\rho (x,y).$

### Of the empty set

The diameter of the empty set is a matter of convention. It can be defined to be zero, $-\infty$, or undefined.

## In Euclidean spaces

For any bounded set in the Euclidean plane or Euclidean space, the diameter of the object or set is the same as the diameter of its convex hull. For any convex shape in the plane, the diameter is the largest distance that can be formed between two opposite parallel lines tangent to its boundary.

### Relation to other measures

The diameter of a circle is exactly twice its radius. However, this is true only for a circle, and only in the Euclidean metric. Jung's theorem provides more general inequalities relating the diameter to the radius. The isodiametric inequality or Bieberbach inequality, a relative of the isoperimetric inequality, states that, for a given diameter, the planar shape with the largest area is a disk, and the three-dimensional shape with the largest volume is a sphere. The polygons of maximum area for a given diameter and number of sides are the biggest little polygons.
Just as the diameter of a two-dimensional convex set is the largest distance between two parallel lines tangent to and enclosing the set, the width is often defined to be the smallest such distance. The diameter and width are equal only for a body of constant width, for which all pairs of parallel tangent lines have the same distance. Every set of bounded diameter in the Euclidean plane is a subset of a body of constant width with the same diameter.

### Computation

The diameter or width of a two-dimensional point set or polygon can be calculated efficiently using rotating calipers. Algorithms for computing diameters in higher-dimensional Euclidean spaces have also been studied in computational geometry; see diameter (computational geometry).

## In differential geometry

In differential geometry, the diameter is an important global Riemannian invariant. Every compact set in a Riemannian manifold, and every compact Riemannian manifold itself, has finite diameter. For instance, the unit sphere of any dimension, viewed as a Riemannian manifold, has diameter $\pi$. This differs from its diameter as a subset of Euclidean space (which would equal two) because, as a Riemannian manifold, distances are measured along geodesics within the manifold.
In a Riemannian manifold whose Ricci curvature has a positive constant lower bound, the diameter is also bounded by Myers's theorem. According to Cheng's maximal diameter theorem, the unique manifold with the largest diameter for a given curvature lower bound is a sphere with that curvature. The theorem is named after Shiu-Yuen Cheng, who published it in 1975.

## In graphs

In graph theory, the diameter of a connected undirected graph is the farthest distance between any two of its vertices. That is, it is the diameter of a set, for the set of vertices of the graph, and for the shortest-path distance in the graph. Diameter may be considered either for weighted or for unweighted graphs. Researchers have studied the problem of computing the diameter, both in arbitrary graphs and in special classes of graphs.
Special cases of graph diameter include the diameter of a group, defined using a Cayley graph with the largest diameter possible for a given group, and the diameter of the flip graph of triangulations of a point set, the minimum number of local moves needed to transform one triangulation into another for two triangulations chosen to be as far apart as possible.