code: def symmetrize_df(
      df,
      src_name,
      dst_name,
      weight_name=None,
      multi=False,
      symmetrize=True,
  ):
      """
      Take a COO stored in a DataFrame, along with the column names of
      the source and destination columns and create a new data frame
      using the same column names that symmetrize the graph so that all
      edges appear in both directions.
      Note that if other columns exist in the data frame (e.g. edge weights)
      the other columns will also be replicated.  That is, if (u,v,data)
      represents the source value (u), destination value (v) and some
      set of other columns (data) in the input data, then the output
      data will contain both (u,v,data) and (v,u,data) with matching
      data.
      If (u,v,data1) and (v,u,data2) exist in the input data where data1
      != data2 then this code will arbitrarily pick the smaller data
      element to keep, if this is not desired then the caller
      should correct the data prior to calling symmetrize.
  
      Parameters
      ----------
      df : cudf.DataFrame
          Input data frame containing COO.  Columns should contain source
          ids, destination ids and any properties associated with the
          edges.
  
      src_name : str or list
          Name(s) of the column(s) in the data frame containing the source ids
  
      dst_name : str or list
          Name(s) of the column(s) in the data frame containing
          the destination ids
  
      weight_name : string, optional (default=None)
          Name of the column in the data frame containing the weight ids
  
      multi : bool, optional (default=False)
          Set to True if graph is a Multi(Di)Graph. This allows multiple
          edges instead of dropping them.
  
      symmetrize : bool, optional (default=True)
          Default is True to perform symmetrization. If False only duplicate
          edges are dropped.
  
      Examples
      --------
      >>> from cugraph.structure.symmetrize import symmetrize_df
      >>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
      >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
      ...                   dtype=['int32', 'int32', 'float32'], header=None)
      >>> sym_df = symmetrize_df(M, '0', '1')
  
      """
      if not isinstance(src_name, list):
          src_name = [src_name]
      if not isinstance(dst_name, list):
          dst_name = [dst_name]
      if weight_name is not None and not isinstance(weight_name, list):
          weight_name = [weight_name]
  
      if symmetrize:
          result = _add_reverse_edges(
              df, src_name, dst_name, weight_name
          )
      else:
          result = df
      if multi:
          return result
      else:
          vertex_col_name = src_name + dst_name
          result = result.groupby(
              by=[*vertex_col_name], as_index=False
          ).min()
          return result
  
file_path: cugraph/python/cugraph/cugraph/structure/symmetrize.py
imports: from cugraph.structure import graph_classes
  import cudf
  import dask_cudf
  from dask.distributed import default_client
label_desc: Use image node_id 1 for calling a global function with example usage: symmetrize_df(df, src_name, dst_name, weight_name, multi, symmetrize) and returns: result, result