code: def ego_nets(graph, radius=3, netlib=None, **kwargs):
      if netlib is None:
          import networkx as netlib
  
      # color center
      egos = []
      n = graph.num_nodes
      # A proper deepsnap.G should have nodes indexed from 0 to n-1
      for i in range(n):
          egos.append(netlib.ego_graph(graph.G, i, radius=radius))
      # relabel egos: keep center node ID, relabel other node IDs
      G = graph.G.__class__()
      id_bias = n
      for i in range(len(egos)):
          G.add_node(i, **egos[i].nodes(data=True)[i])
      for i in range(len(egos)):
          keys = list(egos[i].nodes)
          keys.remove(i)
          id_cur = egos[i].number_of_nodes() - 1
          vals = range(id_bias, id_bias + id_cur)
          id_bias += id_cur
          mapping = dict(zip(keys, vals))
          ego = netlib.relabel_nodes(egos[i], mapping, copy=True)
          G.add_nodes_from(ego.nodes(data=True))
          G.add_edges_from(ego.edges(data=True))
      graph.G = G
      graph.node_id_index = torch.arange(len(egos))
  
file_path: deepsnap/examples/graph_classification/transforms.py
imports: import random
  import torch
  import numpy
  import time
  import pdb
label_desc: Use image node_id 2 for calling a global function with example usage: ego_nets(graph, radius, netlib) without return types