I'm trying to store the current graph in browser on the server side and now I'm testing how to. I ran into a strange Problem: after jsoning, decycling, stringifying and reloading the graph, the elements are somehow lost.
var j = network_tab.cy.json();
j = JSON.decycle(j);
j = JSON.stringify(j);
network_tab.cy.load(j);
Before decycling the graph, I cannot stringify it. If you look in the stringified version, you can see, that the elements are still there, but after loading, they are gone.
Maybe I have a problem in general with the cy.load() function, but I do hope you guys can help me.
EDIT: The problem seems to be with the stringify function. Then my question boils down how to make the whole object readable for load().
An element must be of type `nodes` or `edges`; you specified `undefined`
console.error( msg );
cytoscape.js (line 244)
TypeError: obj._private is undefined
I want to copy the whole thing, but especially the elements, the positions. So is it better to reinitialize the graph completely and when so, how do I add the positions of the nodes?