code: def cugraph_to_nx(G):
      pdf = G.view_edge_list().to_pandas()
      num_col = len(pdf.columns)
  
      source = G.source_columns
      target = G.destination_columns
  
      if num_col == 2:
          Gnx = nx.from_pandas_edgelist(
              pdf, source=source, target=target
          )
      else:
          edge_attr = G.weight_column
          Gnx = nx.from_pandas_edgelist(
              pdf, source=source, target=target, edge_attr=edge_attr
          )
  
      return Gnx
  
file_path: cugraph/python/cugraph/cugraph/utilities/nx_factory.py
imports: import cugraph
  from .utils import import_optional
  import cudf
  from cudf import from_pandas
  from cudf.api.types import is_integer_dtype
label_desc: Use image node_id 7 for calling a global function with example usage: cugraph_to_nx(G) and returns: Gnx