code: def test_incmat():
      g = dgl.graph([])
      g.add_nodes(4)
      g.add_edges(0, 1)  # 0
      g.add_edges(0, 2)  # 1
      g.add_edges(0, 3)  # 2
      g.add_edges(2, 3)  # 3
      g.add_edges(1, 1)  # 4
      inc_in = F.sparse_to_numpy(g.incidence_matrix("in"))
      inc_out = F.sparse_to_numpy(g.incidence_matrix("out"))
      inc_both = F.sparse_to_numpy(g.incidence_matrix("both"))
      print(inc_in)
      print(inc_out)
      print(inc_both)
      assert np.allclose(
          inc_in,
          np.array(
              [
                  [0.0, 0.0, 0.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0, 0.0, 1.0],
                  [0.0, 1.0, 0.0, 0.0, 0.0],
                  [0.0, 0.0, 1.0, 1.0, 0.0],
              ]
          ),
      )
      assert np.allclose(
          inc_out,
          np.array(
              [
                  [1.0, 1.0, 1.0, 0.0, 0.0],
                  [0.0, 0.0, 0.0, 0.0, 1.0],
                  [0.0, 0.0, 0.0, 1.0, 0.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0],
              ]
          ),
      )
      assert np.allclose(
          inc_both,
          np.array(
              [
                  [-1.0, -1.0, -1.0, 0.0, 0.0],
                  [1.0, 0.0, 0.0, 0.0, 0.0],
                  [0.0, 1.0, 0.0, -1.0, 0.0],
                  [0.0, 0.0, 1.0, 1.0, 0.0],
              ]
          ),
      )
  
imports: import math
  import numbers
  import backend
  import dgl
  import networkx
  import numpy
  import pytest
  import scipy.sparse
  from dgl import DGLError
label_desc: Use image node_id 10 for calling a global function with example usage: test_incmat() without return types