Support for heterogeneous graphs
See original GitHub issue❓ Questions & Help
I new to gnn and was wondering if PyG has any support for modelling heterogeneous graphs. I’ve seen a HinSAGE and metapath2vec in the Stellar library but I am a PyTorch diva! Any plans to integrate these? Or, maybe you could describe how I can maybe use existing blocks to create these?
Also, is there support for the dataloading process? DGL
has heterogeneous graphs written on top of networkx
. Is there any easy way to port these data structures over into PyG.
Any feedback helps!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Heterogeneous Graph Learning - PyTorch Geometric
This tutorial introduces how heterogeneous graphs are mapped to PyG and how they can be ... Lazy initialization is supported for all existing...
Read more >Support for Heterogeneous Graphs · Issue #199 - GitHub
Now that we support HeteroGeneous Graphs in MLDatasets.jl. We should support HeteroGeneous graphs.
Read more >[2209.00610] Heterogeneous Graph Tree Networks - arXiv
In this work, we propose two heterogeneous graph tree network models: Heterogeneous Graph Tree Convolutional Network (HetGTCN) and Heterogeneous ...
Read more >Learning to Represent Programs with Heterogeneous Graphs
Then we use heterogeneous graph neural networks to learn on these graphs. We evaluate our approach on two tasks: code comment generation and ......
Read more >Computational method using heterogeneous graph ...
In the study, we developed a computational model that combined heterogeneous graph convolutional network with enhanced layer for miRNA–disease ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To the best of my knowledge, pytorch-geometric does not have any specific prebuilt ways of dealing with heterogeneous graphs.
That being said, it’s still fairly easy to implement, and I’ve done so previously on a power grid dataset. I’ll use a simplified form of this as an example.
From memory, what you have to do is:
Create a corresponding
Data
objectData
’sx
,edge_index
, andedge_attr
attributes, but adding whatever attributes you need.Data
object. For example,ensures that the keys in
increasing_funcs
will be treated just likeedge_index
, i.e. on batching the index will increase. For example, twobranch_index
(my equivalent toedge_index
) of[0, 1] , [1, 0]
and[0, 1], [1, 0]
will then be automatically batched to[0, 1, 2, 3], [1, 0, 3, 2]
. (For me, this was fairly simple becauseload_to_bus
andgen_to_bus
were one-dimensional. For you, you might have to add different values to different dimensions; maybe something likereturn np.array([len(self["gen"]), len(self["bus"]])
Data
objects hadbus
,generator
andload
features, andbus_to_bus
,gen_to_bus
, andload_to_bus
edges (with the same format asedge_index
). Additionally, there werebranch
features (related to thebus_to_bus
edges).Create a model to deal with heterogeneous graphs
Heterogeneous graph learning is supported in PyG 2.0: https://pytorch-geometric.readthedocs.io/en/latest/notes/heterogeneous.html