code: def to_cugraph(
      self: Plottable,
      directed: bool = True,
      include_nodes: bool = True,
      node_attributes: Optional[List[str]] = None,
      edge_attributes: Optional[List[str]] = None,
      kind: CuGraphKind = "Graph",
  ):
      """Convert current graph to a cugraph.Graph object
  
      To assign an edge weight, use `g.bind(edge_weight='some_col').to_cugraph()`
  
      Load from pandas, cudf, or dask_cudf DataFrames
      """
  
      import cudf, cugraph
  
      if kind == "Graph":
          CG = cugraph.Graph
      elif kind == "MultiGraph":
          CG = cugraph.MultiGraph
      elif kind == "BiPartiteGraph":
          CG = cugraph.BiPartiteGraph
  
      G = CG(directed=directed)
  
      opts = {
          "source": self._source,
          "destination": self._destination,
      }
      if self._edge_weight is not None:
          opts["edge_attr"] = self._edge_weight
  
      logger.debug("opts: %s", opts)
  
      # cugraph seems to get confused when extra cols
      edges_df = self._edges[list(opts.values())]
      if edges_df is None:
          raise ValueError("No edges loaded")
      elif isinstance(edges_df, cudf.DataFrame):
          G.from_cudf_edgelist(edges_df, **opts)
      elif isinstance(edges_df, pd.DataFrame):
          G.from_pandas_edgelist(edges_df, **opts)
      else:
          was_dask = False
          try:
              import dask_cudf
  
              if isinstance(edges_df, dask_cudf.DataFrame):
                  was_dask = True
                  G.from_dask_cudf_edgelist(edges_df, **opts)
          except ImportError:
              1
          if not was_dask:
              raise ValueError(
                  "Unsupported edge data type, expected pd/cudf.DataFrame, got: %s",
                  type(edges_df),
              )
  
      if self._node is not None and self._nodes is not None:
          nodes_gdf = (
              self._nodes
              if isinstance(self._nodes, cudf.DataFrame)
              else cudf.from_pandas(self._nodes)
          )
          G.add_nodes_from(nodes_gdf[self._node])
  
      return G
  
file_path: pygraphistry/graphistry/plugins/cugraph.py
imports: import pandas
  from typing import Any, Dict, List, Optional, Union
  from graphistry.constants import NODE
  from graphistry.Engine import EngineAbstract
  from graphistry.Plottable import Plottable
  from graphistry.plugins_types import CuGraphKind
  from graphistry.util import setup_logger
label_desc: Use image node_id 3 for calling a global function with example usage: to_cugraph(directed, include_nodes, node_attributes, edge_attributes, kind) and returns: G