New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphology-layout-forceatlas2

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphology-layout-forceatlas2 - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

25

helpers.js

@@ -123,2 +123,4 @@ /**

// NOTE: float32 could lead to issues if edge array needs to index large
// number of nodes.
var NodeMatrix = new Float32Array(order * PPN);

@@ -136,8 +138,8 @@ var EdgeMatrix = new Float32Array(size * PPE);

NodeMatrix[j + 1] = attr.y;
NodeMatrix[j + 2] = 0;
NodeMatrix[j + 3] = 0;
NodeMatrix[j + 4] = 0;
NodeMatrix[j + 5] = 0;
NodeMatrix[j + 6] = 1 + graph.degree(node);
NodeMatrix[j + 7] = 1;
NodeMatrix[j + 2] = 0; // dx
NodeMatrix[j + 3] = 0; // dy
NodeMatrix[j + 4] = 0; // old_dx
NodeMatrix[j + 5] = 0; // old_dy
NodeMatrix[j + 6] = 1; // mass
NodeMatrix[j + 7] = 1; // convergence
NodeMatrix[j + 8] = attr.size || 1;

@@ -151,5 +153,12 @@ NodeMatrix[j + 9] = attr.fixed ? 1 : 0;

graph.forEachEdge(function (edge, attr, source, target, sa, ta, u) {
var sj = index[source];
var tj = index[target];
// Handling node mass through degree
NodeMatrix[sj + 6] += 1;
NodeMatrix[tj + 6] += 1;
// Populating byte array
EdgeMatrix[j] = index[source];
EdgeMatrix[j + 1] = index[target];
EdgeMatrix[j] = sj;
EdgeMatrix[j + 1] = tj;
EdgeMatrix[j + 2] = getEdgeWeight(edge, attr, source, target, sa, ta, u);

@@ -156,0 +165,0 @@ j += PPE;

@@ -614,8 +614,6 @@ /* eslint no-constant-condition: 0 */

if (adjustSizes === true) {
distance = Math.sqrt(
Math.pow(xDist, 2) +
Math.pow(yDist, 2) -
NodeMatrix[n1 + NODE_SIZE] -
NodeMatrix[n2 + NODE_SIZE]
);
distance =
Math.sqrt(xDist * xDist + yDist * yDist) -
NodeMatrix[n1 + NODE_SIZE] -
NodeMatrix[n2 + NODE_SIZE];

@@ -622,0 +620,0 @@ if (options.linLogMode) {

{
"name": "graphology-layout-forceatlas2",
"version": "0.9.1",
"version": "0.9.2",
"description": "ForceAtlas 2 layout algorithm for graphology.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -63,4 +63,4 @@ # Graphology ForceAtlas2

- **graph** _Graph_: target graph.attributes** _?object_: an object containing custom attribute name mapping:
- **weight** _?string_ [`weight`]: name of the edge weight attribute.
- **graph** _Graph_: target graph.attributes\*\* _?object_: an object containing custom attribute name mapping:
- **weight** _?string_ [`weight`]: name of the edge weight attribute.
- **weighted** _?boolean_ [`false`]: whether to consider edge weight.

@@ -82,3 +82,6 @@ - **options** _object_: options:

// The parameters are the same as for the synchronous version, minus `iterations` of course
const layout = new FA2Layout(graph, {settings: {gravity: 1}, getEdgeWeight: 'weight'});
const layout = new FA2Layout(graph, {
settings: {gravity: 1},
getEdgeWeight: 'weight'
});

@@ -85,0 +88,0 @@ // To start the layout

@@ -626,8 +626,6 @@ /**

if (adjustSizes === true) {
distance = Math.sqrt(
Math.pow(xDist, 2) +
Math.pow(yDist, 2) -
NodeMatrix[n1 + NODE_SIZE] -
NodeMatrix[n2 + NODE_SIZE]
);
distance =
Math.sqrt(xDist * xDist + yDist * yDist) -
NodeMatrix[n1 + NODE_SIZE] -
NodeMatrix[n2 + NODE_SIZE];

@@ -634,0 +632,0 @@ if (options.linLogMode) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc