code: def edge_to_connected_graph(edges, num):
      parent = list(range(num))
      for u, v in edges:
          p_u = _find_parent(parent, u)
          p_v = _find_parent(parent, v)
          parent[p_u] = p_v
  
      for i in range(num):
          parent[i] = _find_parent(parent, i)
      remap = {}
      uf = np.unique(np.array(parent))
      for i, f in enumerate(uf):
          remap[f] = i
      cluster_id = np.array([remap[f] for f in parent])
      return cluster_id
  
file_path: dgl/examples/pytorch/hilander/utils/deduce.py
imports: import dgl
  import numpy
  import torch
  from sklearn import mixture
  from .density import density_to_peaks, density_to_peaks_vectorize
label_desc: Use image node_id 2 for calling a global function with example usage: edge_to_connected_graph(edges, num) and returns: cluster_id