code: def _convert_df_to_output_type(df, input_type):
      """
      Given a cudf.DataFrame df, convert it to a new type appropriate for the
      graph algos in this module, based on input_type.
      """
      if input_type is Graph:
          return df
  
      elif is_nx_graph_type(input_type):
          return df.to_pandas()
  
      elif is_matrix_type(input_type):
          # A CuPy/SciPy input means the return value will be a 2-tuple of:
          #   distance: cupy.ndarray
          #   predecessor: cupy.ndarray
          sorted_df = df.sort_values("vertex")
          if is_cp_matrix_type(input_type):
              distances = cp.from_dlpack(
                  sorted_df["distance"].to_dlpack()
              )
              preds = cp.from_dlpack(
                  sorted_df["predecessor"].to_dlpack()
              )
              return (distances, preds)
          else:
              distances = sorted_df["distance"].to_numpy()
              preds = sorted_df["predecessor"].to_numpy()
              return (distances, preds)
      else:
          raise TypeError(
              f"input type {input_type} is not a supported type."
          )
  
file_path: cugraph/python/cugraph/cugraph/traversal/bfs.py
imports: import cudf
  import dask_cudf
  from pylibcugraph import ResourceHandle
  from pylibcugraph import bfs
  from cugraph.structure.graph_classes import Graph
  from cugraph.utilities import ensure_cugraph_obj, is_matrix_type, is_cp_matrix_type, is_nx_graph_type, cupy_package
label_desc: Use image node_id 2 for calling a global function with example usage: _convert_df_to_output_type(df, input_type) and returns: df, df, distances,  preds, distances,  preds