The graph distance
between two vertices
and
of a finite graph
is the minimum length of the paths connecting them (i.e.,
the length of a graph geodesic). If no such path exists (i.e., if the vertices
lie in different connected components), then
the graph distance is set equal to
. In a grid graph the distance
between two vertices is the sum of the "vertical"
and the "horizontal" distances (right figure above).
The matrix
consisting of all distances from graph vertex
to graph
vertex
is known as the all-pairs shortest path matrix, or more simply, the graph
distance matrix.
For a connected graph, summing the distances from a fixed graph vertex to all vertices gives the vertex's vertex transmission. Equivalently, vertex transmissions are the row sums of the graph distance matrix, and half the sum of all vertex transmissions is the Wiener index.