Calculating degree for GCN #5100
Unanswered
gau-nernst
asked this question in
Q&A
Replies: 1 comment 3 replies
-
When I don't think we need an option to control how degree is computed it should depend only on the |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
According to the paragraph after Eq. 2 in the GCN paper (https://arxiv.org/pdf/1609.02907.pdf), degree is calculated by summing each row in the adjacency matrix.
I believe this is equivalent to out-degree for directed graphs.
Currently
gcn_norm()
calculates degree by summing each column (in-degree) instead:pytorch_geometric/torch_geometric/nn/conv/gcn_conv.py
Lines 63 to 64 in 4f392ac
Summing each row or summing each column are the same for undirected graphs. I notice that before commit 72e8ef3, degree is summed for each row. Although the original GCN paper is not meant for directed graphs, what is the reason for this change?
Right now, to get the original behaviour of GCN on directed graphs (which aggregates target to source), I can pass
flow="target_to_source"
inGCNConv
, but I cannot change the way degree is calculated when normalizing the adjacency matrix. Would it make sense to add an option to select how degree is calculated? (in-degree or out-degree, which will pass this parameter togcn_norm()
)Beta Was this translation helpful? Give feedback.
All reactions