dgl.to_cugraph

dgl.to_cugraph(g)[source]

Convert a DGL graph to a cugraph.Graph and return.

Parameters:

g (DGLGraph) – A homogeneous graph.

Returns:

The converted cugraph graph.

Return type:

cugraph.Graph

Notes

The function only supports GPU graph input.

Examples

The following example uses PyTorch backend.

>>> import dgl
>>> import cugraph
>>> import torch
>>> g = dgl.graph((torch.tensor([1, 2]), torch.tensor([1, 3]))).to('cuda')
>>> cugraph_g = g.to_cugraph()
>>> cugraph_g.edges()
    src  dst
0    2    3
1    1    1