code: def check_compact(csr, id_arr, num_nodes):
      compact = mx.nd.contrib.dgl_graph_compact(
          csr, id_arr, graph_sizes=num_nodes, return_mapping=False
      )
      assert compact.shape[0] == num_nodes
      assert compact.shape[1] == num_nodes
      assert (
          mx.nd.sum(
              compact.indptr == csr.indptr[0 : int(num_nodes + 1)]
          ).asnumpy()
          == num_nodes + 1
      )
      sub_indices = compact.indices.asnumpy()
      indices = csr.indices.asnumpy()
      id_arr = id_arr.asnumpy()
      for i in range(len(sub_indices)):
          sub_id = sub_indices[i]
          assert id_arr[sub_id] == indices[i]
  
file_path: mxnet/tests/python/unittest/test_dgl_graph.py
imports: from __future__ import print_function
  import numpy
  import scipy
  import mxnet
  import random
  import itertools
  from numpy.testing import assert_allclose, assert_array_equal
  from mxnet.test_utils import *
  import unittest
label_desc: Use image node_id 3 for calling a global function with example usage: check_compact(csr, id_arr, num_nodes) without return types