xgi-org / xgi

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

Strange drawing behavior for large edges #466

Closed nwlandry closed 9 months ago

nwlandry commented 10 months ago

For

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

the plot looks like image

maximelucas commented 10 months 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 10 months ago

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

maximelucas commented 9 months ago

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

nwlandry commented 9 months 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.