code: def lil_cc(lil):
      """Returns the connected components of a graph represented as a
      list of lists
  
      Parameters
      ----------
      lil: a list of list representing the graph neighbors
  
      Returns
      -------
      label a vector of shape len(lil): connected components labelling
  
      Notes
      -----
      Dramatically slow for non-sparse graphs
      """
      n = len(lil)
      visited = np.zeros(n).astype(np.int_)
      label = -np.ones(n).astype(np.int_)
      k = 0
      while (visited == 0).any():
          front = [np.argmin(visited)]
          while len(front) > 0:
              pivot = front.pop(0)
              if visited[pivot] == 0:
                  visited[pivot] = 1
                  label[pivot] = k
                  front += lil[pivot]
          k += 1
      return label
  
imports: import numpy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 7 for calling a global function with example usage: lil_cc(lil) and returns: label