dgl.DGLGraph.idtypeΒΆ

property DGLGraph.idtypeΒΆ

The data type for storing the structure-related graph information such as node and edge IDs.

Returns

For example, this can be torch.int32 or torch.int64 for PyTorch.

Return type

Framework-specific device object

Examples

The following example uses PyTorch backend.

>>> import dgl
>>> import torch
>>> src_ids = torch.tensor([0, 0, 1])
>>> dst_ids = torch.tensor([1, 2, 2])
>>> g = dgl.graph((src_ids, dst_ids))
>>> g.idtype
torch.int64
>>> g = dgl.graph((src_ids, dst_ids), idtype=torch.int32)
>>> g.idtype
torch.int32

See also

long, int