Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
graphology-layout-noverlap
Advanced tools
Noverlap anti-collision layout algorithm for graphology.
JavaScript implementation of the Noverlap anti-collision layout algorithm for graphology.
Note that this algorithm is iterative and might not converge easily in some cases.
npm install graphology-layout-noverlap
Each node's starting position must be set before running the Noverlap anti-collision layout. Two attributes called x
and y
must therefore be defined for all the graph nodes.
20
]: number of grid cells horizontally and vertically subdivising the graph's space. This is used as an optimization scheme. Set it to 1
and you will have O(n²)
time complexity, which can sometimes perform better with very few nodes.5
]: margin to keep between nodes.1.1
]: percentage of current space that nodes could attempt to move outside of.1.0
]: ratio scaling node sizes.3
]: dampening factor that will slow down node movements to ease the overall process.import noverlap from 'graphology-layout-noverlap';
const positions = noverlap(graph, {maxIterations: 50});
// With settings:
const positions = noverlap(graph, {
maxIterations: 50,
settings: {
ratio: 2
}
});
// With a custom input reducer
const positions = noverlap(graph, {
inputReducer: (key, attr) => ({
x: store[key].x,
y: store[key].y,
size: attr.size
}),
outputReducer: (key, pos) => ({x: pos.x * 10, y: pos.y * 10})
});
// To directly assign the positions to the nodes:
noverlap.assign(graph);
Arguments
500
]: maximum number of iterations to perform before stopping. Note that the algorithm will also stop as soon as converged.If you need to run the layout's computation in a web worker, the library comes with a utility to do so:
Example
import NoverlapLayout from 'graphology-layout-noverlap/worker';
const layout = new NoverlapLayout(graph, params);
// To start the layout. It will automatically stop when converged
layout.start();
// To stop the layout
layout.stop();
// To kill the layout and release attached memory
layout.kill();
// Assess whether the layout is currently running
layout.isRunning();
0.4.2
FAQs
Noverlap anti-collision layout algorithm for graphology.
The npm package graphology-layout-noverlap receives a total of 24,583 weekly downloads. As such, graphology-layout-noverlap popularity was classified as popular.
We found that graphology-layout-noverlap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.