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

fix: HG using SC as data #399

Merged
merged 7 commits into from
Jun 15, 2023

Conversation

thomasrobiglio
Copy link
Collaborator

Related to #398. The bug was coming from the condition I had set in the convert_to_hypergraph() in PR #345 (sry 😢). Now it should be fixed.

There are two issues related to this:

  1. The constructors xgi.Hypergraph(SC) and xgi.SimplicialComplex(H) are not tested!
  2. How it is implemented now if I call the cover convert_to_hypergraph() as a standalone with a SC as an object I get back the HG constructed from the maximal simplices of the SC, if instead, I call it via the constructor I get a HG in which every simplex in the SC becomes an edge. Is this ok or we want to change it?

For me it is intuitive to have the standalone convert give only the maximal simplices but I guess this is debatable.
Screenshot 2023-06-13 alle 12 24 22

@codecov
Copy link

codecov bot commented Jun 13, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (d7e59cc) 90.95% compared to head (186b1b7) 90.95%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #399      +/-   ##
==========================================
- Coverage   90.95%   90.95%   -0.01%     
==========================================
  Files          47       47              
  Lines        3882     3893      +11     
==========================================
+ Hits         3531     3541      +10     
- Misses        351      352       +1     
Impacted Files Coverage Δ
xgi/convert.py 94.71% <100.00%> (-0.17%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@thomasrobiglio thomasrobiglio linked an issue Jun 13, 2023 that may be closed by this pull request
@nwlandry
Copy link
Collaborator

Yeah, they should at least be consistent. I think the most natural (although the most dense) would be to keep all the subfaces when converting to a hypergraph. Perhaps you could add optional argument (maybe keep_subfaces) specifying whether to keep the subfaces or not with the default value being True

*make convert_to_hypergraph consistent between constructor and standalone

*point to from_max_simplices in the docs

*adjust test
@thomasrobiglio
Copy link
Collaborator Author

Ok, I think a good solution would be:

  • no ambiguity in convert_to_hypergraph between constructor and standalone call
  • make from_max_simplices more discoverable.

Let me know what you think about it.

@maximelucas maximelucas self-requested a review June 13, 2023 17:32
@nwlandry
Copy link
Collaborator

Hi @thomasrobiglio - I like your solution! Once Max is okay with this, it's ready to squash and merge.

@maximelucas
Copy link
Collaborator

Nice work thanks Thomas! I agree:

  • convert_to_hypergraph(S) and Hypergraph(S) should do the same.
  • if a function keeps only the maximal simplices, it should be explicit. As you found out Thomas, we have from_max_simplices that does that. Good idea making it more discoverable.
  • great to add tests for the constructors so we won't break them in the future!

Your solution looks good. Just a few comments to make the tests more precise, otherwise good to go.

@thomasrobiglio thomasrobiglio merged commit 71d8498 into xgi-org:main Jun 15, 2023
@thomasrobiglio thomasrobiglio deleted the fix_bug_HG_constructor branch June 15, 2023 07:53
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.

xgi.Hypergraph(SC) not working anymore?
3 participants