code: def __init__(
      self,
      features,
      labels,
      cluster_features=None,
      k=10,
      levels=1,
      faiss_gpu=False,
  ):
      self.k = k
      self.gs = []
      self.nbrs = []
      self.dists = []
      self.levels = levels
  
      # Initialize features and labels
      features = l2norm(features.astype("float32"))
      global_features = features.copy()
      if cluster_features is None:
          cluster_features = features
      global_num_nodes = features.shape[0]
      global_edges = ([], [])
      global_peaks = np.array([], dtype=np.long)
      ids = np.arange(global_num_nodes)
  
      # Recursive graph construction
      for lvl in range(self.levels):
          if features.shape[0] <= self.k:
              self.levels = lvl
              break
          if faiss_gpu:
              knns = build_knns(features, self.k, "faiss_gpu")
          else:
              knns = build_knns(features, self.k, "faiss")
          dists, nbrs = knns2ordered_nbrs(knns)
          self.nbrs.append(nbrs)
          self.dists.append(dists)
          density = density_estimation(dists, nbrs, labels)
  
          g = self._build_graph(
              features, cluster_features, labels, density, knns
          )
          self.gs.append(g)
  
          if lvl >= self.levels - 1:
              break
  
          # Decode peak nodes
          (
              new_pred_labels,
              peaks,
              global_edges,
              global_pred_labels,
              global_peaks,
          ) = decode(
              g,
              0,
              "sim",
              True,
              ids,
              global_edges,
              global_num_nodes,
              global_peaks,
          )
          ids = ids[peaks]
          features, labels, cluster_features = build_next_level(
              features,
              labels,
              peaks,
              global_features,
              global_pred_labels,
              global_peaks,
          )
  
file_path: dgl/examples/pytorch/hilander/dataset/dataset.py
imports: import pickle
  import numpy
  import torch
  from utils import build_knns, build_next_level, decode, density_estimation, fast_knns2spmat, knns2ordered_nbrs, l2norm, row_normalize, sparse_mx_to_indices_values
  import dgl
label_desc: Use image node_id 1 to create a new LanderDataset object from inherited base classes: object with example: obj = LanderDataset(features, labels, cluster_features, k, levels, faiss_gpu)