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

Add encapsulation dag functionality #444

Merged
merged 21 commits into from
Aug 4, 2023

Conversation

tlarock
Copy link
Collaborator

@tlarock tlarock commented Aug 3, 2023

This PR adds a new file for constructing encapsulation DAGs of hypergraphs with three different kinds of relations as discussed in #413, as well as tests. Builds on #427.

I've exposed two functions:

  1. to_encapsulation_dag(H, subset_types="all"). Computes and returns an encapsulation DAG of the hypergraph H. The parameter subset_types controls the types of relations that are included in the DAG.
  2. empirical_subsets_filter(H, dag). Filters dag of H in place from all subset relations to only empirically maximum relations. Used internally in to_encapsulation_dag(H, subset_type="empirical"). Exposed externally so that a user can first compute and store the full DAG, then apply filtering later to a copy, i.e.:
H = xgi.Hypergraph(incoming_data=[["a","b","c"], ["b","c","f"], ["a","b"], ["c", "e"], ["a"], ["f"]])
dag = to_encapsulation_dag(H, subset_type="all")
dag.edges()
OutEdgeView([(0, 2), (0, 4), (2, 4), (1, 5)])
empirical_subsets_filter(H, dag)
dag.edges()
OutEdgeView([(0, 2), (2, 4), (1, 5)])

dag = to_encapsulation_dag(H, subset_types="empirical")
dag.edges()
OutEdgeView([(0, 2), (2, 4), (1, 5)])

Happy to clarify anything or take suggestions for changes!

tlarock and others added 16 commits July 25, 2023 10:11
* feat: added shuffle_hyperedges + tests

* feat: added shuffle_hyperedges + tests

* fix: filenames

* fix: tests

* style: black and isort

* feat: added function node_swap + test

* style: black and isort

* fix: error from python 3.11
* attempt at listing the available statistics

* fixing previous errors

* Attempt at implementing suggestions by nich

* second attempt at displaying the titles

* another trial

* titles in bold

* update of the panel for dihypergraph stats

* minor fixes

* change the hierarchical structure

* minor change

* moving MultiDi-stats in the right place

* adding decorators to the admonition box

* moving up the decorators
* feat: enforce equal aspect for circular layout xgi-org#430

* changed implementation of set_aspect
* refact: draw module

* style: black and isort
…l relations filtering function. Documentation improvements.
@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Patch coverage: 95.16% and project coverage change: +0.06% 🎉

Comparison is base (52e6aac) 90.97% compared to head (dd17340) 91.03%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #444      +/-   ##
==========================================
+ Coverage   90.97%   91.03%   +0.06%     
==========================================
  Files          59       60       +1     
  Lines        4100     4162      +62     
==========================================
+ Hits         3730     3789      +59     
- Misses        370      373       +3     
Files Changed Coverage Δ
xgi/convert/encapsulation_dag.py 95.08% <95.08%> (ø)
xgi/convert/__init__.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maximelucas
Copy link
Collaborator

Thanks Tim! I think the new functions still need to be added to the docs?
I'll continue reviewing this later today or tomorrow.

@maximelucas
Copy link
Collaborator

Looks good to me, thanks Tim! Just a few minor comments.

Also, do you think you could add short examples if not too long? Otherwise it's fine.

tlarock and others added 4 commits August 4, 2023 11:29
Co-authored-by: Maxime Lucas <maximelucas@users.noreply.github.com>
Co-authored-by: Maxime Lucas <maximelucas@users.noreply.github.com>
@tlarock
Copy link
Collaborator Author

tlarock commented Aug 4, 2023

Ready to go on my end now :)

@maximelucas maximelucas merged commit 7f93d0e into xgi-org:main Aug 4, 2023
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.

4 participants