The distance between two nodes is defined as the length of the shortest path connecting the two nodes.