def METHOD_NAME(dist_matrix):
    """Calculate the average distance to each points nearest neighbors.
    Parameters
    ----------
    dist_matrix: a csr_matrix
        A distance matrix (usually umap_model.graph_)
    Returns
    -------
    An array with the average distance to each points nearest neighbors
    """
    (row_idx, col_idx, val) = scipy.sparse.find(dist_matrix)
    # Count/sum is done per row
    count_non_zero_elems = np.bincount(row_idx)
    sum_non_zero_elems = np.bincount(row_idx, weights=val)
    averages = sum_non_zero_elems / count_non_zero_elems
    if any(np.isnan(averages)):
        warn(
            "Embedding contains disconnected vertices which will be ignored."
            "Use umap.utils.disconnected_vertices() to identify them."
        )
    return averages