cytoscape.js - spacing between nodes

Viewed 3603

I am using TypeScript to create a cytoscape graph. I am looking for a way to increase the spacing between nodes. I have tried to change the value of spacingFactor, but that did not change anything that I can see.

1 Answers

It always depends on the layout you use. The following snippet shows you how to use the spacingFactor property, other spacing propertys are found in the official documentation, normally these things are quite easy to find there. If you specify which layout you want, I can also help you with that specific layout.

Dagre:

this.cytoscape.layout({
  name: "dagre",
 spacingFactor: 12
}).run();

Concentric:

this.cytoscape.layout({
  name: "concentric",
  minNodeSpacing: 12
}).run();

Cose:

this.cytoscape.layout({
  name: 'cose-bilkent',
  animate: false,
  idealEdgeLength: 200
});

Spread:

this.cytoscape.layout({
   name: 'spread',
   minDist: 20
});

Klay:

don't use klay

Related