code: def _sampler_output_from_sampling_results_homogeneous_coo(
      sampling_results: cudf.DataFrame,
      renumber_map: torch.Tensor,
      graph_store: CuGraphStore,
      data_index: Dict[Tuple[int, int], Dict[str, int]],
      batch_id: int,
      metadata: Sequence = None,
  ) -> HeteroSamplerOutput:
      """
      Parameters
      ----------
      sampling_results: cudf.DataFrame
          The dataframe containing sampling results.
      renumber_map: torch.Tensor
          The tensor containing the renumber map, or None if there
          is no renumber map.
      graph_store: CuGraphStore
          The graph store containing the structure of the sampled graph.
      data_index: Dict[Tuple[int, int], Dict[str, int]]
          Dictionary where keys are the batch id and hop id,
          and values are dictionaries containing the max src
          and max dst node ids for the batch and hop.
      batch_id: int
          The current batch id, whose samples are being retrieved
          from the sampling results and data index.
      metadata: Tensor
          The metadata for the sampled batch.
  
      Returns
      -------
      HeteroSamplerOutput
      """
  
      if (
          len(graph_store.edge_types) > 1
          or len(graph_store.node_types) > 1
      ):
          raise ValueError("Graph is heterogeneous")
  
      hops = torch.arange(
          sampling_results.hop_id.iloc[len(sampling_results) - 1] + 1,
          device="cuda",
      )
      hops = torch.searchsorted(
          torch.as_tensor(sampling_results.hop_id, device="cuda"), hops
      )
  
      node_type = graph_store.node_types[0]
      edge_type = graph_store.edge_types[0]
  
      num_nodes_per_hop_dict = {
          node_type: torch.zeros(len(hops) + 1, dtype=torch.int64)
      }
      num_edges_per_hop_dict = {
          edge_type: torch.zeros(len(hops), dtype=torch.int64)
      }
  
      if renumber_map is None:
          raise ValueError(
              "Renumbered input is expected for homogeneous graphs"
          )
  
      noi_index = {
          node_type: torch.as_tensor(renumber_map, device="cuda")
      }
  
      row_dict = {
          edge_type: torch.as_tensor(
              sampling_results.majors, device="cuda"
          ),
      }
  
      col_dict = {
          edge_type: torch.as_tensor(
              sampling_results.minors, device="cuda"
          ),
      }
  
      num_nodes_per_hop_dict[node_type][0] = (
          data_index[batch_id, 0]["src_max"] + 1
      )
      for hop in range(len(hops)):
          hop_ix_start = hops[hop]
          hop_ix_end = (
              hops[hop + 1]
              if hop < len(hops) - 1
              else len(sampling_results)
          )
  
          if num_nodes_per_hop_dict[node_type][hop] > 0:
              max_id_hop = data_index[batch_id, hop]["dst_max"]
              max_id_prev_hop = (
                  data_index[batch_id, hop - 1]["dst_max"]
                  if hop > 0
                  else data_index[batch_id, 0]["src_max"]
              )
  
              if max_id_hop > max_id_prev_hop:
                  num_nodes_per_hop_dict[node_type][hop + 1] = (
                      max_id_hop - max_id_prev_hop
                  )
              else:
                  num_nodes_per_hop_dict[node_type][hop + 1] = 0
          # will default to 0 if the previous hop was 0, since this is a PyG requirement
  
          num_edges_per_hop_dict[edge_type][hop] = (
              hop_ix_end - hop_ix_start
          )
  
      if HeteroSamplerOutput is None:
          raise ImportError("Error importing from pyg")
  
      return HeteroSamplerOutput(
          node=noi_index,
          row=row_dict,
          col=col_dict,
          edge=None,
          num_sampled_nodes=num_nodes_per_hop_dict,
          num_sampled_edges=num_edges_per_hop_dict,
          metadata=metadata,
      )
  
file_path: cugraph/python/cugraph-pyg/cugraph_pyg/sampler/cugraph_sampler.py
imports: from typing import Sequence, Dict, Tuple
  from cugraph_pyg.data import CuGraphStore
  from cugraph.utilities.utils import import_optional
  import cudf
label_desc: Use image node_id 2 for calling a global function with example usage: _sampler_output_from_sampling_results_homogeneous_coo(sampling_results, renumber_map, graph_store, data_index, batch_id, metadata) and returns: HeteroSamplerOutput