Search code examples
javascriptcytoscape.jscytoscape

Fix node positions using klay layout in cytoscape.js


Is there a way to manually fix (x,y) position of the nodes using klay layout in cytoscript.js? Or would it be easier to use elkjs to do this?


Solution

  • The Klay library does not have facilities to set restrictions on node positions.

    There are two major classes of layouts:

    (1) Force-directed (e.g. CoSE, Cola): You can just lock a node and its position is fixed in the physics simulation.

    (2) Geometric (e.g. Klay, concentric): Either the algorithm supports restrictions on node position or it doesn't. If there's no option explicitly available in the layout itself, then it's not possible.