code: def assert_condensed_trees(sk_agg, min_cluster_size):
      """
      Because of differences in the renumbering and sort ordering,
      the condensed tree arrays from cuml and scikit-learn cannot
      be compared directly. This function performs a BFS through
      the condensed trees, comparing the cluster sizes and lambda
      values at each level of the trees.
      """
  
      slt = sk_agg.single_linkage_tree_._linkage
  
      condensed_tree = condense_hierarchy(slt, min_cluster_size)
  
      cu_parents = condensed_tree._raw_tree["parent"]
      sk_parents = sk_agg.condensed_tree_._raw_tree["parent"]
  
      cu_children = condensed_tree._raw_tree["child"]
      sk_children = sk_agg.condensed_tree_._raw_tree["child"]
  
      cu_lambda = condensed_tree._raw_tree["lambda_val"]
      sk_lambda = sk_agg.condensed_tree_._raw_tree["lambda_val"]
  
      cu_child_size = condensed_tree._raw_tree["child_size"]
      sk_child_size = sk_agg.condensed_tree_._raw_tree["child_size"]
  
      # Start at the root, perform bfs
  
      l2_cu = [1000]
      l2_sk = [1000]
  
      lev = 1
      while len(l2_cu) != 0 or len(l2_sk) != 0:
          l2_cu = get_bfs_level(
              lev, [1000], cu_parents, cu_children, cu_lambda
          )
          l2_sk = get_bfs_level(
              lev, [1000], sk_parents, sk_children, sk_lambda
          )
  
          s2_cu = get_bfs_level(
              lev, [1000], cu_parents, cu_children, cu_child_size
          )
          s2_sk = get_bfs_level(
              lev, [1000], sk_parents, sk_children, sk_child_size
          )
  
          s2_cu.sort()
          s2_sk.sort()
          l2_cu.sort()
          l2_sk.sort()
  
          lev += 1
  
          assert np.allclose(l2_cu, l2_sk, atol=1e-5, rtol=1e-6)
          assert np.allclose(s2_cu, s2_sk, atol=1e-5, rtol=1e-6)
      assert lev > 1
  
imports: from cuml.internals.safe_imports import gpu_only_import
  from sklearn.model_selection import train_test_split
  from sklearn import datasets
  from hdbscan.plots import CondensedTree
  import hdbscan
  from cuml.internals import logger
  import pytest
  from cuml.cluster.hdbscan import HDBSCAN, condense_hierarchy
  from cuml.cluster.hdbscan.prediction import all_points_membership_vectors, approximate_predict, membership_vector
  from sklearn.datasets import make_blobs
  from cuml.metrics import adjusted_rand_score
  from cuml.testing.utils import get_pattern, array_equal
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 4 for calling a global function with example usage: assert_condensed_trees(sk_agg, min_cluster_size) without return types