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

Unexpected absent return value in convert_to_hypergraph #327

Closed
leotrs opened this issue Apr 10, 2023 · 1 comment
Closed

Unexpected absent return value in convert_to_hypergraph #327

leotrs opened this issue Apr 10, 2023 · 1 comment

Comments

@leotrs
Copy link
Collaborator

leotrs commented Apr 10, 2023

I'd expect convert.convert_to_hypergraph to ALWAYS return a hypergraph. However:

In [2]: xgi.convert_to_hypergraph([{1,2,3},{2,3},{3,4}])

In [3]: xgi.convert_to_hypergraph([{1,2,3},{2,3},{3,4}], create_using=xgi.Hypergraph)

In [4]: xgi.convert_to_hypergraph([{1,2,3},{2,3},{3,4}], create_using=xgi.Hypergraph())

In [5]: xgi.convert_to_hypergraph(None)
Out[5]: <xgi.classes.hypergraph.Hypergraph at 0x7faf87067190>

Only the last one has a return value! This is because convert_to_hypergraph is designed to be used alongside create_using, and populate the passed in hypergraph in-place. This is far from ideal, I'd say. We should redesign the interface of this and other functions in the convert module.

@maximelucas
Copy link
Collaborator

Not ideal indeed, good catch.
+1 for making these convert functions more consistent.

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

No branches or pull requests

2 participants