Previous topic

angles module

Next topic

coarse_grained_conop module

This Page

clustering module

This module contains functions for performing distance-based clustering. It can be used to perform hierarchical clustering or clustering using the Hoshen-Kopelman algorithm.

ClusterOnPairwiseDistance(view, dist_cutoff=3, prop_name='cluster')[source]

This function clusters the atoms in the view based on the pairwise distances. A pair of atom with a distance lower than dist_cutoff will be part of the same cluster. The clustering scales linearly with the number of atoms, unlike hierarchical clustering.

HierarchicalClusteringOnPairwiseDistance(view, dist_cutoff, prop_name='cluster', method='single')[source]

This function uses the scipy hierarchical clustering to perform clustering of atoms based on their pairwise distance. The same methods as in the scipy.cluster.hierarchy.linkage toolbox are available (‘single’, ‘average’, ‘full’).

HoshenKopelman(neighbor_list)[source]

This function performs a clustering using the Hoshen-Kopelman algorithm. It takes as input a list of neighbors, specifically for node i, neighbor_list[i] is a list of all the neighbors of node i (a list of integers). So if neighbor_list[i]=[2,4,7] means that node i has nodes 2, 4, and 7 as neighbors. It returns a list of integers representing the cluster number for each node