7

I'm using cytoscape.js 2.3.9 and I'm playing with some layouts. I'm now rendering about 150 nodes, but I wish to go up till 1000-1500. There are about 25 nodes with 1-50 posible childs. My best approach for what I need has been with 'cose' layout, but I'm quite far from my final expected result.

I've tried several configurations playing with its attributes values as documented, but I'm no so much in force directed simulations and feel like trying without much sense.

With this config:

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

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

I wish the graph fits better, leaving less blank space and child nodes to be closer to its parent. Sometimes with few elements fits better (but not always), like this: enter image description here

But even so some child nodes overlap its parent and others get so far.

Any advice on attributes values or any other layout that fit better on my purpouse?

Thank you.

peteorpeter
  • 4,037
  • 2
  • 29
  • 47
exoddus
  • 2,230
  • 17
  • 27
  • Layout's documentation is at https://github.com/cytoscape/cytoscape.js/blob/v2.3.9/documentation/md/layouts/cose.md and it's source code is at https://github.com/cytoscape/cytoscape.js/blob/v2.3.9/src/extensions/layout.cose.js. If you'd provide a `jsFiddle` for playing with your dataset then your chances to get a useful answer would raise a little – xmojmr Feb 07 '15 at 07:47

1 Answers1

3

As is the nature of force-directed/physics-sim layouts, you have to tailor the force values to your particular data. My suggestion is to copy-paste the example in the docs for cose; it uses the default values.

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

Unfortunately, there is no one-size-fits all set of force values, but we've tried to set defaults that work OK for most data we've seen.

maxkfranz
  • 11,896
  • 1
  • 27
  • 36
  • thanks for your response @maxkfranz that's what i'm doing, it's not perfect but much better than manual positioning ;) – exoddus Feb 12 '15 at 07:07
  • 2
    Can you please post link to sample code using cose layout? I couldn't find any sample code and I have same issue as in question. – adev Sep 13 '17 at 23:52