paulbrodersen / netgraph

Publication-quality network visualisations in python
GNU General Public License v3.0
660 stars 39 forks source link

Opacity behavior when removing vertex #66

Closed fsoupimenta closed 1 year ago

fsoupimenta commented 1 year ago

Hello, I'm working on a project that uses Netgraph, and when i remove a vertex that has one of its adjacent ones with opacity 1, the opacity of the other vertices bugs and they behave strangely.

Graph-Filter-test-2023-03-29-11-59-00

paulbrodersen commented 1 year ago

Sorry, I had not considered this edge case. Steps to reproduce:

1) Select a node with multiple outgoing edges. 2) Hover over an incident edge such that it is emphasized and all other edges are de-emphasized. 3) Delete node while hovering over the edge.

Removing the node also removes the incident edges, but the de-emphasized edges are still in the list of de-emphasized artists. The attempt to reverse the opacity results in the error.

paulbrodersen commented 1 year ago

The latest commit mitigates the issue such that it should no longer result in an error, and the appearances of all artists should be restored to normal on the first movement.

Note to future self: for some reason, the artists for the de-emphasized edges aren't removed from self.deemphasized_artists when deleting the edge, although we explicitly do so in _interactive_variants.MutableGraph._delete_edge.