code: def test_batched_ego_graphs(graph_file, seeds, radius):
      gc.collect()
  
      # Nx
      dataset_path = graph_file.get_path()
      df = utils.read_csv_for_nx(dataset_path, read_weights_in_sp=True)
      Gnx = nx.from_pandas_edgelist(
          df,
          create_using=nx.Graph(),
          source="0",
          target="1",
          edge_attr="weight",
      )
  
      # cugraph
      df, offsets = cugraph.batched_ego_graphs(
          Gnx, seeds, radius=radius
      )
      for i in range(len(seeds)):
          ego_nx = nx.ego_graph(Gnx, seeds[i], radius=radius)
          ego_df = df[offsets[i] : offsets[i + 1]]
          ego_cugraph = nx.from_pandas_edgelist(
              ego_df, source="src", target="dst", edge_attr="weight"
          )
      assert nx.is_isomorphic(ego_nx, ego_cugraph)
  
file_path: cugraph/python/cugraph/cugraph/tests/sampling/test_egonet.py
imports: import gc
  import pytest
  import networkx
  import cudf
  import cugraph
  from cugraph.testing import utils, DEFAULT_DATASETS
label_desc: Use image node_id 2 for calling a global function with example usage: test_batched_ego_graphs(graph_file, seeds, radius) without return types