Creat graph (cytoscape) in the browser

Hello! I want to creata graph in the browser by adding vertices and connecting them with edges. I read about callbacks, but did not understand how best to do it. Maybe there are examples?
You also need to be able to save the created graph in a file