code: def laplacian_calculation(mesh, equal_weight=True):
      
      # get the vertex neighbors from the cache
      neighbors = mesh.vertex_neighbors
      # avoid hitting crc checks in loops
      vertices = mesh.vertices.view(np.ndarray)
  
      # stack neighbors to 1D arrays
      col = np.concatenate(neighbors)
      row = np.concatenate([[i] * len(n)
                            for i, n in enumerate(neighbors)])
  
      if equal_weight:
          # equal weights for each neighbor
          data = np.concatenate([[1.0 / len(n)] * len(n)
                                 for n in neighbors])
      else:
          # umbrella weights, distance-weighted
          # use dot product of ones to replace array.sum(axis=1)
          ones = np.ones(3)
          # the distance from verticesex to neighbors
          norms = [1.0 / np.sqrt(np.dot((vertices[i] - vertices[n]) ** 2, ones))
                   for i, n in enumerate(neighbors)]
          # normalize group and stack into single array
          data = np.concatenate([i / i.sum() for i in norms])
  
      # create the sparse matrix
      matrix = coo_matrix((data, (row, col)),
                          shape=[len(vertices)] * 2)
  
      return matrix
docs: Calculate a sparse matrix for laplacian operations.
  
      Parameters
      -------------
      mesh : trimesh.Trimesh
        Input geometry
      equal_weight : bool
        If True, all neighbors will be considered equally
        If False, all neightbors will be weighted by inverse distance
  
      Returns
      ----------
      laplacian : scipy.sparse.coo.coo_matrix
        Laplacian operator