question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`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:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rusty1scommented, Feb 14, 2022

Pinging @mananshah99 and @sdulloor here who shared interest in contributing this feature as well.

0reactions
rusty1scommented, Feb 23, 2022

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 the batch_size argument of a loader.

Let me know if that makes sense to you.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found