cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
269 stars 62 forks source link

Deleting a node does not update the widget #244

Closed ahrm closed 3 years ago

ahrm commented 3 years ago

Bug report

Bug summary

When I delete a node from the graph, the previously displayed widgets are not updated.

Code for reproduction

#%%
from ipycytoscape import CytoscapeWidget
import networkx as nx

G = nx.Graph()
G.add_nodes_from([0,1])
G.add_edge(0, 1)

cyto_widget = CytoscapeWidget()
cyto_widget.graph.add_graph_from_networkx(G)
cyto_widget

#%%
cyto_widget.graph.remove_node_by_id('0')

#%%
cyto_widget

Actual outcome

cytobug

The left panel is the output from the first time the widget is shown and the right panel is from the second time the widget is shown (which is the expected output).

Version Info

marimeireles commented 3 years ago

Thanks for the bug report @ahrm! I think I fixed this issue months ago in the open PR, at least that's the name for my commit: https://github.com/QuantStack/ipycytoscape/pull/177/commits/593c1c8d0d30a9539ac17ec81f5f4687cd6605f2 Apparently what's missing here to merge this PR is my input for documenting it and creating tests, I'll try to get into it!

marimeireles commented 3 years ago

Fixed by #177