code: def reorder_nodes(g, new_node_ids):
      """Generate a new graph with new node IDs.
  
      We assign each node in the input graph with a new node ID. This results in
      a new graph.
  
      Parameters
      ----------
      g : DGLGraph
          The input graph
      new_node_ids : a tensor
          The new node IDs
      Returns
      -------
      DGLGraph
          The graph with new node IDs.
      """
      assert (
          len(new_node_ids) == g.num_nodes()
      ), "The number of new node ids must match #nodes in the graph."
      new_node_ids = utils.toindex(new_node_ids)
      sorted_ids, idx = F.sort_1d(new_node_ids.tousertensor())
      assert (
          F.asnumpy(sorted_ids[0]) == 0
          and F.asnumpy(sorted_ids[-1]) == g.num_nodes() - 1
      ), "The new node IDs are incorrect."
      new_gidx = _CAPI_DGLReorderGraph_Hetero(
          g._graph, new_node_ids.todgltensor()
      )
      new_g = DGLGraph(gidx=new_gidx, ntypes=["_N"], etypes=["_E"])
      new_g.ndata["orig_id"] = idx
      return new_g
  
imports: import os
  import re
  import time
  import numpy
  from .None import backend, utils
  from ._ffi.function import _init_api
  from .base import EID, ETYPE, NID, NTYPE
  from .heterograph import DGLGraph
  from .ndarray import NDArray
  from .subgraph import edge_subgraph
label_desc: Use image node_id 1 for calling a global function with example usage: reorder_nodes(g, new_node_ids) and returns: new_g