I am doing a node classification using GCN(https://pytorch-geometric.readthedocs.io/en/latest/modules/nn.html#torch_geometric.nn.conv.GCNConv), based on the formulation it is expected that all the nodes have the same representation for a fully connected graph. But they are different. I am not able to understand why it is different?
I have tried on a small graph of size 4, final representation looks like below
tensor([[0.4232, 0.0000],
[0.5726, 0.0000],
[0.4293, 0.0000],
[0.2699, 0.0000]],
They are all different. As per my understanding they should be same. Can you please give your opinion.
notebook attached for code reference:
GCNConv.zip
Best,
Anil
Representations are only the same if node features are also equal, which I do not think they are:
loc = torch.FloatTensor(4, 2).uniform_(0, 1)
In addition, edge_index = torch.ones((2, num_edges * 2), dtype=torch.long) does not encode a fully connected graph!
Thanks for the response!
Yes, node features are different but since the graph is fully connected, every node gets a contribution from every other node, this means that even if the node features are different, it does not matter as parameters are shared across.
Regarding the edge index, should they be a matrix of node ids pairs? In my case its just matrix of ones of size(2, num_edges * 2)
Yes, it needs to be a matrix with node id pairs of shape [2, num_edges].
Hi @rusty1s ,
if all nodes are connected to all other nodes (fully connected graph), with GCN conv, I don't see why nodes embeddings should be different ? Because the message passing reduces to:

Yes, of course, I was too fast on this one. But edge_index is wrongly encoded nonetheless.
Most helpful comment
Yes, of course, I was too fast on this one. But
edge_indexis wrongly encoded nonetheless.