code: def test_line_graph2(idtype):
      g = dgl.heterograph(
          {
              ("user", "follows", "user"): (
                  [0, 1, 1, 2, 2],
                  [2, 0, 2, 0, 1],
              )
          },
          idtype=idtype,
      )
      lg = dgl.line_graph(g)
      assert lg.num_nodes() == 5
      assert lg.num_edges() == 8
      row, col = lg.edges()
      assert np.array_equal(
          F.asnumpy(row), np.array([0, 0, 1, 2, 2, 3, 4, 4])
      )
      assert np.array_equal(
          F.asnumpy(col), np.array([3, 4, 0, 3, 4, 0, 1, 2])
      )
  
      lg = dgl.line_graph(g, backtracking=False)
      assert lg.num_nodes() == 5
      assert lg.num_edges() == 4
      row, col = lg.edges()
      assert np.array_equal(F.asnumpy(row), np.array([0, 1, 2, 4]))
      assert np.array_equal(F.asnumpy(col), np.array([4, 0, 3, 1]))
      g = dgl.heterograph(
          {
              ("user", "follows", "user"): (
                  [0, 1, 1, 2, 2],
                  [2, 0, 2, 0, 1],
              )
          },
          idtype=idtype,
      ).formats("csr")
      lg = dgl.line_graph(g)
      assert lg.num_nodes() == 5
      assert lg.num_edges() == 8
      row, col = lg.edges()
      assert np.array_equal(
          F.asnumpy(row), np.array([0, 0, 1, 2, 2, 3, 4, 4])
      )
      assert np.array_equal(
          F.asnumpy(col), np.array([3, 4, 0, 3, 4, 0, 1, 2])
      )
  
      g = dgl.heterograph(
          {
              ("user", "follows", "user"): (
                  [0, 1, 1, 2, 2],
                  [2, 0, 2, 0, 1],
              )
          },
          idtype=idtype,
      ).formats("csc")
      lg = dgl.line_graph(g)
      assert lg.num_nodes() == 5
      assert lg.num_edges() == 8
      row, col, eid = lg.edges("all")
      row = F.asnumpy(row)
      col = F.asnumpy(col)
      eid = F.asnumpy(eid).astype(int)
      order = np.argsort(eid)
      assert np.array_equal(
          row[order], np.array([0, 0, 1, 2, 2, 3, 4, 4])
      )
      assert np.array_equal(
          col[order], np.array([3, 4, 0, 3, 4, 0, 1, 2])
      )
  
imports: import math
  import os
  import unittest
  import backend
  import dgl
  import dgl.function
  import dgl.partition
  import networkx
  import numpy
  import pytest
  from scipy import sparse
  from utils import parametrize_idtype
  from utils.graph_cases import get_cases
label_desc: Use image node_id 5 for calling a global function with example usage: test_line_graph2(idtype) without return types