xgi-org / xgi

CompleX Group Interactions (XGI) is a Python package for higher-order networks.
https://xgi.readthedocs.io
Other
186 stars 30 forks source link

Strange drawing behavior for large edges #466

Closed nwlandry closed 1 year ago

nwlandry commented 1 year ago

For

import xgi
H = xgi.sunflower(3, 1, 50)
xgi.draw(H, node_size=5)

the plot looks like image

maximelucas commented 1 year ago

What specifically do you think should be different?

I guess this hypergraph has 3 edges of size 50, so each hyperedge should almost look like a regular polygon, or at least some convex shape. And the we could ideally want the center node to be closer to the "flowers"?

I tried playing with the spring strength k of the layout and managed to get this:

import xgi
H = xgi.sunflower(3, 1, 50)

pos = xgi.barycenter_spring_layout(H, k=0.25)
xgi.draw(H, node_size=5, pos=pos)
Screenshot 2023-09-01 at 17 08 24
nwlandry commented 1 year ago

It seems weird to me that despite very few constraints that the edge isn't convex.

maximelucas commented 1 year ago

@nwlandry I think you investigated this but I don't remember the conclusion. Should this be closed?

nwlandry commented 1 year ago

Thanks for the reminder, @maximelucas! You're right. The issue is that the edges are not necessarily convex, but this was addressed with the draw_hypergraph_hull() function introduced in PR #320 authored by @thomasrobiglio.