code: def create_heterogeneous_sampled_graphs_from_dataframe(
      sampled_df: cudf.DataFrame,
      num_nodes_dict: Dict[str, int],
      etype_id_dict: Dict[int, Tuple[str, str, str]],
      etype_offset_dict: Dict[Tuple[str, str, str], int],
      ntype_offset_dict: Dict[str, int],
      edge_dir: str = "in",
  ):
      """
      This helper function creates DGL MFGS from cugraph sampled dataframe
      """
      sampled_df["batch_id"] = (
          sampled_df["batch_id"] - sampled_df["batch_id"].min()
      )
      result_df_ls = sampled_df[
          ["sources", "destinations", "edge_id", "hop_id", "edge_type"]
      ].scatter_by_map(sampled_df["batch_id"], keep_index=False)
      del sampled_df
  
      result_df_ls = [
          batch_df[
              ["sources", "destinations", "edge_id", "edge_type"]
          ].scatter_by_map(batch_df["hop_id"], keep_index=False)
          for batch_df in result_df_ls
      ]
  
      result_tensor_ls = [
          [
              _get_edges_dict_from_perhop_df(
                  h_df,
                  etype_id_dict,
                  etype_offset_dict,
                  ntype_offset_dict,
              )
              for h_df in per_batch_ls
          ]
          for per_batch_ls in result_df_ls
      ]
      del result_df_ls
  
      result_mfgs = [
          _create_heterogenous_sampled_graphs_from_tensors_perhop(
              tensors_perhop_ls, num_nodes_dict, edge_dir
          )
          for tensors_perhop_ls in result_tensor_ls
      ]
      return result_mfgs
  
imports: from __future__ import annotations
  from typing import List, Tuple, Dict, Optional
  from collections import defaultdict
  import cudf
  from cugraph.utilities.utils import import_optional
  from cugraph_dgl.nn import SparseGraph
label_desc: Use image node_id 11 for calling a global function with example usage: create_heterogeneous_sampled_graphs_from_dataframe(sampled_df, num_nodes_dict, etype_id_dict, etype_offset_dict, ntype_offset_dict, edge_dir) and returns: result_mfgs