The distance between nodes is the simple sum of the distances to the closest corresponding nodes. The getDistance() method is used to calculate these distances.