(
        tree: Tree, distances: numpy.ndarray, progress_callback=_undef
)
return tree_from_linkage(Zopt)
Order the leaves in the clustering tree.

    :param Tree tree:
        Binary hierarchical clustering tree.
    :param numpy.ndarray distances:
        A (N, N) numpy.ndarray of distances that were used to compute
        the clustering.

    .. seealso:: scipy.cluster.hierarchy.optimal_leaf_ordering
Order the leaves in the clustering tree.
Order the leaves in the clustering tree .
def optimal_leaf_ordering(
        tree: Tree, distances: numpy.ndarray, progress_callback=_undef
) -> Tree:
    """
    Order the leaves in the clustering tree.

    :param Tree tree:
        Binary hierarchical clustering tree.
    :param numpy.ndarray distances:
        A (N, N) numpy.ndarray of distances that were used to compute
        the clustering.

    .. seealso:: scipy.cluster.hierarchy.optimal_leaf_ordering
    """
    if progress_callback is not _undef:
        warnings.warn(
            "'progress_callback' parameter is deprecated and ignored. "
            "Passing it will raise an error in the future.",
            FutureWarning, stacklevel=2
        )
    Z = linkage_from_tree(tree)
    y = condensedform(numpy.asarray(distances))
    Zopt = scipy.cluster.hierarchy.optimal_leaf_ordering(Z, y)
    return tree_from_linkage(Zopt)
def optimal_leaf_ordering ( tree : Tree , distances : numpy . ndarray , progress_callback = _undef ) -> Tree : if progress_callback is not _undef : warnings . warn ( "'progress_callback' parameter is deprecated and ignored. " "Passing it will raise an error in the future." , FutureWarning , stacklevel = 2 ) Z = linkage_from_tree ( tree ) y = condensedform ( numpy . asarray ( distances ) ) Zopt = scipy . cluster . hierarchy . optimal_leaf_ordering ( Z , y ) return tree_from_linkage ( Zopt )