How to reload graph in cytoscape.js?

2020-03-24 08:58发布

问题:

Is there a function that resets the graph to it's freshly loaded state? I've tried cy.reset() but that just resets zoom and pan, not restoring to the virgin graph.

Also is there a way to restore all removed elements?

Thanks!

回答1:

Call cy.elements().remove() and cy.add() with the same graph data.