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

Refactor Hypergraph.copy() #145

Merged
merged 3 commits into from
Aug 4, 2022
Merged

Refactor Hypergraph.copy() #145

merged 3 commits into from
Aug 4, 2022

Conversation

leotrs
Copy link
Collaborator

@leotrs leotrs commented Jul 28, 2022

Multiple things were Wrong with copy():

  1. It was using subhypergraph() which returns a frozen hypergraph (yikes!). I'm guilty of this one.
  2. See Hypergraph.copy needs to deepcopy hypergraph attributes #128
  3. A naive implementation of copy() would have had a bug when using add_edge. I fixed it in the current PR. See comment starting on line 944 in hypergraph.py.

Fixes #128.

Copy link
Collaborator

@nwlandry nwlandry left a comment

Choose a reason for hiding this comment

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

Looks good. Some minor comments, possibly some future fixes.

xgi/classes/hypergraph.py Outdated Show resolved Hide resolved
xgi/classes/hypergraph.py Show resolved Hide resolved
@nwlandry nwlandry merged commit 9a6f20a into main Aug 4, 2022
@nwlandry nwlandry deleted the fix-128 branch August 4, 2022 11: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.

Hypergraph.copy needs to deepcopy hypergraph attributes
2 participants