`HeteroData.subgraph()`
See original GitHub issue🚀 The feature, motivation and pitch
Similar to Data.subgraph()
, there should exist a HeteroData.subgraph()
method to compute subgraphs in a heterogeneous graph setting, e.g., for obtaining inductive node splits. Here, mask
/index
should be of type dict
, holding masks/indices for each/a subset of node types:
hetero_data.subgraph({'paper': mask})
Alternatives
No response
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:9 (6 by maintainers)
Top Results From Across the Web
torch_geometric.data — pytorch_geometric documentation
Returns the induced subgraph containing the node types and corresponding nodes in subset_dict . data = HeteroData() data['paper'].x = ... data['author'].x ...
Read more >Graph: Mini-batch sampling in large-scale graphs - zqfang
Overall, all heterogeneous graph loaders will produce a HeteroData object as output, holding a subset of the original data, ...
Read more >Graph.subgraph — NetworkX 2.8.8 documentation
Returns a SubGraph view of the subgraph induced on nodes . The induced subgraph of the graph contains the nodes in nodes and...
Read more >How to customly mini-batch HeteroData in PyTorch ...
from torch_geometric.data import Data, HeteroData class SeqData(HeteroData): def __init__(self): super().__init__() def __inc__(self, key, ...
Read more >torch-geometric Changelog
Added `HeteroData.subgraph` functionality ([4243](https://github.com/pyg-team/pytorch_geometric/pull/4243)) - Added the `MaskLabel` module and a ...
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
Pinging @mananshah99 and @sdulloor here who shared interest in contributing this feature as well.
It depends on which data you want to train on. If you want to shrink the data prior to training, then
HeteroData.subgraph
would be applicable to create a smaller subgraph from your original graph. If you just want to operate on smaller batches during training, then you may want to adjust thebatch_size
argument of a loader.Let me know if that makes sense to you.