def from_cugraph(cugraph_graph):
    """Create a graph from a :class:`cugraph.Graph` object.

    Parameters
    ----------
    cugraph_graph : cugraph.Graph
        The cugraph graph object holding the graph structure. Node and edge attributes are
        dropped.

        If the input graph is undirected, DGL converts it to a directed graph
        by :func:`cugraph.Graph.to_directed`.

    Returns
    -------
    DGLGraph
        The created graph.

    Examples
    --------

    The following example uses PyTorch backend.

    >>> import dgl
    >>> import cugraph
    >>> import cudf

    Create a cugraph graph.
    >>> cugraph_g = cugraph.Graph(directed=True)
    >>> df = cudf.DataFrame({"source":[0, 1, 2, 3],
                     "destination":[1, 2, 3, 0]})
    >>> cugraph_g.from_cudf_edgelist(df)

    Convert it into a DGLGraph
    >>> g = dgl.from_cugraph(cugraph_g)
    >>> g.edges()
    (tensor([1, 2, 3, 0], device='cuda:0'), tensor([2, 3, 0, 1], device='cuda:0'))
    """
    if not cugraph_graph.is_directed():
        cugraph_graph = cugraph_graph.to_directed()

    edges = cugraph_graph.edges()
    src_t = F.zerocopy_from_dlpack(edges["src"].to_dlpack())
    dst_t = F.zerocopy_from_dlpack(edges["dst"].to_dlpack())
    g = graph((src_t, dst_t))

    return g
Create a graph from a :class:`cugraph.Graph` object.

    Parameters
    ----------
    cugraph_graph : cugraph.Graph
        The cugraph graph object holding the graph structure. Node and edge attributes are
        dropped.

        If the input graph is undirected, DGL converts it to a directed graph
        by :func:`cugraph.Graph.to_directed`.

    Returns
    -------
    DGLGraph
        The created graph.

    Examples
    --------

    The following example uses PyTorch backend.

    >>> import dgl
    >>> import cugraph
    >>> import cudf

    Create a cugraph graph.
    >>> cugraph_g = cugraph.Graph(directed=True)
    >>> df = cudf.DataFrame({"source":[0, 1, 2, 3],
                     "destination":[1, 2, 3, 0]})
    >>> cugraph_g.from_cudf_edgelist(df)

    Convert it into a DGLGraph
    >>> g = dgl.from_cugraph(cugraph_g)
    >>> g.edges()
    (tensor([1, 2, 3, 0], device='cuda:0'), tensor([2, 3, 0, 1], device='cuda:0'))
    
python/dgl/convert.py