In the
mathematical field of
graph theory, 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. 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.