def get_centroid_distance(self, cluster): """ Calculates the centroid-linkage distance between this and another cluster. """ return mam_distances(self._tracks[self.centroid], cluster._tracks[cluster.centroid], self.z_thr, metric="max")
def get_complete_lnk_distance(self, cluster): """ Calculates the complete-linkage distance between this and another cluster. """ max_distance = float("-inf") for Q in self._tracks: for R in cluster._tracks: distance = mam_distances(Q, R, self.z_thr, metric="max") if distance > max_distance: max_distance = distance return max_distance
def get_single_lnk_distance(self, cluster): """ Calculates the single-linkage distance between this and another cluster. """ min_distance = float("inf") for Q in self._tracks: for R in cluster._tracks: distance = mam_distances(Q, R, self.z_thr, metric="max") if distance < min_distance: min_distance = distance return min_distance