GraphSAGE with edge features?

Hi! I am a complete newbie here and I’m trying to get graph embeddings with GraphSAGE. The graphs I’m working with only have features on the edges and nothing on the nodes. I noticed that GraphSAGE only considers node features but not edges’. I was thinking about a couple approach to this problem:

  1. modify SAGEConv’s message passing function so that it uses edge features instead of nodes’
  2. aggregate the edge features to produce node features and then uses SAGEConv as usual (I am worried that this might lose out information on the edges)
  3. would NNConv be a better choice?

I will be very appreciative of any kind of suggestion! Thank you!

  1. I would start with replacing fn.copy_src('h', 'm') with fn.copy_e('h', 'm') in SageConv, assuming your edge features are stored in g.edata['h']. This should work well.
  2. NNConv tends to be more useful for small graphs like molecular graphs.
1 Like

Thanks so much! I just realised someone asked a similar question before at Using node and edge features in message passing.