Closed 5tinzi closed 1 year ago
Hi @5tinzi, your implementation is actually correct and functionally equivalent to the one in this repo. The one in this repo is complicated by the fact that you don't want to materialize large dense matrices but do gather/scatter operations or sparse matrix multiplications and you want to support edge weights if present.
Thanks for such wonderful project, I get some troubles in follow the idea of GCNConv layer code.
Allow me to begin by presenting my understanding of the GCN. From the GCN paper Semi-supervised Classification with Graph Convolutional Networks, The computation representation of the GCN layer is simple as:
$$ \displaylines{ A = \hat{D}^{-\frac{1}{2}} \hat{A} \hat{D}^{-\frac{1}{2}} \ X^{l+1} = f(W, A) = \sigma(AX^{l} W) } $$
where $A$ is a normalized graph Laplacian could be first calculated in a pre-processing step. $X^{l+1}$ is the output of layer l .
Intuitively a GCNConv could be build with the following code (pseudo):
then we can define and apply a GCN layer as follow:
The above is my very personal understanding. Maybe it's some preconceived notion, I find the GraphNeuralNetworks' GCNConv design is a bit difficult to follow:
x = x .* c'
(in line 102 and 110 ) , so it seems it performs $x \hat{D}^{-\frac{1}{2}} \hat{D}^{-\frac{1}{2}}$ instead of $\hat{D}^{-\frac{1}{2}} \hat{A} \hat{D}^{-\frac{1}{2}}$. it is hard to follow the idea here, any tips or suggestion here? https://github.com/CarloLucibello/GraphNeuralNetworks.jl/blob/afd80e8024abb270db79cd8592376ba60bc63f60/src/layers/conv.jl#L100-L110Any advice would be appreciated and thank you for your patience.