code: def add_self_loop(graph, sub_nodes=None):
      """add_self_loop_for_subgraph"""
      assert not graph.is_tensor(), "You must call Graph.numpy() first."
  
      if sub_nodes is not None:
          self_loop_edges = np.zeros((sub_nodes.shape[0], 2))
          self_loop_edges[:, 0] = self_loop_edges[:, 1] = sub_nodes
      else:
          self_loop_edges = np.zeros((graph.num_nodes, 2))
          self_loop_edges[:, 0] = self_loop_edges[:, 1] = np.arange(
              graph.num_nodes
          )
      edges = np.vstack((graph.edges, self_loop_edges))
      edges = np.unique(edges, axis=0)
      new_g = Graph(
          edges=edges,
          num_nodes=graph.num_nodes,
          node_feat=graph.node_feat,
          edge_feat=graph.edge_feat,
      )
      return new_g
  
imports: import os
  import tqdm
  import yaml
  import pgl
  import time
  import copy
  import numpy
  import os.path
  from pgl.utils.logger import log
  from pgl.graph import Graph
  from pgl import graph_kernel
  from pgl.sampling.custom import subgraph
  from ogb.lsc import MAG240MDataset, MAG240MEvaluator
  from dataset.base_dataset import BaseDataGenerator
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: add_self_loop(graph, sub_nodes) and returns: new_g