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

Review and update @nx._dispatchable usage since 3.2.1 #7302

Merged
merged 2 commits into from Feb 18, 2024

Conversation

eriknw
Copy link
Contributor

@eriknw eriknw commented Feb 17, 2024

This adds (and updates) @nx._dispatchable decorator to some new functions. I reviewed the diff since version 3.2.1.

There are now three algorithms I know that implicitly use "weight" weight (no weight argument): hits, tournament_matrix, and is_regular_expander.

The only other functional change I made in this PR is to add seed to random_regular_expander_graph.

Copy link
Member

@dschult dschult left a comment

Choose a reason for hiding this comment

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

Thanks for going through and finding these issues, especially finding the new functions that missed getting the dispatchable decorator. I just have a question (below) about which numpy random classes to support.

Comment on lines 809 to 810
from numpy.random import RandomState

Copy link
Member

Choose a reason for hiding this comment

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

Should we support np.random.Generator alongside RandomState?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Probably:

if isinstance(random_state, np.random.Generator):
return random_state

The tests don't need this to pass, but I added it anyway in case future tests need it.

@MridulS MridulS merged commit 0ed564b into networkx:main Feb 18, 2024
39 of 41 checks passed
@jarrodmillman jarrodmillman added this to the 3.3 milestone Feb 18, 2024
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
* Review and update `@nx._dispatchable` usage since 3.2.1

* Also handle `np.random.Generator`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

4 participants