pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.52k stars 3.69k forks source link

Is GCNConv applicable to directed graphs? #3735

Open xyb151158 opened 2 years ago

xyb151158 commented 2 years ago

The paper corresponding to GCNConv mentioned that this method is only applicable to undirected graphs, so can't this method be used to deal with directed graphs? Are there other convolution layers that can handle directed graphs?

rusty1s commented 2 years ago

From a theoretical viewpoint, this is indeed correct. However, in practice, there is nothing that restricts GCNConv to be applied to directed graphs as well (which holds true for any PyG layer).

In directed graphs, you usually want to take care of integrating "reverse" edges during message passing as well (with distinct model parameters), e.g.:

conv = SAGEConv(in_channels, out_channels)
conv_rev = SAGEConv(in_channels, out_channels)

out = conv(x, edge_index) + conv(x, edge_index.flip([0]))