1

I'd like to get nodes with their features by using their IDS? is it possible ? if yes ? how i can do that? for example, I have source nodes IDs of an edge, as follows:

>> u, v = g.edges()
>> print(u)
tensor([0, 1, 0, 0, 1])

And thank you in advance .

Driss AL
  • 21
  • 5
  • You can do the following the to get features of the src from the edges. ` import dgl import torch g = dgl.graph(([1, 1, 2, 3, 4], [0, 2, 0, 4, 2])) g.ndata['h'] = torch.tensor([[0.], [1.], [2.], [3.], [4.]]) g.apply_edges(lambda edges: {'m': edges.src['h']}) print(g.edata['m']) ' – tonygrey Jun 15 '23 at 05:23

0 Answers0