pytorch_geometric icon indicating copy to clipboard operation
pytorch_geometric copied to clipboard

`RandomLinkSplit` enhancement for undirected graphs

Open saiden89 opened this issue 2 years ago • 2 comments

🚀 The feature, motivation and pitch

As briefly discussed in #5169, RandomLinkSplit currently returns edge_label_index in directed form, regardless of the input graph being undirected or the arguments passxfed to the transform. We can extend to possibility to return appropriate supervision edges according to the usecase. As far as I can tell we can do so in various ways:

  • Let PyG guess the directiveness of the input graph and perform the split accordingly: this way undirected graphs will have only undirected edge indices and viceversa. Additionally, give the user the possibility to override the settings.
  • Keep the current defaults (without guessing), but give the user the possibility to override.

As far as my (quite limited) experience goes, if the usecase is centered on undirected network(s) we will probably stick to those throughout all the steps. The same goes for the directed counterpart. Even when dealing with heterogenous network, there is rarely the need to have different types of message passing (MP) and supervision edges within the same edge types. So I guess that for most cases keeping in sync MP and validation indices is preferrable.

Alternatives

Currently, it is possible to manually carry out the necessary transformations after the split, on a per use basis.

Additional context

No response

saiden89 avatar Aug 11 '22 20:08 saiden89

I have no strong opinion here. As discussed in #5169, I think that if one wants to predict undirected edges, one should use a symmetric encoder or take care of both directions on its own. We can make this more clear in the documentation.

Wondering if other people have some thoughts here (@Padarn @lightaime @wsad1) - if this feels indeed overly complicated, then let's change it :)

rusty1s avatar Aug 12 '22 04:08 rusty1s

I think that if one wants to predict undirected edges, one should use a symmetric encoder or take care of both directions on its own.

I tend to agree with this. But I do think the current interface makes this a bit unclear (its a little confusing that the undirected flag does not make the labels undirected). I'd prefer to provide clear documentation and leave it as is.

But also not a very strong opinion.

Padarn avatar Aug 12 '22 08:08 Padarn