code: def test_weighted_incidence_matrix(self):
      I = nx.incidence_matrix(
          self.WG,
          nodelist=sorted(self.WG),
          edgelist=sorted(self.WG.edges()),
          oriented=True,
          dtype=int,
      ).todense()
      np.testing.assert_equal(I, self.OI)
  
      I = nx.incidence_matrix(
          self.WG,
          nodelist=sorted(self.WG),
          edgelist=sorted(self.WG.edges()),
          oriented=False,
          dtype=int,
      ).todense()
      np.testing.assert_equal(I, np.abs(self.OI))
  
      # np.testing.assert_equal(nx.incidence_matrix(self.WG,oriented=True,
      #                                  weight='weight').todense(),0.5*self.OI)
      # np.testing.assert_equal(nx.incidence_matrix(self.WG,weight='weight').todense(),
      #              np.abs(0.5*self.OI))
      # np.testing.assert_equal(nx.incidence_matrix(self.WG,oriented=True,weight='other').todense(),
      #              0.3*self.OI)
  
      I = nx.incidence_matrix(
          self.WG,
          nodelist=sorted(self.WG),
          edgelist=sorted(self.WG.edges()),
          oriented=True,
          weight="weight",
      ).todense()
      np.testing.assert_equal(I, 0.5 * self.OI)
  
      I = nx.incidence_matrix(
          self.WG,
          nodelist=sorted(self.WG),
          edgelist=sorted(self.WG.edges()),
          oriented=False,
          weight="weight",
      ).todense()
      np.testing.assert_equal(I, np.abs(0.5 * self.OI))
  
      I = nx.incidence_matrix(
          self.WG,
          nodelist=sorted(self.WG),
          edgelist=sorted(self.WG.edges()),
          oriented=True,
          weight="other",
      ).todense()
      np.testing.assert_equal(I, 0.3 * self.OI)
  
      # WMG=nx.MultiGraph(self.WG)
      # WMG.add_edge(0,1,weight=0.5,other=0.3)
      # np.testing.assert_equal(nx.incidence_matrix(WMG,weight='weight').todense(),
      #              np.abs(0.5*self.MGOI))
      # np.testing.assert_equal(nx.incidence_matrix(WMG,weight='weight',oriented=True).todense(),
      #              0.5*self.MGOI)
      # np.testing.assert_equal(nx.incidence_matrix(WMG,weight='other',oriented=True).todense(),
      #              0.3*self.MGOI)
  
      WMG = nx.MultiGraph(self.WG)
      WMG.add_edge(0, 1, weight=0.5, other=0.3)
  
      I = nx.incidence_matrix(
          WMG,
          nodelist=sorted(WMG),
          edgelist=sorted(WMG.edges(keys=True)),
          oriented=True,
          weight="weight",
      ).todense()
      np.testing.assert_equal(I, 0.5 * self.MGOI)
  
      I = nx.incidence_matrix(
          WMG,
          nodelist=sorted(WMG),
          edgelist=sorted(WMG.edges(keys=True)),
          oriented=False,
          weight="weight",
      ).todense()
      np.testing.assert_equal(I, np.abs(0.5 * self.MGOI))
  
      I = nx.incidence_matrix(
          WMG,
          nodelist=sorted(WMG),
          edgelist=sorted(WMG.edges(keys=True)),
          oriented=True,
          weight="other",
      ).todense()
      np.testing.assert_equal(I, 0.3 * self.MGOI)
  
file_path: networkx/networkx/linalg/tests/test_graphmatrix.py
imports: import pytest
  import networkx
  from networkx.exception import NetworkXError
  from networkx.generators.degree_seq import havel_hakimi_graph
label_desc: Use image node_id 3 for calling the TestGraphMatrix obj's underlying member method code with example usage: obj.test_weighted_incidence_matrix() without return types