code: def consolidate_results(df, offsets):
      """
      Each rank returns its ego_graph dataframe with its corresponding
      offsets array. This is ideal if the user operates on distributed memory
      but when attempting to bring the result into a single machine,
      the ego_graph dataframes generated from each seed cannot be extracted
      using the offsets array. This function consolidate the final result by
      performing segmented copies.
  
      Returns: consolidated ego_graph dataframe
      """
      for i in range(len(offsets) - 1):
          df_tmp = df[offsets[i] : offsets[i + 1]]
          df_tmp["labels"] = i
          if i == 0:
              df_consolidate = df_tmp
          else:
              df_consolidate = cudf.concat([df_consolidate, df_tmp])
      return df_consolidate
  
file_path: cugraph/python/cugraph/cugraph/dask/community/egonet.py
imports: from dask.distributed import wait, default_client
  import cugraph.dask.comms.comms
  import dask_cudf
  import cudf
  from cugraph.dask.common.part_utils import persist_dask_df_equal_parts_per_worker
  from pylibcugraph import ResourceHandle, ego_graph
label_desc: Use image node_id 2 for calling a global function with example usage: consolidate_results(df, offsets) and returns: df_consolidate