Gathering detailed insights and metrics for cytoscape-fcose
Gathering detailed insights and metrics for cytoscape-fcose
Gathering detailed insights and metrics for cytoscape-fcose
Gathering detailed insights and metrics for cytoscape-fcose
@types/cytoscape-fcose
TypeScript definitions for cytoscape-fcose
cytoscape
Graph theory (a.k.a. network) library for analysis and visualisation
cytoscape-cose-bilkent
The CoSE layout for Cytoscape.js by Bilkent with enhanced compound node placement
cytoscape-dagre
The Dagre layout for DAGs and trees for Cytoscape.js
npm install cytoscape-fcose
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
146 Stars
220 Commits
27 Forks
10 Watching
9 Branches
14 Contributors
Updated on 23 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-0.1%
97,881
Compared to previous day
Last week
0.2%
473,204
Compared to previous week
Last month
24.7%
1,951,554
Compared to previous month
Last year
91.4%
17,343,711
Compared to previous year
1
1
fCoSE (pron. "f-cosay", fast Compound Spring Embedder), is a faster version of our earlier compound spring embedder algorithm named CoSE, implemented as a Cytoscape.js extension by i-Vis Lab in Bilkent University.
Here are some demos: simple, compound, and constraints, respectively:
fCoSE layout algorithm combines the speed of spectral layout with the aesthetics of force-directed layout. fCoSE runs up to 2 times as fast as CoSE while achieving similar aesthetics.
Furthermore, fCoSE also supports a fairly rich set of constraint types (i.e., fixed position, vertical/horizontal alignment and relative placement).
You can see constraint support in action in the following videos: fixed node, alignment, relative placement, hybrid, real life graphs. Constraints can also be added incrementally on a given layout.
Please cite the following when you use this layout:
H. Balci and U. Dogrusoz, "fCoSE: A Fast Compound Graph Layout Algorithm with Constraint Support," in IEEE Transactions on Visualization and Computer Graphics, 28(12), pp. 4582-4593, 2022.
U. Dogrusoz, E. Giral, A. Cetintas, A. Civril and E. Demir, "A Layout Algorithm For Undirected Compound Graphs", Information Sciences, 179, pp. 980-994, 2009.
fCoSE supports user-defined placement constraints as well as its full support for compound graphs. These constraints may be defined for simple nodes. Supported constraint types are:
Fixed node constraint: The user may provide exact desired positions for a set of nodes called fixed nodes. For example, in order to position node n1 to (x: 100, y: 200) and node n2 to (x: 200, y: -300) as a result of the layout, fixedNodeConstraint
option should be set as follows:
1fixedNodeConstraint: [{nodeId: 'n1', position: {x: 100, y: 200}}, 2 {nodeId: 'n2', position: {x: 200, y: -300}}],
Alignment constraint: This constraint aims to align two or more nodes (with respect to their centers) vertically or horizontally. For example, for the vertical alignment of nodes {n1, n2, n3} and {n4, n5}, and horizontal alignment of nodes {n2, n4} as a result of the layout, alignmentConstraint
option should be set as follows:
1alignmentConstraint: {vertical: [['n1', 'n2', 'n3'], ['n4', 'n5']], horizontal: [['n2', 'n4']]},
Note: Alignment constraints in a direction must be given in most compact form. Example: ['n1', 'n2', 'n3']
instead of ['n1', 'n2'], ['n1', 'n3']
.
Relative placement constraint: The user may constrain the position of a node relative to another node in either vertical or horizontal direction. For example, in order to position node n1 to be above of node n2 by at least 100 pixels and position node n3 to be on the left of node n4 by at least 75 pixels as a result of the layout, relativePlacementConstraint
option should be set as follows:
1relativePlacementConstraint: [{top: 'n1', bottom: 'n2', gap: 100}, 2 {left: 'n3', right: 'n4', gap: 75}],
The gap
property is optional. If it is omitted, average idealEdgeLength
is used as the gap value.
Download the library:
npm install cytoscape-fcose
,bower install cytoscape-fcose
, orImport the library as appropriate for your project:
ES import:
1import cytoscape from 'cytoscape'; 2import fcose from 'cytoscape-fcose'; 3 4cytoscape.use( fcose );
CommonJS require:
1let cytoscape = require('cytoscape'); 2let fcose = require('cytoscape-fcose'); 3 4cytoscape.use( fcose ); // register extension
AMD:
1require(['cytoscape', 'cytoscape-fcose'], function( cytoscape, fcose ){ 2 fcose( cytoscape ); // register extension 3});
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed. Just add the following files:
<script src="https://unpkg.com/layout-base/layout-base.js"></script>
<script src="https://unpkg.com/cose-base/cose-base.js"></script>
<script src="https://unpkg.com/cytoscape-fcose/cytoscape-fcose.js"></script>
When calling the layout, e.g. cy.layout({ name: 'fcose', ... })
, the following options are supported:
1var defaultOptions = { 2 3 // 'draft', 'default' or 'proof' 4 // - "draft" only applies spectral layout 5 // - "default" improves the quality with incremental layout (fast cooling rate) 6 // - "proof" improves the quality with incremental layout (slow cooling rate) 7 quality: "default", 8 // Use random node positions at beginning of layout 9 // if this is set to false, then quality option must be "proof" 10 randomize: true, 11 // Whether or not to animate the layout 12 animate: true, 13 // Duration of animation in ms, if enabled 14 animationDuration: 1000, 15 // Easing of animation, if enabled 16 animationEasing: undefined, 17 // Fit the viewport to the repositioned nodes 18 fit: true, 19 // Padding around layout 20 padding: 30, 21 // Whether to include labels in node dimensions. Valid in "proof" quality 22 nodeDimensionsIncludeLabels: false, 23 // Whether or not simple nodes (non-compound nodes) are of uniform dimensions 24 uniformNodeDimensions: false, 25 // Whether to pack disconnected components - cytoscape-layout-utilities extension should be registered and initialized 26 packComponents: true, 27 // Layout step - all, transformed, enforced, cose - for debug purpose only 28 step: "all", 29 30 /* spectral layout options */ 31 32 // False for random, true for greedy sampling 33 samplingType: true, 34 // Sample size to construct distance matrix 35 sampleSize: 25, 36 // Separation amount between nodes 37 nodeSeparation: 75, 38 // Power iteration tolerance 39 piTol: 0.0000001, 40 41 /* incremental layout options */ 42 43 // Node repulsion (non overlapping) multiplier 44 nodeRepulsion: node => 4500, 45 // Ideal edge (non nested) length 46 idealEdgeLength: edge => 50, 47 // Divisor to compute edge forces 48 edgeElasticity: edge => 0.45, 49 // Nesting factor (multiplier) to compute ideal edge length for nested edges 50 nestingFactor: 0.1, 51 // Maximum number of iterations to perform - this is a suggested value and might be adjusted by the algorithm as required 52 numIter: 2500, 53 // For enabling tiling 54 tile: true, 55 // The comparison function to be used while sorting nodes during tiling operation. 56 // Takes the ids of 2 nodes that will be compared as a parameter and the default tiling operation is performed when this option is not set. 57 // It works similar to ``compareFunction`` parameter of ``Array.prototype.sort()`` 58 // If node1 is less then node2 by some ordering criterion ``tilingCompareBy(nodeId1, nodeId2)`` must return a negative value 59 // If node1 is greater then node2 by some ordering criterion ``tilingCompareBy(nodeId1, nodeId2)`` must return a positive value 60 // If node1 is equal to node2 by some ordering criterion ``tilingCompareBy(nodeId1, nodeId2)`` must return 0 61 tilingCompareBy: undefined, 62 // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) 63 tilingPaddingVertical: 10, 64 // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) 65 tilingPaddingHorizontal: 10, 66 // Gravity force (constant) 67 gravity: 0.25, 68 // Gravity range (constant) for compounds 69 gravityRangeCompound: 1.5, 70 // Gravity force (constant) for compounds 71 gravityCompound: 1.0, 72 // Gravity range (constant) 73 gravityRange: 3.8, 74 // Initial cooling factor for incremental layout 75 initialEnergyOnIncremental: 0.3, 76 77 /* constraint options */ 78 79 // Fix desired nodes to predefined positions 80 // [{nodeId: 'n1', position: {x: 100, y: 200}}, {...}] 81 fixedNodeConstraint: undefined, 82 // Align desired nodes in vertical/horizontal direction 83 // {vertical: [['n1', 'n2'], [...]], horizontal: [['n2', 'n4'], [...]]} 84 alignmentConstraint: undefined, 85 // Place two nodes relatively in vertical/horizontal direction 86 // [{top: 'n1', bottom: 'n2', gap: 100}, {left: 'n3', right: 'n4', gap: 75}, {...}] 87 relativePlacementConstraint: undefined, 88 89 /* layout event callbacks */ 90 ready: () => {}, // on layoutready 91 stop: () => {} // on layoutstop 92};
To be able to use packComponents
option, cytoscape-layout-utilities
extension should also be registered in the application.
Packing related options should be set via cytoscape-layout-utilities
extension.
If they are not set, fCoSE uses default options.
npm run test
: Run Mocha tests in ./test
npm run build
: Build ./src/**
into cytoscape-fcose.js
npm run watch
: Automatically build on changes with live reloading (N.b. you must already have an HTTP server running)npm run dev
: Automatically build on changes with live reloading with webpack dev servernpm run lint
: Run eslint on the sourceN.b. all builds use babel, so modern ES features can be used in the src
.
This project is set up to automatically be published to npm and bower. To publish:
npm run build:release
git commit -am "Build for release"
npm version major|minor|patch
git push && git push --tags
npm publish .
bower register cytoscape-fcose https://github.com/iVis-at-Bilkent/cytoscape.js-fcose.git
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
40 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More