dgl.DGLGraph.to_cugraph

DGLGraph.to_cugraph()

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

Parameters:

g (DGLGraph) – A homogeneous graph.

Returns:

转换后的cugraph图。

Return type:

cugraph.Graph

注释

该函数仅支持GPU图输入。

示例

以下示例使用PyTorch后端。

>>> 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