How to pass message inversely through an edge?


#1

Hi, I’d like to reproduce Gated Graph Neural Networks using DGL.
I’m wondering how to pass message inversely through an edge, as the model mentioned in the paper uses features of nodes connected by both incoming and outgoing edges separately.


#2

Check out dgl.reverse. It returns a graph whose all edges are the of the reverse direction. If you pass share_ndata=True, then the returned graph will share node features with the input graph. You can then perform message passing on the two graphs alternatively using different UDFs. Since they share node features, the change can be seen by both graphs.


#3

I’ll have a try. Thanks!