dgl.DGLGraph.dsttypes

property DGLGraph.dsttypes

Return all the destination node type names in this graph.

If the graph can further divide its node types into two subsets A and B where all the edeges are from nodes of types in A to nodes of types in B, we call this graph a uni-bipartite graph and the nodes in A being the source nodes and the ones in B being the destination nodes. If the graph is not uni-bipartite, the source and destination nodes are just the entire set of nodes in the graph.

Returns:

All the destination node type names in a list.

Return type:

list[str]

Examples

The following example uses PyTorch backend.

>>> import dgl
>>> import torch

Query for a uni-bipartite graph.

>>> g = dgl.heterograph({
...     ('user', 'plays', 'game'): (torch.tensor([0]), torch.tensor([1])),
...     ('developer', 'develops', 'game'): (torch.tensor([1]), torch.tensor([2]))
... })
>>> g.dsttypes
['game']

Query for a graph that is not uni-bipartite.

>>> g = dgl.heterograph({
...     ('user', 'follows', 'user'): (torch.tensor([0]), torch.tensor([1])),
...     ('developer', 'develops', 'game'): (torch.tensor([1]), torch.tensor([2]))
... })
>>> g.dsttypes
['developer', 'game', 'user']