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

Drawing directed hypergraph #387

Merged
merged 13 commits into from
Jun 8, 2023

Conversation

thomasrobiglio
Copy link
Collaborator

As discussed in #375. See below for the drawing. Added a simple test, maybe I can add more. Modified the DiHypergraph tutorial showing a simple example of the drawing function.
example_draw_dihypergraph

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@thomasrobiglio thomasrobiglio marked this pull request as ready for review June 6, 2023 15:02
@thomasrobiglio thomasrobiglio linked an issue Jun 6, 2023 that may be closed by this pull request
@maximelucas
Copy link
Collaborator

It looks pretty 😍 Is that what you had in mind @nwlandry ? Should we also add an option to draw the hyperedge (like a triangle for example) below it like in the other drawing functions?

@thomasrobiglio
Copy link
Collaborator Author

This should be easily done with the draw_hyperedges function but I'm afraid then it gets a bit ambiguous to have both the triangles and the squared markers representing the hyperedges

@nwlandry
Copy link
Collaborator

nwlandry commented Jun 6, 2023

This looks great, @thomasrobiglio!! My only suggestion would be to add a check that the input is indeed a directed hypergraph.

@nwlandry
Copy link
Collaborator

nwlandry commented Jun 6, 2023

Thanks so much!! 😎

@maximelucas
Copy link
Collaborator

Also why is one much lighter? Because it's a smaller hyperedge?

@thomasrobiglio
Copy link
Collaborator Author

Yes, if not specified the coloring is like the standard draw in which the color depends on the edge size

@thomasrobiglio
Copy link
Collaborator Author

thomasrobiglio commented Jun 6, 2023

Just noticed that edges of size 2 are treated as the other sizes so the function will still draw a square representing the edge... do we want to keep that or put simple arrows for edges of size 2?

@nwlandry
Copy link
Collaborator

nwlandry commented Jun 6, 2023

Just noticed that edges of size 2 are treated as the other sizes so the function will still draw a square representing the edge... do we want to keep that or put simple arrows for edges of size 2?

I actually prefer the square being there for dyads as well to emphasize the bipartite structure. Again, great work!

xgi/drawing/draw.py Outdated Show resolved Hide resolved
@leotrs
Copy link
Collaborator

leotrs commented Jun 7, 2023

Looking great! One thing - what do y'all think of an option to remove the squares? If all the lines are drawn up to the center of the square, then removing the squares will allow us to see the lines joining and forking again, which may be cool.

Alternatively, an option to change the size of the squares independently of the size of the circles.

@maximelucas
Copy link
Collaborator

Agreed with Leo. Also I don't see an option to add node/hyperedge labels, right? Could we add it like in the other viz functions?

Also the triangle blue looks so pale by default, I'll raise an issue to see if we can improve the default coloring.

@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Patch coverage: 86.15% and project coverage change: -0.09 ⚠️

Comparison is base (4f15c71) 91.11% compared to head (0864af0) 91.02%.

❗ Current head 0864af0 differs from pull request most recent head 56810ca. Consider uploading reports for the commit 56810ca to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #387      +/-   ##
==========================================
- Coverage   91.11%   91.02%   -0.09%     
==========================================
  Files          46       46              
  Lines        3771     3834      +63     
==========================================
+ Hits         3436     3490      +54     
- Misses        335      344       +9     
Impacted Files Coverage Δ
xgi/algorithms/centrality.py 97.39% <ø> (ø)
xgi/algorithms/clustering.py 96.66% <ø> (ø)
xgi/drawing/draw.py 77.47% <86.15%> (+1.52%) ⬆️

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

@nwlandry nwlandry merged commit 8c5e805 into xgi-org:main Jun 8, 2023
17 checks passed
@nwlandry
Copy link
Collaborator

nwlandry commented Jun 8, 2023

Great work, @thomasrobiglio!

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.

Visualize dihypergraphs
4 participants