{ } Raw JSON

bundles / scipy 1.17.1 / scipy / cluster / _optimal_leaf_ordering / optimal_leaf_ordering

cython_function_or_method

scipy.cluster._optimal_leaf_ordering:optimal_leaf_ordering

Signature

def   optimal_leaf_ordering ( Z D )

Summary

Compute the optimal leaf order for Z (according to D) and return an optimally sorted Z.

Extended Summary

We start by sorting and relabelling Z and D according to the current leaf order in Z.

This is because when everything is sorted each cluster (including singletons) can be defined by its range over (0...n_points).

This is used extensively to loop efficiently over the various arrays in the algorithm.

Aliases

  • scipy.cluster._optimal_leaf_ordering.optimal_leaf_ordering