code: def remap_label_ids(labels: np.ndarray) -> np.ndarray:
      """Remaps labels so that the first occurrence of each label ID is in ascending order.
  
      This remapping is to preprocess the labels of the training data for NCP.
      Suppose a dataset has 5 points with cluster labels `[1, 0, 3, 0, 2]`. Due to
      the permutation symmetry between clusters, the cluster IDs are exchangeable.
      A trained NCP model would label this dataset with `[0, 1, 2, 1, 3]`, because
      NCP creates cluster `k` before cluster `k + 1` when processing the data points
      sequentially. Thus, we remap labels in this way to prepare the training data.
  
      Note: If the input labels are not continuous, e.g. missing a cluster due to
      subsampling, the remapped labels will fall into the range `[0,1...k-1]` where
      `k` is the number of unique labels observed in that example. For example, if
      the input labels are `[8, 2, 4, 2, 6]`, the remapped labels will be
      `[0, 1, 2, 1, 3]`.
  
      Arguments:
        labels: A `np.ndarray` of shape `[num_points]`.
  
      Returns:
        remapped_labels: A `np.ndarray` of shape `[num_points]`.
        old_id_to_new_id: A dictionary that maps old cluster IDs to new cluster IDs.
      """
      remapped_labels = np.zeros_like(labels)
      old_id_to_new_id = {}
      next_label_id = 0
      for i, label in enumerate(labels):
          if label not in old_id_to_new_id:
              old_id_to_new_id[label] = next_label_id
              next_label_id += 1
          remapped_labels[i] = old_id_to_new_id[label]
      return remapped_labels, old_id_to_new_id
  
label_desc: Use image node_id 1 for calling a global function with example usage: remap_label_ids(labels) and returns: remapped_labels,  old_id_to_new_id