Reset a Cytoscape Graph

2.2k views Asked by At

I just observed that there are too many questions regarding resetting a cytoscape.js graph to its originally loaded state.

Following is a simple function you need to call to reset the graph:

cy.layout();

You can bind it to click events as and when needed.

Cheers!

1

There are 1 answers

0
JALO - JusAnotherLivngOrganism On BEST ANSWER

To reset to original state:

cy.layout();

To fit the randomly panned/zoomed graph to the div:

cy.fit();

Hope it helps!