class_docstr: Adds Laplacian positional encodings to the nodes.
  
  The first `k` eigenvectors are computed and concatenated to the node features.
  Each node will be extended with its corresponding entries in the first k
  eigenvectors.
class_docstr_tok: ["Adds","Laplacian","positional","encodings","to","the","nodes",".","The","first","`","k","`","eigenvectors","are","computed","and","concatenated","to","the","node","features",".","Each","node","will","be","extended","with","its","corresponding","entries","in","the","first","k","eigenvectors","."]
code: def __call__(self, graph):
      if "a" not in graph:
          raise ValueError("The graph must have an adjacency matrix")
      assert (
          self.k < graph.n_nodes
      ), f"k = {self.k} must be smaller than graph.n_nodes = {graph.n_nodes}"
  
      l = normalized_laplacian(graph.a)
      _, eigvec = eigsh(l, k=self.k, which="SM")
  
      if "x" not in graph:
          graph.x = eigvec
      else:
          graph.x = np.concatenate((graph.x, eigvec), axis=-1)
  
      return graph
  
imports: import numpy
  from scipy.sparse.linalg import eigsh
  from spektral.utils import normalized_laplacian
label_desc: Use image node_id 2 for calling the LaplacianPE obj's underlying member method code with example usage: obj.__call__(graph) and returns: graph