Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
cytoscape-arbor
Advanced tools
The Arbor physics simulation layout for Cytoscape.js
The arbor
layout gives relatively slow and poor results compared to other physics simulation layouts. Consider using cose
, cose-bilkent
, or cola
instead.
The arbor
layout uses a force-directed physics simulation. For more information about Arbor and its parameters, refer to its documentation.
Notes about Arbor:
http://
) rather than a local address (e.g. file://
).liveUpdate
option can potentially be expensive, so if you are concerned about running time (e.g. for large graphs), you should set it to false
.<script>
in your <head>
. Therefore, you can not combine arbor.js
with your other JavaScript files — as you probably would as a part of the minification of the scripts in your webapp.arbor.js
included with Cytoscape.js (or the unpatched, original arbor.js
if you are unaffected by the issues it contains). If using npm, note that Arbor is not downloaded as an npm package automatically and needs special attention when including it as explained in the point above.Download the library:
npm install cytoscape-arbor
,bower install cytoscape-arbor
, orrequire()
the library as appropriate for your project:
CommonJS:
var cytoscape = require('cytoscape');
var cyarbor = require('cytoscape-arbor');
var arbor = require('arbor');
cyarbor( cytoscape, arbor ); // register extension
AMD:
require(['cytoscape', 'cytoscape-arbor', 'arbor'], function( cytoscape, cyarbor, arbor ){
cyarbor( cytoscape, arbor ); // register extension
});
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
Call the layout, e.g. cy.layout({ name: 'arbor', ... })
, with the following options:
var defaults = {
animate: true, // whether to show the layout as it's running
maxSimulationTime: 4000, // max length in ms to run the layout
fit: true, // on every layout reposition of nodes, fit the viewport
padding: 30, // padding around the simulation
boundingBox: undefined, // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
ungrabifyWhileSimulating: false, // so you can't drag nodes during layout
randomize: false, // uses random initial node positions on true
// callbacks on layout events
ready: undefined, // callback on layoutready
stop: undefined, // callback on layoutstop
// forces used by arbor (use arbor default on undefined)
repulsion: undefined,
stiffness: undefined,
friction: undefined,
gravity: true,
fps: undefined,
precision: undefined,
// static numbers or functions that dynamically return what these
// values should be for each element
// e.g. nodeMass: function(n){ return n.data('weight') }
nodeMass: undefined,
edgeLength: undefined,
stepSize: 0.1, // smoothing of arbor bounding box
// function that returns true if the system is stable to indicate
// that the layout can be stopped
stableEnergy: function( energy ){
var e = energy;
return (e.max <= 0.5) || (e.mean <= 0.3);
},
// infinite layout options
infinite: false // overrides all other options for a forces-all-the-time mode
};
This project is set up to automatically be published to npm and bower. To publish:
export VERSION=1.2.3
gulp publish
bower register cytoscape-arbor https://github.com/cytoscape/cytoscape.js-arbor.git
FAQs
The Arbor physics simulation layout for Cytoscape.js
We found that cytoscape-arbor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.