code: def consolidate(self):
      
      nodes = self.vertices
      edges = self.edges 
      radii = self.radii
      vertex_types = self.vertex_types
  
      if self.empty():
        return PrecomputedSkeleton()
      
      eff_nodes, uniq_idx, idx_representative = np.unique(
        nodes, axis=0, return_index=True, return_inverse=True
      )
  
      edge_vector_map = np.vectorize(lambda x: idx_representative[x])
      eff_edges = edge_vector_map(edges)
      eff_edges = np.sort(eff_edges, axis=1) # sort each edge [2,1] => [1,2]
      eff_edges = eff_edges[np.lexsort(eff_edges[:,::-1].T)] # Sort rows 
      eff_edges = np.unique(eff_edges, axis=0)
      eff_edges = eff_edges[ eff_edges[:,0] != eff_edges[:,1] ] # remove trivial loops
  
      radii_vector_map = np.vectorize(lambda idx: radii[idx])
      eff_radii = radii_vector_map(uniq_idx)
  
      vertex_type_map = np.vectorize(lambda idx: vertex_types[idx])
      eff_vtype = vertex_type_map(uniq_idx)  
        
      return PrecomputedSkeleton(eff_nodes, eff_edges, eff_radii, eff_vtype, segid=self.id)
docs: Remove duplicate vertices and edges from this skeleton without
      side effects.
  
      Returns: new consolidated PrecomputedSkeleton