In the
mathematical
Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
field of
graph theory
In mathematics and computer science, graph theory is the study of ''graph (discrete mathematics), graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of ''Vertex (graph ...
, the distance between two
vertices in a
graph is the number of edges in a
shortest path (also called a graph geodesic) connecting them. This is also known as the geodesic distance or shortest-path distance. Notice that there may be more than one shortest path between two vertices. If there is no
path connecting the two vertices, i.e., if they belong to different
connected components, then conventionally the distance is defined as infinite.
In the case of a
directed graph the distance between two vertices and is defined as the length of a shortest directed path from to consisting of arcs, provided at least one such path exists. Notice that, in contrast with the case of undirected graphs, does not necessarily coincide with âso it is just a
quasi-metric, and it might be the case that one is defined while the other is not.
Related concepts
A
metric space
In mathematics, a metric space is a Set (mathematics), set together with a notion of ''distance'' between its Element (mathematics), elements, usually called point (geometry), points. The distance is measured by a function (mathematics), functi ...
defined over a set of points in terms of distances in a graph defined over the set is called a graph metric.
The vertex set (of an undirected graph) and the distance function form a metric space, if and only if the graph is
connected.
The eccentricity of a vertex is the greatest distance between and any other vertex; in symbols,
:
It can be thought of as how far a node is from the node most distant from it in the graph.
The radius of a graph is the minimum eccentricity of any vertex or, in symbols,
:
The
diameter
In geometry, a diameter of a circle is any straight line segment that passes through the centre of the circle and whose endpoints lie on the circle. It can also be defined as the longest Chord (geometry), chord of the circle. Both definitions a ...
of a graph is the maximum eccentricity of any vertex in the graph. That is, is the greatest distance between any pair of vertices or, alternatively,
:
To find the diameter of a graph, first find the
shortest path between each pair of
vertices. The greatest length of any of these paths is the diameter of the graph.
A central vertex in a graph of radius is one whose eccentricity is —that is, a vertex whose distance from its furthest vertex is equal to the radius, equivalently, a vertex such that .
A peripheral vertex in a graph of diameter is one whose eccentricity is —that is, a vertex whose distance from its furthest vertex is equal to the diameter. Formally, is peripheral if .
A pseudo-peripheral vertex has the property that, for any vertex , if is as far away from as possible, then is as far away from as possible. Formally, a vertex is pseudo-peripheral if, for each vertex with , it holds that .
A
level structure of the graph, given a starting vertex, is a
partition of the graph's vertices into subsets by their distances from the starting vertex.
A
geodetic graph is one for which every pair of vertices has a unique shortest path connecting them. For example, all
trees are geodetic.
[ Ãystein Ore, Theory of graphs rd ed., 1967 Colloquium Publications, American Mathematical Society, p. 104]
The weighted shortest-path distance generalises the geodesic distance to
weighted graphs. In this case it is assumed that the weight of an edge represents its length or, for
complex networks
Complex Networks is an American media and entertainment company for youth culture, based in New York City. It was founded as a bi-monthly magazine, ''Complex'', by fashion designer Marc EckÅ. Complex Networks reports on popular and emerging ...
the cost of the interaction, and the weighted shortest-path distance is the minimum sum of weights across all the
paths connecting and . See the
shortest path problem for more details and algorithms.
Algorithm for finding pseudo-peripheral vertices
Often peripheral
sparse matrix algorithms need a starting vertex with a high eccentricity. A peripheral vertex would be perfect, but is often hard to calculate. In most circumstances a pseudo-peripheral vertex can be used. A pseudo-peripheral vertex can easily be found with the following algorithm:
# Choose a vertex
.
# Among all the vertices that are as far from
as possible, let
be one with minimal
degree.
# If
then set
and repeat with step 2, else
is a pseudo-peripheral vertex.
See also
*
Distance matrix
*
Resistance distance
*
Betweenness centrality
*
Centrality
*
Closeness
*
Degree diameter problem for
graphs and
digraphs
*
Diameter (graph theory)
*
Triameter (graph theory)
*
Metric graph
Notes
{{reflist
Graph theory
Metric geometry