iVis-at-Bilkent / cytoscape.js-fcose

fCoSE: a fast Compound Spring Embedder
MIT License
134 stars 25 forks source link

Issue for packing a compound graph #57

Closed nfigay closed 1 year ago

nfigay commented 2 years ago

Hello, First of all thank you so much for this great cytoscape.js extension. It pushed me to prototype a compound graph viewer for enterprise architects working with ArchiMate. I'm currently blocked with an issue when parameterizing the fcose layout with packing of the layout utilities. I didn't succeed in reaching the expected result, i.e. removing the wasted space on the middle of the graph, and I'm wondering what are the parameters I should change for succeeding. The parameters I used are the following: /// Definition of the layout for the compound graph interactive viewer var layout1={ name: "fcose", randomize: true, // fisheye: true, animate: 'end', fit: true, nodeDimensionsIncludeLabels: "true", condense:true, gravity: 1000, gravityRangeCompound: 100, gravityCompound: 100, gravityRange: 3.8, packComponents: true, // initialEnergyOnIncremental: 0.3, // nodeRepulsion: node => 10000, // idealEdgeLength: edge => 10, // edgeElasticity: edge => 0.45, // nestingFactor: 0.1, numIter: 50000, quality: "default"

}; /// complementary layout with parameters to define when randomize is not used for layouting //packing var layout2= { idealEdgeLength: 1, offset: 20, desiredAspectRatio: 10, polyominoGridSizeFactor: 0.1, utilityFunction: 1, componentSpacing: 1}

The obtain graph is the following:

Capture d’écran 2022-03-11 à 05 11 29

Any idea?

Many thanks in advance for your support.

Best regards.

Nicolas

hasanbalci commented 2 years ago

Hi @nfigay, it seems that the problem here is not about the packing of layout utilities. gravityRangeCompound option adjusts the range where the gravitational forces won't be applied inside a compound node. So when you increase it, you decrease the chance to apply it. Its default value is 1.5, so you may try to decrease it. If it's not resolved, you can send a reproducible example for me to explore more.

nfigay commented 1 year ago

Thanks for your response, and sorry for my late response. I've created a parameterized Enterprise architecture viewer based on ArchiMate langage, where you can play with all the parameters, in order to experiment and identified the most accurate parameterization. Still a kind of magic for me, but the idea: learning from experimentation. Again thanks for such a great library