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

new add method #203

Merged
merged 2 commits into from
Oct 31, 2022
Merged

new add method #203

merged 2 commits into from
Oct 31, 2022

Conversation

nwlandry
Copy link
Collaborator

Allows users to add two hypergraphs together. This reindexes all edges and keeps them all.

@leotrs
Copy link
Collaborator

leotrs commented Oct 28, 2022

I haven't read the entire code yet BUT the + operator should absolutely at all times represent an operation that is commutative. If it is not commutative, then we shouldn't use the + operator.

@nwlandry
Copy link
Collaborator Author

😭

@leotrs
Copy link
Collaborator

leotrs commented Oct 29, 2022

OK how about this?

# Keeps edge ids of H1 and relabels the edge ids of H2
# All edges (after relabeling) keep all their attributes
# The node attributes of H1 take precedence over the node attributes of H2
# The hypergraph attributes of H1 take precedence over the hypergraph attributes of H2
X = H1 << H2

Since this is not commutative, I propose we use << since I don't think we'd be using it for any other purpose.

Note that if H1 and H2 have no attributes at all, then H1 << H2 and H2 << H1 are isomorphic (though the edge ids are different).

@leotrs leotrs mentioned this pull request Oct 30, 2022
@nwlandry
Copy link
Collaborator Author

Okay, I did your suggestion with the small difference that H2 attributes take preference, but very happy to change to H1 precedence.

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.

I'm happy.

@nwlandry nwlandry merged commit 93320f5 into main Oct 31, 2022
@nwlandry nwlandry deleted the add-operation branch October 31, 2022 19:43
@maximelucas maximelucas mentioned this pull request Dec 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