iwmlib/pixi/lib/graphology-layout-forceatlas2.min.js

1 line
8.6 KiB
JavaScript
Raw Normal View History

2019-03-21 09:57:27 +01:00
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.forceAtlas2=e():t.forceAtlas2=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(n){if(o[n])return o[n].exports;var a=o[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var o={};return e.m=t,e.c=o,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,o){function n(t,e,o){if(!r(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof o&&(o={iterations:o});var n=o.iterations;if("number"!=typeof n)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(n<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var a=s.assign({},u,o.settings),l=s.validateSettings(a);if(l)throw new Error("graphology-layout-forceatlas2: "+l.message);var g,f=s.graphToByteArrays(e);for(g=0;g<n;g++)i(a,f.nodes,f.edges);return t?void s.applyLayoutChanges(e,f.nodes):s.collectLayoutChanges(e,f.nodes)}function a(t){var e=t.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}}var r=o(1),i=o(2),s=o(3),u=o(4),l=n.bind(null,!1);l.assign=n.bind(null,!0),l.inferSettings=a,t.exports=l},function(t,e){t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNodes&&"boolean"==typeof t.multi}},function(t,e){t.exports=function(t,e,o){var n,a,r,i,s,u,l,g,f,h,d,b,c,p,y,M=e.length,w=o.length,m=[];for(r=0;r<M;r+=10)e[r+4]=e[r+2],e[r+5]=e[r+3],e[r+2]=0,e[r+3]=0;if(t.outboundAttractionDistribution){for(f=0,r=0;r<M;r+=10)f+=e[r+6];f/=M}if(t.barnesHutOptimize){var v,A,D,x=1/0,z=-1/0,j=1/0,q=-1/0;for(r=0;r<M;r+=10)x=Math.min(x,e[r+0]),z=Math.max(z,e[r+0]),j=Math.min(j,e[r+1]),q=Math.max(q,e[r+1]);var H=z-x,S=q-j;for(H>S?(j-=(H-S)/2,q=j+H):(x-=(S-H)/2,z=x+S),m[0]=-1,m[1]=(x+z)/2,m[2]=(j+q)/2,m[3]=Math.max(z-x,q-j),m[4]=-1,m[5]=-1,m[6]=0,m[7]=0,m[8]=0,n=1,r=0;r<M;r+=10)for(a=0,D=3;;){if(!(m[a+5]>=0)){if(m[a+0]<0){m[a+0]=r;break}if(m[a+5]=9*n,l=m[a+3]/2,g=m[a+5],m[g+0]=-1,m[g+1]=m[a+1]-l,m[g+2]=m[a+2]-l,m[g+3]=l,m[g+4]=g+9,m[g+5]=-1,m[g+6]=0,m[g+7]=0,m[g+8]=0,g+=9,m[g+0]=-1,m[g+1]=m[a+1]-l,m[g+2]=m[a+2]+l,m[g+3]=l,m[g+4]=g+9,m[g+5]=-1,m[g+6]=0,m[g+7]=0,m[g+8]=0,g+=9,m[g+0]=-1,m[g+1]=m[a+1]+l,m[g+2]=m[a+2]-l,m[g+3]=l,m[g+4]=g+9,m[g+5]=-1,m[g+6]=0,m[g+7]=0,m[g+8]=0,g+=9,m[g+0]=-1,m[g+1]=m[a+1]+l,m[g+2]=m[a+2]+l,m[g+3]=l,m[g+4]=m[a+4],m[g+5]=-1,m[g+6]=0,m[g+7]=0,m[g+8]=0,n+=4,v=e[m[a+0]+0]<m[a+1]?e[m[a+0]+1]<m[a+2]?m[a+5]:m[a+5]+9:e[m[a+0]+1]<m[a+2]?m[a+5]+18:m[a+5]+27,m[a+6]=e[m[a+0]+6],m[a+7]=e[m[a+0]+0],m[a+8]=e[m[a+0]+1],m[v+0]=m[a+0],m[a+0]=-1,A=e[r+0]<m[a+1]?e[r+1]<m[a+2]?m[a+5]:m[a+5]+9:e[r+1]<m[a+2]?m[a+5]+18:m[a+5]+27,v===A){if(D--){a=v;continue}D=3;break}m[A+0]=r;break}v=e[r+0]<m[a+1]?e[r+1]<m[a+2]?m[a+5]:m[a+5]+9:e[r+1]<m[a+2]?m[a+5]+18:m[a+5]+27,m[a+7]=(m[a+7]*m[a+6]+e[r+0]*e[r+6])/(m[a+6]+e[r+6]),m[a+8]=(m[a+8]*m[a+6]+e[r+1]*e[r+6])/(m[a+6]+e[r+6]),m[a+6]+=e[r+6],a=v}}if(t.barnesHutOptimize)for(h=t.scalingRatio,r=0;r<M;r+=10)for(a=0;;)if(m[a+5]>=0){if(p=Math.sqrt(Math.pow(e[r+0]-m[a+7],2)+Math.pow(e[r+1]-m[a+8],2)),2*m[a+3]/p<t.barnesHutTheta){if(d=e[r+0]-m[a+7],b=e[r+1]-m[a+8],t.adjustSizes?p>0?(y=h*e[r+6]*m[a+6]/p/p,e[r+2]+=d*y,e[r+3]+=b*y):p<0&&(y=-h*e[r+6]*m[a+6]/p,e[r+2]+=d*y,e[r+3]+=b*y):p>0&&(y=h*e[r+6]*m[a+6]/p/p,e[r+2]+=d*y,e[r+3]+=b*y),m[a+4]<0)break;a=m[a+4];continue}a=m[a+5]}else{if(m[a+0]>=0&&m[a+0]!==r&&(d=e[r+0]-e[m[a+0]+0],b=e[r+1]-e[m[a+0]+1],p=Math.sqrt(d*d+b*b),t.adjustSizes?p>0?(y=h*e[r+6]*e[m[a+0]+6]/p/p,e[r+2]+=d*y,e[r+3]+=b*y):p<0&&(y=-h*e[r+6]*e[m[a+0]+6]/p,e[r+2]+=d*y,e[r+3]+=b*y):p>0&&(y=h*e[r+6]