snap-stanford / ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
https://ogb.stanford.edu
MIT License
1.89k stars 397 forks source link

[Suggestion - PyG] option to load heterogeneous graphs as HeteroData #328

Open stadlmax opened 2 years ago

stadlmax commented 2 years ago

Hi OGB-Team, right now, heterogenous graphs are loaded as a Data objects by filling x_dict, edge_index_dict etc.. HeteroData in PyG on the other hand, stores features and edges by its node-type or edge-type identifier, e.g. node-related buffers like x are exposed as data[NODE_TYPE].buffer and edge-related buffers like edge_index are exposed as data[EDGE_TYPE].buffer.Those representations are quite similar besides basically the order of keys accessing the data, e.g. data.x_dict[NODE_TYPE] vs data[NODE_TYPE].x.

Is there any particular reason for this? If not, HeteroData would seem more flexible to me in the PyG framework, as it would allow for direct use with samplers or for transformations like to_undirected or to_homogeneous.

rusty1s commented 2 years ago

This is a good suggestion! For now, it should be no problem to manually convert your data into a HeteroData object but I agree that there exists no reason to not integrate PyG 2.0 features within OGB. I will try to do this.

Kumbong commented 1 year ago

@rusty1s Do you still plan on working on this? Can I pick up this issue?

rusty1s commented 1 year ago

Just answered you in private. I would really love to see this issue being finally integrated :)