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

Introduce and use decorators for graph sanitizers #289

Merged
merged 3 commits into from
Feb 17, 2020

Conversation

sdmccabe
Copy link
Collaborator

This PR (in addition to a few cosmetic changes like cleaning up typos I
encountered) introduces two decorators, @unweighted and @undirected, that
apply the ensure_unweighted() and ensure_undirected() functions to each
positional argument to a function that is subclassed from nx.Graph().

This commit (in addition to a few cosmetic changes like cleaning up typos I
encountered) introduces two decorators, `@unweighted` and `@undirected`, that
apply the `ensure_unweighted()` and `ensure_undirected()` functions to each
positional argument to a function that is subclassed from `nx.Graph()`.
@sdmccabe sdmccabe requested a review from leotrs February 17, 2020 01:19
Copy link
Collaborator

@leotrs leotrs left a comment

Choose a reason for hiding this comment

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

The code LGTM, but is there any sensible way of adding meaningful tests here?

Also, should there be Warnings when converting? I don't like changing input data silently.

@sdmccabe
Copy link
Collaborator Author

The code LGTM, but is there any sensible way of adding meaningful tests here?

We have tests for handling weighted and directed input. Given that, the fact that the existing tests passed suggest that the decorators work, at least on the graph distance side. The decorators are also used in dynamics, where test coverage is considerably worse.

Not systematic, but if you comment out @unweighted on dkSeries or @undirected on QuantumJSD, the relevant tests fail.

Also, should there be Warnings when converting? I don't like changing input data silently.

The decorators are calling the ensure_undirected() and ensure_unweighted() functions, which emit Warnings.

@leotrs leotrs merged commit 9d79a50 into netsiphd:master Feb 17, 2020
@sdmccabe sdmccabe deleted the decorators branch February 17, 2020 15:40
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