How to improve spacing in cose layout? Js?

I use cytoscape.js 2.3.9 and I play with some layouts. Now I get about 150 knots, but I want to rise to 1000-1500. There are about 25 nodes with 1-50 possible children. My best approach to what I needed was with the cose layout, but I am pretty far from my final expected result.

I tried several configurations, playing with my attribute values, as documented, but I'm not so much focused on simulations and I feel like I'm trying without much sense.

With this configuration:

layout: { 'name':'cose', 'animate':false, 'refresh':.1, 'edgeElasticity' : 20, 'fit': true, 'gravity' : 100 } 

I get this result (the red line shows the size of the containing div): enter image description here

I want the graph to fit better, leaving less free space and child nodes closer to its parent. Sometimes with a few elements is better (but not always), for example: enter image description here

But even in this case, some child nodes overlap their parent, while others still remain.

Any advice on attribute values ​​or any other layout that works best for my drinker?

Thanks.

+6
source share
1 answer

Like the nature of power circuits / physical sim models, you must adapt the force values ​​to your specific data. My suggestion is to copy-paste the example into documents for cose ; It uses the default values.

Experiment by changing each value independently and see what effect you get.

Unfortunately, there is no single size for all strength values, but we tried to set default values ​​that work fine for most of the data we saw.

+3
source

Source: https://habr.com/ru/post/982105/


All Articles