Cytoscape-cose-bilkent provides an advanced Compound Spring Embedder (CoSE) layout algorithm for the Cytoscape.js graph visualization library. Developed by the i-Vis Lab at Bilkent University, it is specifically designed to handle complex compound graphs with nested structures and supports non-uniform node dimensions, which is a key differentiator from simpler layout algorithms. The current stable version is 4.1.0. The package has seen performance improvements (e.g., v3.0.0) and architectural changes (v4.1.0) for better modularity. It maintains an active release cadence, primarily focusing on compatibility with Cytoscape.js and continuous improvements to its layout quality and speed. Its primary purpose is to produce aesthetically pleasing and readable layouts for graphs, particularly those with hierarchical or grouped components, by intelligently managing node repulsion, edge elasticity, and gravitational forces.
npm install cytoscape-cose-bilkentVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes a Cytoscape.js instance with a simple graph, including compound nodes, then registers and applies the `cose-bilkent` layout with common configuration options, demonstrating its ability to arrange nested structures.
Upgrade your Cytoscape.js dependency to `^3.2.0` or higher to use `cytoscape-cose-bilkent@4.x.x`.
For non-npm setups, ensure `cose-base` and `layout-base` are loaded as global scripts prior to `cytoscape-cose-bilkent`. For npm users, no direct action is needed as `npm install` manages these.
If supporting older browsers, include a comprehensive polyfill library like `core-js`. For best results, use modern evergreen browsers.
Experiment with `quality` ('draft', 'default', 'proof'), `numIter`, `nodeRepulsion`, and `idealEdgeLength` parameters. For large graphs, consider 'draft' quality or reducing `numIter` for quicker (though potentially less optimal) results.Ensure `cytoscape` is fully imported and available before calling `cytoscape.use(coseBilkent)`.
Verify that `import coseBilkent from 'cytoscape-cose-bilkent';` and `cytoscape.use(coseBilkent);` are present and executed before attempting to use the layout, and ensure `name: 'cose-bilkent'` is used in the layout call.
Ensure `const cy = cytoscape({...});` has completed execution and `cy` is a valid Cytoscape.js graph instance before calling `cy.layout()`.