code: def test_reorder_nodes():
      g = create_large_graph(1000)
      new_nids = np.random.permutation(g.num_nodes())
      # TODO(zhengda) we need to test both CSR and COO.
      new_g = dgl.partition.reorder_nodes(g, new_nids)
      new_in_deg = new_g.in_degrees()
      new_out_deg = new_g.out_degrees()
      in_deg = g.in_degrees()
      out_deg = g.out_degrees()
      new_in_deg1 = F.scatter_row(in_deg, F.tensor(new_nids), in_deg)
      new_out_deg1 = F.scatter_row(out_deg, F.tensor(new_nids), out_deg)
      assert np.all(F.asnumpy(new_in_deg == new_in_deg1))
      assert np.all(F.asnumpy(new_out_deg == new_out_deg1))
      orig_ids = F.asnumpy(new_g.ndata["orig_id"])
      for nid in range(g.num_nodes()):
          neighs = F.asnumpy(g.successors(nid))
          new_neighs1 = new_nids[neighs]
          new_nid = new_nids[nid]
          new_neighs2 = new_g.successors(new_nid)
          assert np.all(
              np.sort(new_neighs1) == np.sort(F.asnumpy(new_neighs2))
          )
  
      for nid in range(new_g.num_nodes()):
          neighs = F.asnumpy(new_g.successors(nid))
          old_neighs1 = orig_ids[neighs]
          old_nid = orig_ids[nid]
          old_neighs2 = g.successors(old_nid)
          assert np.all(
              np.sort(old_neighs1) == np.sort(F.asnumpy(old_neighs2))
          )
  
          neighs = F.asnumpy(new_g.predecessors(nid))
          old_neighs1 = orig_ids[neighs]
          old_nid = orig_ids[nid]
          old_neighs2 = g.predecessors(old_nid)
          assert np.all(
              np.sort(old_neighs1) == np.sort(F.asnumpy(old_neighs2))
          )
  
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 21 for calling a global function with example usage: test_reorder_nodes() without return types