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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cleanup] Gathering graph utilities around BasicGraph/MoleculeGraph #13

Merged
merged 5 commits into from
Jan 8, 2025

Conversation

Yoric
Copy link
Collaborator

@Yoric Yoric commented Jan 7, 2025

We have many graph-related functions with various pre-requisites on graphs, plus lots of conversions from pyg to networkx.

This change:

  • introduces two classes BasicGraph and MoleculeGraph, depending on which invariants hold on the graph;
  • attaches the relevant methods to BasicGraph/MoleculeGraph instead of arbitrary pyg graphs;
  • makes sure that we have only one single conversion from pyg to networkx;
  • adds a little documentation;
  • ports tests and notebook to the above changes.

@Yoric Yoric requested review from RolandMacDoland and ShaheenPasqal and removed request for RolandMacDoland and ShaheenPasqal January 7, 2025 11:50
@Yoric Yoric self-assigned this Jan 7, 2025
Copy link
Collaborator

@RolandMacDoland RolandMacDoland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Yoric. Few comments from my side. Happy to approve once addressed.

examples/pipeline.ipynb Outdated Show resolved Hide resolved
qek/data/datatools.py Outdated Show resolved Hide resolved
qek/data/datatools.py Outdated Show resolved Hide resolved
qek/data/datatools.py Outdated Show resolved Hide resolved
qek/data/datatools.py Show resolved Hide resolved
qek/data/datatools.py Outdated Show resolved Hide resolved
qek/data/datatools.py Show resolved Hide resolved
if any(distance_from_center > device.max_radial_distance):
return False

# Check the distance between nodes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it possible to reuse is_disk_graph here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How so?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in is_disk_graph there is this distance check between nodes. Just wondering if that couldn't be reused here.

qek/data/datatools.py Outdated Show resolved Hide resolved
qek/data/datatools.py Outdated Show resolved Hide resolved
Yoric added 3 commits January 7, 2025 15:17
Before this change, we have many graph-related functions with various
pre-requisites on graphs, plus lots of conversions from pyg to networkx.

This change:

- introduces two classes BasicGraph and MoleculeGraph, depending on
	which invariants hold on the graph;
- attaches the relevant methods to BasicGraph/MoleculeGraph instead of
	pyg;
- makes sure that we have only one single conversion from pyg to networkx.
Furthermore, we move some code from the notebook to the library, as our users are going to need it.
@Yoric Yoric requested a review from RolandMacDoland January 7, 2025 16:15
@RolandMacDoland
Copy link
Collaborator

@Yoric Happy for you to merge once you've replied to the thread of discussion above.

@Yoric Yoric merged commit f8ee2f9 into main Jan 8, 2025
6 checks passed
@Yoric Yoric deleted the yoric/graphs branch January 8, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants