Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Roadmap] Better support for hypergraphs #7312

Closed
2 of 5 tasks
wsad1 opened this issue May 6, 2023 · 12 comments
Closed
2 of 5 tasks

[Roadmap] Better support for hypergraphs #7312

wsad1 opened this issue May 6, 2023 · 12 comments

Comments

@wsad1
Copy link
Member

wsad1 commented May 6, 2023

馃殌 The feature, motivation and pitch

Following this discussion. The goal is to improve support for hypergraphs in pyg via:

  • Add HyperGraphData object that inherits from BaseData and implements __inc__, __cat_dim__, num_nodes, subgraph etc for hyper graphs. The hyperedge_index will be of shape [2, num_hyper_edges*num_nodes_per_hyper_edge], see here for an example.[Hypergraph data object聽#7611]
  • Test that DataLoader works with HyperGraphData. [Hypergraph data object聽#7611]
  • Add a hyper graph dataset to Datasets
  • Add hyper graph gnns like HGNN,
  • Add an example that uses all of the above new modules.
@wsad1 wsad1 added the feature label May 6, 2023
@wsad1 wsad1 self-assigned this May 6, 2023
@wsad1 wsad1 changed the title Better support for hypergraphs. [Roadmap]: Better support for hypergraphs May 6, 2023
@rusty1s rusty1s added the roadmap label May 7, 2023
@wsad1 wsad1 changed the title [Roadmap]: Better support for hypergraphs [Roadmap] Better support for hypergraphs May 8, 2023
@CodeTal
Copy link
Contributor

CodeTal commented Jun 12, 2023

@wsad1 Hello sir, I am a new open-source contributor and PyG user. I happened to see this issue and found that the hypergraph is a really interesting notion. Could I work on this issue?

@rusty1s
Copy link
Member

rusty1s commented Jun 13, 2023

I don't think @wsad1 is currently working on this. Just let me know when you would be available to work on this so that we avoid duplicated efforts.

@CodeTal
Copy link
Contributor

CodeTal commented Jun 13, 2023

@rusty1s OK. I will try to do something these days.

@CodeTal
Copy link
Contributor

CodeTal commented Jun 13, 2023

@rusty1s Thank you for letting me know!

@CodeTal
Copy link
Contributor

CodeTal commented Jun 14, 2023

Hello, I am trying to implement the HyperGraphData class first. I have gone through some relevant codes and formulated some initial ideas. I think most functions can be inherited from the Data class, and here are something that we need to change:

  1. Re-name some parameters. For example, edge_index to hyperedge_index, adj to incidence
  2. Re-implement some functions.
  • Prior issues (Question about mini-batches training for hypergraph neural network聽#7365锛塵entioned that the __inc__ function should be refactored. Based on my understanding of how the tensors are collated during batching, the __inc__ of HyperGraphData should still return the num_nodes for the first row of hyperedge_index but return the num_hyperedges for the second row of hyperedge_index.
  • The __cat_dim__ function could remain the same as the concatenation method doesn't change.
  • The subgraph function should be changed because the expression of edge_index has changed.
  • Other functions could remain the same as the original Data class.

I am new to this project, so I still have many confusions. If I am wrong, could you please provide some feedback when you are free? Thanks a lot!

@wsad1
Copy link
Member Author

wsad1 commented Jun 17, 2023

@CodeTal Thanks for showing interest in this. Yes you are right On all fronts. Are you planning to have HyperGraphData inherit from Data, I think that should be ok to start with.
Are you interested in sending in a PR with HyperGraphData and updates to __inc__, and subgraph?

@CodeTal
Copy link
Contributor

CodeTal commented Jun 17, 2023

Sure! I am working on this. Thank you for your reply!

@CodeTal
Copy link
Contributor

CodeTal commented Jun 19, 2023

Sorry for the delay, I was stuck by several engineering problems related to the project. I have created a pull request #7611 which contains a HyperGraphData with __inc__ and subgraph reimplemented. I found that there is no clear definition for a hypergraph's subgraph. So I chose a way to implement it (Please refer to the PR comment).

@wsad1
Copy link
Member Author

wsad1 commented Jun 20, 2023

Thanks @CodeTal will take a look by end of week.

@rusty1s rusty1s pinned this issue Jun 23, 2023
@mehular0ra
Copy link

@wsad1 Hello, I am a new open-source contributor and a PyG user. Can I add a hyper graph dataset? I work on Neuroimaging data and can contribute ABIDE2 data. I can also contribute standard datasets as well.

@wsad1
Copy link
Member Author

wsad1 commented Nov 17, 2023

@mehular0ra sorry for the extremely delayed reply. We'd be happy to add your dataset to pyg.

@wsad1
Copy link
Member Author

wsad1 commented Nov 22, 2023

@mehular0ra will open another issue to track the remaining items.

@wsad1 wsad1 closed this as completed Nov 22, 2023
rusty1s added a commit that referenced this issue Apr 4, 2024
Reference: #8501 #7312 

Request for Review: @rusty1s @wsad1

This PR aims to add HyperGraph datasets consisting of timestamped
simplices where each simplex is a set of nodes. Released with the paper
[Simplicial Closure and higher-order link
prediction](https://huggingface.co/papers/1802.06916).

Notes:
> "[In compliance with PEP 8 and PEP 257, Ruff prefers double quotes for
triple quoted strings and docstrings even when using quote-style =
"single".](https://docs.astral.sh/ruff/settings/#format_quote-style)".

Thus even with pre-commit passing there are changes which convert `'` to
`"`. Should probably look into setting the `quote-style` property to
`"single"`, if single quotes are desired. That way it can be enforced
via pre-commit as well.

---
_**Update 26th March 2024**: There are multiple datasets which follow a
similar processing and loading workflow. Therefore, I have refactored to
make a single `CornellTemporalHyperGraphDataset` class. I'm still
encountering errors with the test on windows, would appreciate some help
on this_

---------

Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
@wsad1 wsad1 unpinned this issue May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants