An important feature of agglomerative hierarchical clustering is the possibility to include connectivity constraints to force the merging of specific samples. This kind of prior knowledge is very common in contexts where there are strong relationships between neighbors or when we know that some samples must belong to the same cluster because of their intrinsic properties. To achieve this goal, we need to use a connectivity matrix, A ∈ {0, 1}n × n:
In general, A is the adjacency matrix induced by a graph of the dataset; however, the only important requirement is the absence of isolated samples (without connections), because they cannot be merged in any way. The connectivity matrix is applied during the initial merging stages and forces the algorithm to aggregate the specified samples. As the following agglomerations don't impact on connectivity...