Global Graph attributes

Hi,
I know global graph attributes have been discussed previously, but I could not find an actual example where such is implemented. I’m new to dgllife and I’ve been playing aroung with the MPNN and AttentiveFP models to predict some molecular property. I am looking for a way to include also global graph properties to the model. I’d really appreciate an example that points me to the right direction.

Thanks a lot for making this great tool accessible!

3 Likes

There are two possibilities here:

  1. You can train a GNN without global graph properties. After obtaining graph-level representations, you can concatenate them with global graph properties and pass the results to an MLP for final prediction.
  2. You can use global graph properties to augment input node features and use them directly in message passing.

I don’t think there are examples for these two possibilities right now. Let me know if you have any difficulties in implementing them.

2 Likes

Hi andt88,
Did you find a way to implement global attributes?
I’m working on a model and I’m also having trouble with this.
Thanks for your reponse

You just need to maintain a separate tensor of shape (B, D), where B is the number of graphs. Each time you batch a list of graphs, you also index this tensor to retrieve graph-level attributes of the corresponding graphs and concatenate/stack them.