Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-force

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-force - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

8

build/d3-force.js

@@ -1,6 +0,6 @@

// https://d3js.org/d3-force/ Version 1.0.4. Copyright 2016 Mike Bostock.
// https://d3js.org/d3-force/ Version 1.0.5. Copyright 2017 Mike Bostock.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-quadtree'), require('d3-collection'), require('d3-dispatch'), require('d3-timer')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-quadtree', 'd3-collection', 'd3-dispatch', 'd3-timer'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-quadtree'), require('d3-collection'), require('d3-dispatch'), require('d3-timer')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-quadtree', 'd3-collection', 'd3-dispatch', 'd3-timer'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3));
}(this, (function (exports,d3Quadtree,d3Collection,d3Dispatch,d3Timer) { 'use strict';

@@ -7,0 +7,0 @@

@@ -1,2 +0,2 @@

// https://d3js.org/d3-force/ Version 1.0.4. Copyright 2016 Mike Bostock.
// https://d3js.org/d3-force/ Version 1.0.5. Copyright 2017 Mike Bostock.
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-quadtree"),require("d3-collection"),require("d3-dispatch"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-quadtree","d3-collection","d3-dispatch","d3-timer"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,e,r,i){"use strict";function u(n){return n.x+n.vx}function o(n){return n.y+n.vy}function f(n){return n.index}function a(n,t){var e=n.get(t);if(!e)throw new Error("missing: "+t);return e}function c(n){return n.x}function l(n){return n.y}var h=function(n,t){function e(){var e,i,u=r.length,o=0,f=0;for(e=0;e<u;++e)i=r[e],o+=i.x,f+=i.y;for(o=o/u-n,f=f/u-t,e=0;e<u;++e)i=r[e],i.x-=o,i.y-=f}var r;return null==n&&(n=0),null==t&&(t=0),e.initialize=function(n){r=n},e.x=function(t){return arguments.length?(n=+t,e):n},e.y=function(n){return arguments.length?(t=+n,e):t},e},v=function(n){return function(){return n}},d=function(){return 1e-6*(Math.random()-.5)},y=function(n){function e(){function n(n,t,e,r,i){var u=n.data,o=n.r,f=x+o;{if(!u)return t>v+f||r<v-f||e>y+f||i<y-f;if(u.index>h.index){var a=v-u.x-u.vx,l=y-u.y-u.vy,s=a*a+l*l;s<f*f&&(0===a&&(a=d(),s+=a*a),0===l&&(l=d(),s+=l*l),s=(f-(s=Math.sqrt(s)))/s*c,h.vx+=(a*=s)*(f=(o*=o)/(g+o)),h.vy+=(l*=s)*f,u.vx-=a*(f=1-f),u.vy-=l*f)}}}for(var e,i,h,v,y,x,g,s=f.length,p=0;p<l;++p)for(i=t.quadtree(f,u,o).visitAfter(r),e=0;e<s;++e)h=f[e],x=a[h.index],g=x*x,v=h.x+h.vx,y=h.y+h.vy,i.visit(n)}function r(n){if(n.data)return n.r=a[n.data.index];for(var t=n.r=0;t<4;++t)n[t]&&n[t].r>n.r&&(n.r=n[t].r)}function i(){if(f){var t,e,r=f.length;for(a=new Array(r),t=0;t<r;++t)e=f[t],a[e.index]=+n(e,t,f)}}var f,a,c=1,l=1;return"function"!=typeof n&&(n=v(null==n?1:+n)),e.initialize=function(n){f=n,i()},e.iterations=function(n){return arguments.length?(l=+n,e):l},e.strength=function(n){return arguments.length?(c=+n,e):c},e.radius=function(t){return arguments.length?(n="function"==typeof t?t:v(+t),i(),e):n},e},x=function(n){function t(n){return 1/Math.min(y[n.source.index],y[n.target.index])}function r(t){for(var e=0,r=n.length;e<M;++e)for(var i,u,o,f,a,h,v,y=0;y<r;++y)i=n[y],u=i.source,o=i.target,f=o.x+o.vx-u.x-u.vx||d(),a=o.y+o.vy-u.y-u.vy||d(),h=Math.sqrt(f*f+a*a),h=(h-l[y])/h*t*c[y],f*=h,a*=h,o.vx-=f*(v=x[y]),o.vy-=a*v,u.vx+=f*(v=1-v),u.vy+=a*v}function i(){if(h){var t,r,i=h.length,f=n.length,v=e.map(h,g);for(t=0,y=new Array(i);t<f;++t)r=n[t],r.index=t,"object"!=typeof r.source&&(r.source=a(v,r.source)),"object"!=typeof r.target&&(r.target=a(v,r.target)),y[r.source.index]=(y[r.source.index]||0)+1,y[r.target.index]=(y[r.target.index]||0)+1;for(t=0,x=new Array(f);t<f;++t)r=n[t],x[t]=y[r.source.index]/(y[r.source.index]+y[r.target.index]);c=new Array(f),u(),l=new Array(f),o()}}function u(){if(h)for(var t=0,e=n.length;t<e;++t)c[t]=+s(n[t],t,n)}function o(){if(h)for(var t=0,e=n.length;t<e;++t)l[t]=+p(n[t],t,n)}var c,l,h,y,x,g=f,s=t,p=v(30),M=1;return null==n&&(n=[]),r.initialize=function(n){h=n,i()},r.links=function(t){return arguments.length?(n=t,i(),r):n},r.id=function(n){return arguments.length?(g=n,r):g},r.iterations=function(n){return arguments.length?(M=+n,r):M},r.strength=function(n){return arguments.length?(s="function"==typeof n?n:v(+n),u(),r):s},r.distance=function(n){return arguments.length?(p="function"==typeof n?n:v(+n),o(),r):p},r},g=10,s=Math.PI*(3-Math.sqrt(5)),p=function(n){function t(){u(),p.call("tick",a),c<l&&(x.stop(),p.call("end",a))}function u(){var t,e,r=n.length;for(c+=(v-c)*h,y.each(function(n){n(c)}),t=0;t<r;++t)e=n[t],null==e.fx?e.x+=e.vx*=d:(e.x=e.fx,e.vx=0),null==e.fy?e.y+=e.vy*=d:(e.y=e.fy,e.vy=0)}function o(){for(var t,e=0,r=n.length;e<r;++e){if(t=n[e],t.index=e,isNaN(t.x)||isNaN(t.y)){var i=g*Math.sqrt(e),u=e*s;t.x=i*Math.cos(u),t.y=i*Math.sin(u)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function f(t){return t.initialize&&t.initialize(n),t}var a,c=1,l=.001,h=1-Math.pow(l,1/300),v=0,d=.6,y=e.map(),x=i.timer(t),p=r.dispatch("tick","end");return null==n&&(n=[]),o(),a={tick:u,restart:function(){return x.restart(t),a},stop:function(){return x.stop(),a},nodes:function(t){return arguments.length?(n=t,o(),y.each(f),a):n},alpha:function(n){return arguments.length?(c=+n,a):c},alphaMin:function(n){return arguments.length?(l=+n,a):l},alphaDecay:function(n){return arguments.length?(h=+n,a):+h},alphaTarget:function(n){return arguments.length?(v=+n,a):v},velocityDecay:function(n){return arguments.length?(d=1-n,a):1-d},force:function(n,t){return arguments.length>1?(null==t?y.remove(n):y.set(n,f(t)),a):y.get(n)},find:function(t,e,r){var i,u,o,f,a,c=0,l=n.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)f=n[c],i=t-f.x,u=e-f.y,o=i*i+u*u,o<r&&(a=f,r=o);return a},on:function(n,t){return arguments.length>1?(p.on(n,t),a):p.on(n)}}},M=function(){function n(n){var e,a=u.length,h=t.quadtree(u,c,l).visitAfter(r);for(f=n,e=0;e<a;++e)o=u[e],h.visit(i)}function e(){if(u){var n,t,e=u.length;for(a=new Array(e),n=0;n<e;++n)t=u[n],a[t.index]=+h(t,n,u)}}function r(n){var t,e,r,i,u,o=0;if(n.length){for(r=i=u=0;u<4;++u)(t=n[u])&&(e=t.value)&&(o+=e,r+=e*t.x,i+=e*t.y);n.x=r/o,n.y=i/o}else{t=n,t.x=t.data.x,t.y=t.data.y;do o+=a[t.data.index];while(t=t.next)}n.value=o}function i(n,t,e,r){if(!n.value)return!0;var i=n.x-o.x,u=n.y-o.y,c=r-t,l=i*i+u*u;if(c*c/g<l)return l<x&&(0===i&&(i=d(),l+=i*i),0===u&&(u=d(),l+=u*u),l<y&&(l=Math.sqrt(y*l)),o.vx+=i*n.value*f/l,o.vy+=u*n.value*f/l),!0;if(!(n.length||l>=x)){(n.data!==o||n.next)&&(0===i&&(i=d(),l+=i*i),0===u&&(u=d(),l+=u*u),l<y&&(l=Math.sqrt(y*l)));do n.data!==o&&(c=a[n.data.index]*f/l,o.vx+=i*c,o.vy+=u*c);while(n=n.next)}}var u,o,f,a,h=v(-30),y=1,x=1/0,g=.81;return n.initialize=function(n){u=n,e()},n.strength=function(t){return arguments.length?(h="function"==typeof t?t:v(+t),e(),n):h},n.distanceMin=function(t){return arguments.length?(y=t*t,n):Math.sqrt(y)},n.distanceMax=function(t){return arguments.length?(x=t*t,n):Math.sqrt(x)},n.theta=function(t){return arguments.length?(g=t*t,n):Math.sqrt(g)},n},q=function(n){function t(n){for(var t,e=0,o=r.length;e<o;++e)t=r[e],t.vx+=(u[e]-t.x)*i[e]*n}function e(){if(r){var t,e=r.length;for(i=new Array(e),u=new Array(e),t=0;t<e;++t)i[t]=isNaN(u[t]=+n(r[t],t,r))?0:+o(r[t],t,r)}}var r,i,u,o=v(.1);return"function"!=typeof n&&(n=v(null==n?0:+n)),t.initialize=function(n){r=n,e()},t.strength=function(n){return arguments.length?(o="function"==typeof n?n:v(+n),e(),t):o},t.x=function(r){return arguments.length?(n="function"==typeof r?r:v(+r),e(),t):n},t},w=function(n){function t(n){for(var t,e=0,o=r.length;e<o;++e)t=r[e],t.vy+=(u[e]-t.y)*i[e]*n}function e(){if(r){var t,e=r.length;for(i=new Array(e),u=new Array(e),t=0;t<e;++t)i[t]=isNaN(u[t]=+n(r[t],t,r))?0:+o(r[t],t,r)}}var r,i,u,o=v(.1);return"function"!=typeof n&&(n=v(null==n?0:+n)),t.initialize=function(n){r=n,e()},t.strength=function(n){return arguments.length?(o="function"==typeof n?n:v(+n),e(),t):o},t.y=function(r){return arguments.length?(n="function"==typeof r?r:v(+r),e(),t):n},t};n.forceCenter=h,n.forceCollide=y,n.forceLink=x,n.forceManyBody=M,n.forceSimulation=p,n.forceX=q,n.forceY=w,Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "d3-force",
"version": "1.0.4",
"version": "1.0.5",
"description": "Force-directed graph layout using velocity Verlet integration.",

@@ -32,3 +32,3 @@ "keywords": [

"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-force.js -c -m -o build/d3-force.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-force/build/d3-force.js d3-force.v1.js && cp ../d3-force/build/d3-force.min.js d3-force.v1.min.js && git add d3-force.v1.js d3-force.v1.min.js && git commit -m \"d3-force ${VERSION}\" && git push && cd - && zip -j build/d3-force.zip -- LICENSE README.md build/d3-force.js build/d3-force.min.js"
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-force/build/d3-force.js d3-force.v1.js && cp ../d3-force/build/d3-force.min.js d3-force.v1.min.js && git add d3-force.v1.js d3-force.v1.min.js && git commit -m \"d3-force ${npm_package_version}\" && git push && cd - && zip -j build/d3-force.zip -- LICENSE README.md build/d3-force.js build/d3-force.min.js"
},

@@ -44,3 +44,3 @@ "dependencies": {

"package-preamble": "0.0",
"rollup": "0.36",
"rollup": "0.41",
"tape": "4",

@@ -47,0 +47,0 @@ "uglify-js": "2"

@@ -60,2 +60,4 @@ # d3-force

This method can be used in conjunction with [*simulation*.stop](#simulation_stop) to compute a [static force layout](https://bl.ocks.org/mbostock/1667139). For large graphs, static layouts should be computed [in a web worker](https://bl.ocks.org/mbostock/01ab2e85e8727d6529d20391c0fd9a16) to avoid freezing the user interface.
<a name="simulation_nodes" href="#simulation_nodes">#</a> <i>simulation</i>.<b>nodes</b>([<i>nodes</i>]) [<>](https://github.com/d3/d3-force/blob/master/src/simulation.js#L88 "Source")

@@ -62,0 +64,0 @@

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