code: def testLaplacian(self):
      g = Graph.Full(3)
      g.es["weight"] = [1, 2, 3]
      self.assertTrue(
          g.laplacian() == [[2, -1, -1], [-1, 2, -1], [-1, -1, 2]]
      )
      self.assertAlmostEqualMatrix(
          g.laplacian(normalized=True),
          [[1, -0.5, -0.5], [-0.5, 1, -0.5], [-0.5, -0.5, 1]],
      )
      self.assertAlmostEqualMatrix(
          g.laplacian(normalized="symmetric"),
          [[1, -0.5, -0.5], [-0.5, 1, -0.5], [-0.5, -0.5, 1]],
      )
      self.assertAlmostEqualMatrix(
          g.laplacian(normalized="left"),
          [[1, -0.5, -0.5], [-0.5, 1, -0.5], [-0.5, -0.5, 1]],
      )
      self.assertAlmostEqualMatrix(
          g.laplacian(normalized="right"),
          [[1, -0.5, -0.5], [-0.5, 1, -0.5], [-0.5, -0.5, 1]],
      )
  
      mx0 = [
          [1.0, -1 / (12**0.5), -2 / (15**0.5)],
          [-1 / (12**0.5), 1.0, -3 / (20**0.5)],
          [-2 / (15**0.5), -3 / (20**0.5), 1.0],
      ]
      self.assertAlmostEqualMatrix(g.laplacian("weight", True), mx0)
  
      g = Graph.Tree(5, 2)
      g.add_vertices(1)
      self.assertTrue(
          g.laplacian()
          == [
              [2, -1, -1, 0, 0, 0],
              [-1, 3, 0, -1, -1, 0],
              [-1, 0, 1, 0, 0, 0],
              [0, -1, 0, 1, 0, 0],
              [0, -1, 0, 0, 1, 0],
              [0, 0, 0, 0, 0, 0],
          ]
      )
  
      g = Graph.Formula("A --> B --> C --> D --> E --> A, A --> C")
      self.assertAlmostEqualMatrix(
          g.laplacian(mode="out"),
          [
              [2, -1, -1, 0, 0],
              [0, 1, -1, 0, 0],
              [0, 0, 1, -1, 0],
              [0, 0, 0, 1, -1],
              [-1, 0, 0, 0, 1],
          ],
      )
      self.assertAlmostEqualMatrix(
          g.laplacian(mode="in"),
          [
              [1, -1, -1, 0, 0],
              [0, 1, -1, 0, 0],
              [0, 0, 2, -1, 0],
              [0, 0, 0, 1, -1],
              [-1, 0, 0, 0, 1],
          ],
      )
      self.assertAlmostEqualMatrix(
          g.laplacian(mode="out", normalized="left"),
          [
              [1, -0.5, -0.5, 0, 0],
              [0, 1, -1, 0, 0],
              [0, 0, 1, -1, 0],
              [0, 0, 0, 1, -1],
              [-1, 0, 0, 0, 1],
          ],
      )
      self.assertAlmostEqualMatrix(
          g.laplacian(mode="in", normalized="right"),
          [
              [1, -1, -0.5, 0, 0],
              [0, 1, -0.5, 0, 0],
              [0, 0, 1, -1, 0],
              [0, 0, 0, 1, -1],
              [-1, 0, 0, 0, 1],
          ],
      )
  
imports: import unittest
  from igraph import Graph
label_desc: Use image node_id 2 for calling the SpectralTests obj's underlying member method code with example usage: obj.testLaplacian() without return types