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

Egonet a.k.a. per-edge neighbors #63

Merged
merged 4 commits into from
Mar 23, 2022
Merged

Egonet a.k.a. per-edge neighbors #63

merged 4 commits into from
Mar 23, 2022

Conversation

leotrs
Copy link
Collaborator

@leotrs leotrs commented Mar 21, 2022

I'm moving the conversation from #32 to here.

The current is a proof of concept. We just have to agree on the name and whether we want an analogous method for edges. Once we agree on that, I'll implement those and add tests.

Demo:

In [6]: H = xgi.Hypergraph([(0,1,2), (1,2), (0, 3)])

In [7]: H.neighbors(0)
Out[7]: {1, 2, 3}

In [8]: H.egonet(0)
Out[8]: [[1, 2], [3]]

In [9]: H.egonet(0, include_self=True)
Out[9]: [[0, 1, 2], [0, 3]]

Closes #32.

@leotrs leotrs requested a review from iaciac March 21, 2022 11:55
Copy link
Collaborator

@iaciac iaciac left a comment

Choose a reason for hiding this comment

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

Looks clean to me! :)

@maximelucas
Copy link
Collaborator

Looks good. Do we want H.neighbors(0) to return a set or a list (of unique values)?

@leotrs
Copy link
Collaborator Author

leotrs commented Mar 22, 2022

I think a set is more meaningful because it makes it more readily apparent that each neighbor appears only once.

@leotrs
Copy link
Collaborator Author

leotrs commented Mar 22, 2022

Alright since you both think it's good - this is ready for review. Any thoughts on the name of the method?

@maximelucas
Copy link
Collaborator

I think it's good. Regarding the name, I would not intuitively go looking for H.egonet() when wanting its output. But I think since we linked both functions in the doc, it's okay.

Do we want to add the order parameter in both of those? Can be later too. It already works as it is.

@leotrs
Copy link
Collaborator Author

leotrs commented Mar 22, 2022

Oh good call - that makes me think we might want to leave this for later so we may have a systematic way of filtering edges by order across the entire codebase...

@leotrs leotrs merged commit 179ab15 into main Mar 23, 2022
@leotrs leotrs deleted the feat_egonet branch March 23, 2022 08:55
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.

neighbors
3 participants