code: def laplacian(
      verts: torch.Tensor, edges: torch.Tensor
  ) -> torch.Tensor:
      """
      Computes the laplacian matrix.
      The definition of the laplacian is
      L[i, j] =    -1       , if i == j
      L[i, j] = 1 / deg(i)  , if (i, j) is an edge
      L[i, j] =    0        , otherwise
      where deg(i) is the degree of the i-th vertex in the graph.
  
      Args:
          verts: tensor of shape (V, 3) containing the vertices of the graph
          edges: tensor of shape (E, 2) containing the vertex indices of each edge
      Returns:
          L: Sparse FloatTensor of shape (V, V)
      """
      V = verts.shape[0]
  
      e0, e1 = edges.unbind(1)
  
      idx01 = torch.stack([e0, e1], dim=1)  # (E, 2)
      idx10 = torch.stack([e1, e0], dim=1)  # (E, 2)
      idx = torch.cat([idx01, idx10], dim=0).t()  # (2, 2*E)
  
      # First, we construct the adjacency matrix,
      # i.e. A[i, j] = 1 if (i,j) is an edge, or
      # A[e0, e1] = 1 &  A[e1, e0] = 1
      ones = torch.ones(
          idx.shape[1], dtype=torch.float32, device=verts.device
      )
      # pyre-fixme[16]: Module `sparse` has no attribute `FloatTensor`.
      A = torch.sparse.FloatTensor(idx, ones, (V, V))
  
      # the sum of i-th row of A gives the degree of the i-th vertex
      deg = torch.sparse.sum(A, dim=1).to_dense()
  
      # We construct the Laplacian matrix by adding the non diagonal values
      # i.e. L[i, j] = 1 ./ deg(i) if (i, j) is an edge
      deg0 = deg[e0]
      # pyre-fixme[58]: `/` is not supported for operand types `float` and `Tensor`.
      deg0 = torch.where(deg0 > 0.0, 1.0 / deg0, deg0)
      deg1 = deg[e1]
      # pyre-fixme[58]: `/` is not supported for operand types `float` and `Tensor`.
      deg1 = torch.where(deg1 > 0.0, 1.0 / deg1, deg1)
      val = torch.cat([deg0, deg1])
      # pyre-fixme[16]: Module `sparse` has no attribute `FloatTensor`.
      L = torch.sparse.FloatTensor(idx, val, (V, V))
  
      # Then we add the diagonal values L[i, i] = -1.
      idx = torch.arange(V, device=verts.device)
      idx = torch.stack([idx, idx], dim=0)
      ones = torch.ones(
          idx.shape[1], dtype=torch.float32, device=verts.device
      )
      # pyre-fixme[16]: Module `sparse` has no attribute `FloatTensor`.
      L -= torch.sparse.FloatTensor(idx, ones, (V, V))
  
      return L
  
imports: from typing import Tuple
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: laplacian(verts, edges) and returns: L