SciPy

scipy.cluster.hierarchy.is_monotonic

scipy.cluster.hierarchy.is_monotonic(Z)[source]

Returns True if the linkage passed is monotonic.

The linkage is monotonic if for every cluster \(s\) and \(t\) joined, the distance between them is no less than the distance between any previously joined clusters.

Parameters:

Z : ndarray

The linkage matrix to check for monotonicity.

Returns:

b : bool

A boolean indicating whether the linkage is monotonic.