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 method #161

Merged
merged 14 commits into from
Sep 5, 2022
Merged

Cleanup method #161

merged 14 commits into from
Sep 5, 2022

Conversation

nwlandry
Copy link
Collaborator

  • Added a cleanup method that removes artifacts specified by the user: multi-edges, singletons, isolates. It also can convert all labels to consecutive integers.
  • Modified the duplicates() method to not include the first instance of the node/edge in the list of duplicates, so that when you call H.remove_edges_from(H.edges.duplicates()) it only removes the redundant edges, not all of the edges. In preparation of only supporting non-loopy edges, the duplicates() method has been simplified to not differentiate between duplicate nodes in an edge.

@nwlandry nwlandry requested a review from leotrs August 31, 2022 17:45
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.

Thanks for this! BTW, does this depend on #162?

Also, should we add a parameter in_place? If in_place is False, then a new hypergraph is returned and the original one is left intact. This might simplify some of the code inside the if reindex: branch.

xgi/classes/hypergraph.py Outdated Show resolved Hide resolved
xgi/classes/hypergraph.py Outdated Show resolved Hide resolved
xgi/classes/reportviews.py Show resolved Hide resolved
xgi/convert.py Outdated Show resolved Hide resolved
xgi/classes/hypergraph.py Outdated Show resolved Hide resolved
@nwlandry nwlandry mentioned this pull request Sep 1, 2022
@leotrs
Copy link
Collaborator

leotrs commented Sep 5, 2022

Pro tip: next time try rebasing your PR rather than merging main into it bc it makes it hard to review. The current diff shows both changes from this PR as well as the other one. If rebasing does not work/is scary, you can also just close it and start a new PR.

@nwlandry nwlandry merged commit 1c7cd86 into main Sep 5, 2022
@nwlandry nwlandry deleted the cleanup-method branch September 5, 2022 15:07
@leotrs leotrs mentioned this pull request Sep 5, 2022
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