xgi icon indicating copy to clipboard operation
xgi copied to clipboard

Speed up `draw_xgi_nodes` and `draw_xgi_hyperedges`

Open nwlandry opened this issue 2 years ago • 1 comments

If we remove the for-loop in the function that draws the hypergraph nodes with scatter and instead pass iterables into the scatter function, it could be faster. Also, if we plot Collection objects instead of Patch objects, maybe it will be faster as well. (https://stackoverflow.com/questions/37573314/matplotlib-efficient-way-to-create-large-number-of-patch-objects)

nwlandry avatar Sep 21 '22 16:09 nwlandry

This might also be relevant: https://stackoverflow.com/questions/43216111/anyway-to-draw-many-lines-fast-in-python-matploblib-is-preferred-if-possible

nwlandry avatar Sep 22 '22 16:09 nwlandry

Node speed-up implemented in #211

maximelucas avatar Nov 07 '22 11:11 maximelucas

Any ideas on how to optimize the edge function?

leotrs avatar Jun 19 '23 08:06 leotrs

I have a vague memory that it was supposed to be similar to the node speed-up, and that it was just that nobody implemented it. @nwlandry @iaciac ?

maximelucas avatar Jun 19 '23 09:06 maximelucas

I tried to make it faster but my recollection was that plotting a collection of patches gave you less control over the color and other properties of individual edges compared with plotting a patch at a time.

nwlandry avatar Jun 19 '23 10:06 nwlandry