lib5c.algorithms.clustering.enclave module

Module for merging clusters using an enclave-swallowing heuristic.

lib5c.algorithms.clustering.enclave.merge_to_which(clusters)[source]

Determines which other cluster, if any, the first cluster in a list of clusters should be merged into.

Parameters

clusters (list of clusters) – The list of clusters to consider. Ideally, this list should be sorted in ascending order of cluster size.

Returns

The index of the cluster that the first cluster should be merged into. If the cluster should not be merged, the value will be -1.

Return type

int

Notes

Under the enclave heuristic, the condition for merging an orphan cluster into a parent cluster is that the orphan cluster’s peaks must have more adjacent neighbors among the parent cluster’s peaks than among the orphan cluster’s peaks.