Home > Net >  Cytoscape graph automove (with animation) when dragging a node
Cytoscape graph automove (with animation) when dragging a node

Time:02-11

I was looking to this example of cola.js in which, when dragging a specific node, the other nodes have the capability to automove according to the new position of the node I'm dragging, and the thing I'm interested in is that you can see the graph transition to the new position in a sort of animation. I noticed that cytoscape does this with cytoscape-automove extention, but in every example I found there's no animation and no delay performed when nodes automove. Could you suggest any way to do this with cytoscape?

CodePudding user response:

There is cytoscape.js-cola which does more or less what cola does. The option infinite: true animates the graph while moving nodes as seen in your example.

You simply would need to add the cola layout to the cy instance – after installing the cytoscape.js-cola-module with npm install cytoscape-cola f.e.

let options = {
  name: 'cola',
  infinite: true

};
cy.layout( options );
cy.layout.run()
  • Related