pyg-team / pytorch_geometric

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

Nodes with no Node Features for GCNs. #1464

Closed reshinthadithyan closed 4 years ago

reshinthadithyan commented 4 years ago

❓ Questions & Help

Say I have a Graph, with Nodes which doesn't hold individual Node Features. How can I pass it through a GCNs?

rusty1s commented 4 years ago

In case no node features are given, you have multiple options:

  1. You can use synthetic node features like node degree, e.g., via transforms.OneHotDegree()
  2. You can use the identity matrix as input node features.
  3. You can use learnable embeddings for each node via torch.nn.Embedding. The first option is a good choice in inductive training scenarios, while the latter two are good choices in transductive/semi-supervised learning tasks.
reshinthadithyan commented 4 years ago

Thank you, @rusty1s .