Source Node Features are Emptied


#1

Hi,

Sorry to bother again!!

I have another question: I found that after message passing and message aggregation, the features for source nodes, whose in_degree = 0, are emptied. For example, there are three nodes, (0,1,2), edges are [(1,0), (1,2)]. After being passed through GNN, the destination nodes (0, 2) features are correctly computed, but all features of node 1 will become all zeros. So can I know how to preserve my original source node features instead of being emptied?

Thanks so much in advance!!


Question about update_all
#2

Hi,

Thank you for the contact and sorry for the inconvenience. I assume you did update_all, could you please try send_and_recv and see if the problem still exists?


#3

Hi, mufei,

Thanks for your reply. Yeah, I used update_all. I have tried your suggestion, which is send_and_recv(g.edges(), message_func=gcn_msg, reduce_func=gcn_reduce) and it works fine, meaning it can preserve the original source node feature. Also, when I used separated one g.send(g.edges(), gcn_msg) g.recv(g.nodes(), gcn_reduce), it does not work, and has the same result as using update_all.

Thanks so much for your suggestion!!


#4

So the problem is when you are doing update_all or recv(g.nodes(), gcn_reduce), the update is performed across all nodes regardless of whether there are incoming edges. In this case a zero placeholder is used by default and will replace the original node features if you use the same attribute field. I know this is a bit tricky so when you are not sure if the whole graph is connected, do send_and_recv instead.


#5

Thanks so much for the explanation!! If it is possible and if there is no clear explanation in the document for this, could you please add this into the DGL doc to make it clear to others when they refer to it?
Thanks!!


#6

Yeah, Thanks for the suggestion. I will discuss with others and see what will be a preferred way to do this.


#7

I added an issue about this in the github repo, it will be great if you can join our discussion.