dgl.DGLHeteroGraph.nodes

DGLHeteroGraph.nodes

Return a node view that can be used to set/get feature data of a single node type.

Examples

The following example uses PyTorch backend.

To set features of all users

>>> g = dgl.graph([(0, 1), (1, 2)], 'user', 'follows')
>>> g.nodes['user'].data['h'] = torch.zeros(3, 5)

See also

ndata