Source nodes from a heterogeneous graph

please, is it possible to get the source nodes of a heterogeneous graph which has different nodes and edges types?
this is my graph:

G = dgl.heterograph({
        ('user', 'rates', 'item') : M.nonzero(),
        ('item', 'rated_by', 'user') : M.transpose().nonzero(),
        ('user', 'follows', 'user'): M2.nonzero()})

And thank you in advance.

I guess you are asking how to get the source nodes of a particular edge type? You could do so one edge type at a time with

src, dst = G.edges(etype=('user', 'rates', 'item'))

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.