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

ngraph.forcelayout3d

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngraph.forcelayout3d - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

lib/verletIntegrator.js

3

demo/index.js

@@ -13,2 +13,5 @@ var scene = new THREE.Scene();

// Or try this if you want verlet integratioon:
// var layout = require('../')(graph, { integrator: 'verlet'});
var geometry = new THREE.CubeGeometry(5,5,5);

@@ -15,0 +18,0 @@ var nodeMaterial = new THREE.MeshBasicMaterial({color: 0x009e8f});

@@ -17,3 +17,3 @@ /**

createSpringForce: require('./lib/springForce'),
integrator: require('./lib/eulerIntegrator'),
integrator: getIntegrator(physicsSettings),
createBody: require('./lib/createBody')

@@ -24,1 +24,9 @@ });

}
function getIntegrator(physicsSettings) {
if (physicsSettings && physicsSettings.integrator === 'verlet') {
return require('./lib/verletIntegrator.js');
}
return require('./lib/eulerIntegrator')
}

2

package.json
{
"name": "ngraph.forcelayout3d",
"version": "0.0.15",
"version": "0.0.16",
"description": "Force directed graph layout in 3d",

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

> ngraph.forcelayout3d@0.0.13 perf /Users/anvaka/projects/ngraphjs/modules/ngraph.forcelayout3d
> ngraph.forcelayout3d@0.0.15 perf /Users/anvaka/projects/ngraph/modules/ngraph.forcelayout3d
> npm version && node perf/index.js
{ 'ngraph.forcelayout3d': '0.0.13',
npm: '2.14.2',
{ 'ngraph.forcelayout3d': '0.0.15',
npm: '3.10.10',
ares: '1.10.1-DEV',
http_parser: '2.5.0',
modules: '46',
node: '4.0.0',
openssl: '1.0.2d',
uv: '1.7.3',
v8: '4.5.103.30',
cldr: '30.0.2',
http_parser: '2.7.0',
icu: '58.1',
modules: '51',
node: '7.2.1',
openssl: '1.0.2j',
tz: '2016g',
unicode: '9.0',
uv: '1.10.1',
v8: '5.4.500.44',
zlib: '1.2.8' }
Run default x 25.16 ops/sec ±2.97% (46 runs sampled)
Mostly fixed nodes x 50.24 ops/sec ±18.66% (25 runs sampled)
Run default x 38.82 ops/sec ±2.91% (52 runs sampled)
Mostly fixed nodes x 187 ops/sec ±3.43% (68 runs sampled)
Fastest is Mostly fixed nodes

@@ -120,2 +120,18 @@ Force Directed layout in 3D

### Configuring integrator
If you find standard Euler integration producing too much errors and jitter,
consider using verlet integration:
``` js
var physicsSettings = {integrator: 'verlet'};
// pass it as second argument to layout:
var layout = require('ngraph.forcelayout3d')(graph, physicsSettings);
```
Kudos to @annxingyuan for the [PR](https://github.com/anvaka/ngraph.forcelayout3d/pull/1).
## Space occupied by graph

@@ -122,0 +138,0 @@

@@ -74,2 +74,31 @@ var test = require('tap').test,

test('layout can use verlet integrator', function (t) {
var graph = createGraph();
graph.addLink(1, 2);
var layout = createLayout(graph, {
integrator: 'verlet'
});
// perform one iteration of layout:
layout.step();
graph.forEachNode(function (node) {
var pos = layout.getNodePosition(node.id);
t.ok(pos && typeof pos.x === 'number' &&
typeof pos.y === 'number' &&
typeof pos.z === 'number', 'Position is defined');
});
graph.forEachLink(function (link) {
var linkPos = layout.getLinkPosition(link.id);
t.ok(linkPos && linkPos.from && linkPos.to, 'Link position is defined');
var fromPos = layout.getNodePosition(link.fromId);
t.ok(linkPos.from === fromPos, '"From" should be identical to getNodePosition');
var toPos = layout.getNodePosition(link.toId);
t.ok(linkPos.to === toPos, '"To" should be identical to getNodePosition');
});
t.end();
});
test('Layout can set node position', function (t) {

@@ -76,0 +105,0 @@ var graph = createGraph();

Sorry, the diff of this file is too big to display

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