Maxdistance is calculated by de average edge length.