scipy.cluster.hierarchy.DisjointSet.subset_size#

DisjointSet.subset_size(x)[source]#

Get the size of the subset containing x.

Note that this method is faster than len(self.subset(x)) because the size is directly read off an internal field, without the need to instantiate the full subset.

Parameters:
xhashable object

Input element.

Returns:
resultint

Size of the subset containing x.