Is it possible to have multiple cytoscape graph instances that are unrelated but share the same source elements?
Here is an example of what i'm trying to do : https://jsfiddle.net/fa8hbdnh/
var elements = [
{ data: { id: 'n1'}, position: {x:100, y: 100}},
{ data: { id: 'n2'}, position: {x:150, y :150}},
//--->Edges--->
{ data: {id: 'e1', source: 'n1', target: 'n2'}},
];
var graph1 = cytoscape({
headless: true,
elements: elements
});
var graph2 = cytoscape({
headless: true,
elements: elements
});
graph1.elements()[0].data('foo',100); // Only changing graph1...
console.log(graph2.elements()[0].data('foo')); // ...however graph2 is also modified
(this requires the cytoscape library - http://js.cytoscape.org/)
As you can see, I change graph1 but graph 2 is also affected. Is there a way to save data elements on one instance without affecting other instances?