(function(global, factory) { function extractNS(){ var g = {}; return factory.call(g, global),g.jsnx;} if(typeof define === 'function' && define.amd){ /*AMD*/ define(extractNS); } else if (typeof module !== 'undefined' && module.exports){ /*node*/ module.exports = extractNS(); } else { factory.call(global, global); } }(this, function(window) {function h(a){throw a;}var aa=void 0,k=!0,l=null,n=!1;function ba(a){return function(){return a}}var p,ca=this;function ea(){} function q(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function s(a){return a!==aa}function ga(a){return"array"==q(a)}function t(a){var b=q(a);return"array"==b||"object"==b&&"number"==typeof a.length}function u(a){return"string"==typeof a}function v(a){return"boolean"==typeof a}function ha(a){return"number"==typeof a}function ia(a){return"function"==q(a)}function ja(a){var b=typeof a;return"object"==b&&a!=l||"function"==b}var ka="closure_uid_"+(1E9*Math.random()>>>0),la=0; function ma(a,b,c){return a.call.apply(a.bind,arguments)}function na(a,b,c){a||h(Error());if(2c?Math.max(0,a.length+c):c;if(u(a))return!u(b)||1!=b.length?-1:a.indexOf(b,c);for(;c=arguments.length?ra.slice.call(a,b):ra.slice.call(a,b,c)}function Ia(a,b,c){if(!t(a)||!t(b)||a.length!=b.length)return n;var d=a.length;c=c||Ja;for(var e=0;eb?1:a=f.length)return b;d.push(f[c])}b.push(d)}}function Na(a){for(var b=Math.random,c=a.length-1;0=a.length&&h(z);if(b in a)return a[b++];b++}};return c}h(Error("Not implemented"))}function D(a,b,c){if(t(a))try{x(a,b,c)}catch(d){d!==z&&h(d)}else{a=C(a);try{for(;;)b.call(c,a.next(),aa,a)}catch(e){e!==z&&h(e)}}} function E(a,b,c){var d=C(a);a=new B;a.next=function(){for(;;){var a=d.next();return b.call(c,a,aa,d)}};return a}function Oa(a,b){var c=0;D(a,function(a){c=b.call(aa,c,a)});return c}function Pa(a){var b=arguments,c=b.length,d=0,e=new B;e.next=function(){try{return d>=c&&h(z),C(b[d]).next()}catch(a){return(a!==z||d>=c)&&h(a),d++,this.next()}};return e}function Qa(a){if(t(a))return Da(a);a=C(a);var b=[];D(a,function(a){b.push(a)});return b} function Ra(a,b){try{return C(a).next()}catch(c){return c!=z&&h(c),b}};function Va(){}Va.ua=function(){return Va.wa?Va.wa:Va.wa=new Va};Va.prototype.Qa=0;Va.ua();function Wa(a){if(!t(a))return n;for(var b=0,c=a.length;bc,f=a,g;d.next=function(){(e&&f<=b||!e&&f>=b)&&h(z);g=f;f+=c;return g};return d} function Fb(a){var b=R(a),c=b.length;if(2>c)return new B;var d=R(S(2));a=new B;a.next=function(){var a=va(d,function(a){return b[a]});this.next=function(){var a=n,e;for(e=2;e--;)if(d[e]!=e+c-2){a=k;break}a||h(z);d[e]+=1;for(a=e+1;2>a;a++)d[a]=d[a-1]+1;return va(d,function(a){return b[a]})};return a};return a} function Gb(a){var b=R(a),c=b.length,d=ha(2)?2:c;if(d>c)return new B;var e=R(S(c)),f=R(S(c,c-d,-1));a=new B;var g=new B,m,r=k;a.next=function(){this.next=m.next;return va(e.slice(0,d),function(a){return b[a]})};g.next=function(){return r};m=T(g,function(a){a||h(z);r=n;return S(d-1,-1,-1)},function(a){if(!r)if(f[a]-=1,0===f[a])e.splice.apply(e,[a,e.length].concat(e.slice(a+1).concat([e[a]]))),f[a]=c-a;else{var g=f[a],m=e[a];e[a]=e[e.length-g];e[e.length-g]=m;r=k;return Cb([va(e.slice(0,d),function(a){return b[a]})])}}, function(a){return a});return a}function Hb(a,b){for(var c,d,e=1;e2*this.J&&Rb(this),k):n};function Rb(a){if(a.J!=a.h.length){for(var b=0,c=0;b=c.length&&h(z);var g=c[b++];return a?g:d[g]}};return g}; function Sb(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Tb(a){this.e=new Qb;a&&this.ma(a)}function Ub(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ka]||(a[ka]=++la)):b.substr(0,1)+a}p=Tb.prototype;p.ia=function(){return this.e.ia()};p.add=function(a){this.e.set(Ub(a),a)};p.ma=function(a){a=Pb(a);for(var b=a.length,c=0;cb?e+="000":256>b?e+="00":4096>b&&(e+="0");return ec[a]=e+b.toString(16)}),'"')};var V={hb:function(a){return Math.floor(Math.random()*a)},nb:function(a,b){return a+Math.random()*(b-a)},ab:function(a,b,c){return Math.min(Math.max(a,b),c)},Pa:function(a,b){var c=a%b;return 0>c*b?c+b:c},eb:function(a,b,c){return a+c*(b-a)},gb:function(a,b,c){return Math.abs(a-b)<=(c||1E-6)},pa:function(a){return V.Pa(a,360)},Ba:function(a){return a*Math.PI/180},Xa:function(a){return 180*a/Math.PI},Za:function(a,b){return b*Math.cos(V.Ba(a))},$a:function(a,b){return b*Math.sin(V.Ba(a))},sa:function(a, b,c,d){return V.pa(V.Xa(Math.atan2(d-b,c-a)))},Ya:function(a,b){var c=V.pa(b)-V.pa(a);180=c&&(c=360+c);return c},kb:function(a){return 0==a?0:0>a?-1:1},fb:function(a,b,c,d){c=c||function(a,b){return a==b};d=d||function(b){return a[b]};for(var e=a.length,f=b.length,g=[],m=0;mg[m][r-1]?m--:r--;return y},w:function(a){return wa(arguments,function(a,c){return a+c})},Ia:function(a){return V.w.apply(l,arguments)/arguments.length},lb:function(a){var b=arguments.length;if(2>b)return 0;var c=V.Ia.apply(l,arguments),b=V.w.apply(l,va(arguments,function(a){return Math.pow(a-c,2)}))/(b-1);return Math.sqrt(b)},cb:function(a){return isFinite(a)&&0==a%1},bb:function(a){return isFinite(a)&&!isNaN(a)},jb:function(a,b){return Math.floor(a+ (b||2E-15))},ib:function(a,b){return Math.ceil(a-(b||2E-15))}};function P(a,b){if(!(this instanceof P))return new P(a,b);this.graph={};this.node=new L;this.adj=new L;a!=l&&Vb(a,this);I(this.graph,b||{});this.edge=this.adj}w("jsnx.classes.Graph",P);w("jsnx.Graph",P);P.__name__="Graph";P.prototype.Ma=l;P.prototype.graph=P.prototype.Ma;P.prototype.Ra=l;P.prototype.node=P.prototype.Ra;P.prototype.Ga=l;P.prototype.adj=P.prototype.Ga;P.prototype.Ka=l;P.prototype.edge=P.prototype.Ka; P.prototype.name=function(a){if(s(a))this.graph.name=a.toString();else return this.graph.name||""};P.prototype.name=P.prototype.name;P.prototype.toString=function(){return this.name()};P.prototype.toString=P.prototype.toString;P.prototype.get=function(a){try{return this.adj.get(a)}catch(b){b instanceof K||h(b),h(new K("Graph does not contain node "+a+"."))}};P.prototype.get=P.prototype.get; P.prototype.N=function(a,b){b!=l||(b={});"object"!==q(b)&&h(new J("The attr_dict argument must be an object."));this.adj.a(a)?I(this.node.get(a),b):(this.adj.set(a,new L),this.node.set(a,b))};P.prototype.add_node=P.prototype.N; P.prototype.i=function(a,b){b!=l||(b={});M(a,function(a){if(ga(a)&&2===a.length&&ja(a[1])){var d=a[0];a=a[1];if(this.adj.a(d))d=this.node.get(d),I(d,b,a);else{this.adj.set(d,new L);var e=gb(b);I(e,a);this.node.set(d,e)}}else this.adj.a(a)?I(this.node.get(a),b):(this.adj.set(a,new L),this.node.set(a,gb(b)))},this)};P.prototype.add_nodes_from=P.prototype.i; P.prototype.U=function(a){var b=this.adj;try{var c=this.adj.get(a).keys();this.node.remove(a);x(c,function(c){b.get(c).remove(a)});b.remove(a)}catch(d){d instanceof K||h(d),h(new J(qa("The node %s is not in the graph",ub(a))))}};P.prototype.remove_node=P.prototype.U;P.prototype.da=function(a){var b=this.adj;M(a,function(a){try{this.node.remove(a),b.get(a).forEach(function(d){b.get(d).remove(a)}),b.remove(a)}catch(d){d instanceof K||h(d)}},this)};P.prototype.remove_nodes_from=P.prototype.da; P.prototype.C=function(a){return a?C(this.node):C(this.adj.keys())};P.prototype.nodes_iter=P.prototype.C;P.prototype.nodes=function(a){return a?this.node.Z():this.node.keys()};P.prototype.nodes=P.prototype.nodes;P.prototype.S=function(){return this.adj.count()};P.prototype.number_of_nodes=P.prototype.S;P.prototype.K=function(){return this.adj.count()};P.prototype.order=P.prototype.K;P.prototype.o=function(a){try{return this.adj.a(a)}catch(b){if(b instanceof TypeError)return n;h(b)}}; P.prototype.has_node=P.prototype.o;P.prototype.b=function(a,b,c){c=c||{};"object"!==q(c)&&h(new J("The attr_dict argument must be an object."));this.adj.a(a)||(this.adj.set(a,new L),this.node.set(a,{}));this.adj.a(b)||(this.adj.set(b,new L),this.node.set(b,{}));var d=this.adj.get(a).get(b,{});I(d,c);this.adj.get(a).set(b,d);this.adj.get(b).set(a,d)};P.prototype.add_edge=P.prototype.b; P.prototype.d=function(a,b){b=b||{};"object"!==q(b)&&h(new J("The attr_dict argument must be an object."));M(a,function(a){var d=Ab(a),e,f,g;3===d?(e=a[0],f=a[1],g=a[2]):2===d?(e=a[0],f=a[1],g={}):h(new J(qa("Edge tuple %s must be a 2-tuple or 3-tuple.",ub(a))));this.adj.a(e)||(this.adj.set(e,new L),this.node.set(e,{}));this.adj.a(f)||(this.adj.set(f,new L),this.node.set(f,{}));a=this.adj.get(e).get(f,{});I(a,b,g);this.adj.get(e).set(f,a);this.adj.get(f).set(e,a)},this)}; P.prototype.add_edges_from=P.prototype.d;P.prototype.Fa=function(a,b,c){c=c||{};u(b)||(c=b,b="weight");this.d(Q(a,function(a){var c={};c[b]=a[2];s(c[b])||h(new TypeError("Values must consist of three elements: "+ub(a)));return[a[0],a[1],c]}),c)};P.prototype.add_weighted_edges_from=P.prototype.Fa;P.prototype.z=function(a,b){try{this.adj.get(a).remove(b),kb(a)!==kb(b)&&this.adj.get(b).remove(a)}catch(c){c instanceof K&&h(new J(qa("The edge %s-%s is not in the graph",ub(a),ub(b)))),h(c)}}; P.prototype.remove_edge=P.prototype.z;P.prototype.L=function(a){M(a,function(a){var c=a[0];a=a[1];this.adj.a(c)&&this.adj.get(c).a(a)&&(this.adj.get(c).remove(a),kb(c)!==kb(a)&&this.adj.get(a).remove(c))},this)};P.prototype.remove_edges_from=P.prototype.L;P.prototype.T=function(a,b){return this.adj.a(a)&&this.adj.get(a).a(b)};P.prototype.has_edge=P.prototype.T; P.prototype.B=function(a){try{return this.adj.get(a).keys()}catch(b){b instanceof K&&h(new J(qa("The node %s is not in the graph.",ub(a)))),h(b)}};P.prototype.neighbors=P.prototype.B;P.prototype.ba=function(a){try{return C(this.adj.get(a).keys())}catch(b){b instanceof K&&h(new J(qa("The node %s is not in the graph.",ub(a)))),h(b)}};P.prototype.neighbors_iter=P.prototype.ba;P.prototype.v=function(a,b){return Qa(this.g(a,b))};P.prototype.edges=P.prototype.v; P.prototype.g=function(a,b){v(a)&&(b=a,a=l);var c=new L,d,e;d=a!=l?E(this.f(a),function(a){return[a,this.adj.get(a)]},this):C(this.adj);return b?T(d,function(a){e=a[0];var b=new B,d=C(a[1]);b.next=function(){try{return d.next()}catch(a){a===z&&c.set(e,1),h(a)}};return b},function(a){if(!c.a(a[0]))return[e,a[0],a[1]]}):T(d,function(a){e=a[0];var b=new B,d=C(a[1]);b.next=function(){try{return d.next()}catch(a){a===z&&c.set(e,1),h(a)}};return b},function(a){if(!c.a(a[0]))return[e,a[0]]})}; P.prototype.edges_iter=P.prototype.g;P.prototype.W=function(a,b,c){try{return this.adj.get(a).get(b)}catch(d){if(d instanceof K)return c;h(d)}};P.prototype.get_edge_data=P.prototype.W;P.prototype.Ha=function(){return Qa(E(this.p(),function(a){return a[1].keys()}))};P.prototype.adjacency_list=P.prototype.Ha;P.prototype.p=function(){return C(this.adj)};P.prototype.adjacency_iter=P.prototype.p;P.prototype.t=function(a,b){return a!=l&&this.o(a)?this.u(a,b).next()[1]:new L(this.u(a,b))}; P.prototype.degree=P.prototype.t;P.prototype.u=function(a,b){var c;c=a!=l?E(this.f(a),function(a){return[a,this.adj.get(a)]},this):C(this.adj);return b?E(c,function(a){var c=a[0],f=a[1],g=0;f.forEach(function(a,c){g+=+H(c,b,1)});g+=+(f.a(c)&&H(f.get(c),b,1));a[1]=g;return a}):E(c,function(a){a[1]=a[1].count()+ +a[1].a(a[0]);return a})};P.prototype.degree_iter=P.prototype.u;P.prototype.clear=function(){this.name("");this.adj.clear();this.node.clear();eb(this.graph)};P.prototype.clear=P.prototype.clear; P.prototype.copy=function(){return vb(this)};P.prototype.copy=P.prototype.copy;P.prototype.m=ba(n);P.prototype.is_multigraph=P.prototype.m;P.prototype.c=ba(n);P.prototype.is_directed=P.prototype.c;P.prototype.M=function(){var a=new Y;a.name(this.name());a.i(this);a.d(function(){var a;return T(this.p(),function(c){a=c[0];return C(c[1])},function(c){c[2]=U(c[1]);c[1]=c[0];c[0]=a;return c})}.call(this));a.graph=U(this.graph);a.node=U(this.node);return a};P.prototype.to_directed=P.prototype.M; P.prototype.V=function(){return vb(this)};P.prototype.to_undirected=P.prototype.V;P.prototype.H=function(a){a=this.f(a);var b=new this.constructor,c=b.adj,d=this.adj;D(a,function(a){var b=new L;c.set(a,b);d.get(a).forEach(function(d,m){c.a(d)&&(b.set(d,m),c.get(d).set(a,m))})});M(b,function(a){b.node.set(a,this.node.get(a))},this);b.graph=this.graph;return b};P.prototype.subgraph=P.prototype.H;P.prototype.Sa=function(){return va(ta(this.adj.Z(),function(a){return a[1].a(a[0])}),function(a){return a[0]})}; P.prototype.nodes_with_selfloops=P.prototype.Sa;P.prototype.ea=function(a){return a?va(ta(this.adj.Z(),function(a){return a[1].a(a[0])}),function(a){a[2]=a[1].get(a[0]);a[1]=a[0];return a}):va(ta(this.adj.Z(),function(a){return a[1].a(a[0])}),function(a){a[1]=a[0];return a})};P.prototype.selfloop_edges=P.prototype.ea;P.prototype.Ta=function(){return this.ea().length};P.prototype.number_of_selfloops=P.prototype.Ta;P.prototype.size=function(a){var b=V.w.apply(l,this.t(l,a).n())/2;return a!=l?b:Math.floor(b)}; P.prototype.size=P.prototype.size;P.prototype.R=function(a,b){return a==l?Math.floor(this.size()):this.adj.get(a).a(b)?1:0};P.prototype.number_of_edges=P.prototype.R;P.prototype.Ea=function(a,b){var c=R(a),d=c[0],c=E(Fa(c,1),function(a){return[d,a]});this.d(c,b)};P.prototype.add_star=P.prototype.Ea;P.prototype.Da=function(a,b){var c=R(a),c=Ma(Fa(c,0,c.length-1),Fa(c,1));this.d(c,b)};P.prototype.add_path=P.prototype.Da;P.prototype.Ca=function(a,b){var c=R(a),c=Ma(c,Ca(Fa(c,1),[c[0]]));this.d(c,b)}; P.prototype.add_cycle=P.prototype.Ca;P.prototype.f=function(a){return a!=l?this.o(a)?C([a]):function(a,c){var d=new B,e=T(a,function(a){if(c.a(a))return a});d.next=function(){try{return e.next()}catch(a){a instanceof TypeError&&h(new J("nbunch is not a node or a sequence of nodes")),h(a)}};return d}(a,this.adj):C(this.adj.keys())};P.prototype.nbunch_iter=P.prototype.f;function Y(a,b){if(!(this instanceof Y))return new Y(a,b);this.graph={};this.node=new L;this.adj=new L;this.pred=new L;this.succ=this.adj;a!=l&&Vb(a,this);I(this.graph,b||{});this.edge=this.adj}w("jsnx.classes.DiGraph",Y);w("jsnx.DiGraph",Y);pa(Y,P);Y.__name__="DiGraph";Y.prototype.Ua=l;Y.prototype.pred=Y.prototype.Ua;Y.prototype.Wa=l;Y.prototype.succ=Y.prototype.Wa; Y.prototype.N=function(a,b){b!=l||(b={});"object"!==q(b)&&h(new J("The attr_dict argument must be an object."));this.succ.a(a)?I(this.node.get(a),b):(this.succ.set(a,new L),this.pred.set(a,new L),this.node.set(a,b))};Y.prototype.add_node=Y.prototype.N; Y.prototype.i=function(a,b){var c,d,e,f,g;b!=l||(b={});M(Cb(a),function(a){c=!this.succ.a(a);ga(a)&&2===a.length&&ja(a[1])?(d=a[0],e=a[1],this.succ.a(d)?(g=this.node.get(d),I(g,b,e)):(this.succ.set(d,new L),this.pred.set(d,new L),f=gb(b),I(f,e),this.node.set(d,f))):c?(this.succ.set(a,new L),this.pred.set(a,new L),this.node.set(a,gb(b))):I(this.node.get(a),b)},this)};Y.prototype.add_nodes_from=Y.prototype.i; Y.prototype.U=function(a){var b;try{b=this.succ.get(a),this.node.remove(a)}catch(c){c instanceof K||h(c),h(new J(qa("The node %s is not in the graph",ub(a))))}b.forEach(function(b){this.pred.get(b).remove(a)},this);this.succ.remove(a);this.pred.get(a).forEach(function(b){this.succ.get(b).remove(a)},this);this.pred.remove(a)};Y.prototype.remove_node=Y.prototype.U; Y.prototype.da=function(a){var b;M(a,function(a){this.succ.a(a)&&(b=this.succ.get(a),this.node.remove(a),b.forEach(function(b){this.pred.get(b).remove(a)},this),this.succ.remove(a),this.pred.get(a).forEach(function(b){this.succ.get(b).remove(a)},this),this.pred.remove(a))},this)};Y.prototype.remove_nodes_from=Y.prototype.da; Y.prototype.b=function(a,b,c){c=c||{};"object"!==q(c)&&h(new J("The attr_dict argument must be an object."));this.succ.a(a)||(this.succ.set(a,new L),this.pred.set(a,new L),this.node.set(a,{}));this.succ.a(b)||(this.succ.set(b,new L),this.pred.set(b,new L),this.node.set(b,{}));var d=this.adj.get(a).get(b,{});I(d,c);this.succ.get(a).set(b,d);this.pred.get(b).set(a,d)};Y.prototype.add_edge=Y.prototype.b; Y.prototype.d=function(a,b){b=b||{};"object"!==q(b)&&h(new J("The attr_dict argument must be an object."));M(a,function(a){var d=Ab(a),e,f,g;3===d?(e=a[0],f=a[1],g=a[2]):2===d?(e=a[0],f=a[1],g={}):h(new J("Edge tuple "+a.toString()+" must be a 2-tuple or 3-tuple."));this.succ.a(e)||(this.succ.set(e,new L),this.pred.set(e,new L),this.node.set(e,{}));this.succ.a(f)||(this.succ.set(f,new L),this.pred.set(f,new L),this.node.set(f,{}));a=this.adj.get(e).get(f,{});I(a,b,g);this.succ.get(e).set(f,a);this.pred.get(f).set(e, a)},this)};Y.prototype.add_edges_from=Y.prototype.d;Y.prototype.z=function(a,b){try{this.succ.get(a).remove(b),this.pred.get(b).remove(a)}catch(c){c instanceof TypeError&&h(new J(qa("The edge %s-%s is not in the graph",ub(a),ub(b)))),h(c)}};Y.prototype.remove_edge=Y.prototype.z;Y.prototype.L=function(a){M(a,function(a){var c=a[0];a=a[1];try{this.succ.get(c).remove(a),this.pred.get(a).remove(c)}catch(d){}},this)};Y.prototype.remove_edges_from=Y.prototype.L; Y.prototype.Oa=function(a,b){return this.succ.a(a)&&this.succ.get(a).a(b)};Y.prototype.has_successor=Y.prototype.Oa;Y.prototype.Na=function(a,b){return this.pred.a(a)&&this.pred.get(a).a(b)};Y.prototype.has_predecessor=Y.prototype.Na;Y.prototype.qa=function(a){try{return E(this.succ.get(a),function(a){return a[0]})}catch(b){b instanceof K||h(b),h(new J("The node "+a+" is not in the digraph."))}};Y.prototype.successors_iter=Y.prototype.qa; Y.prototype.za=function(a){try{return E(this.pred.get(a),function(a){return a[0]})}catch(b){b instanceof K||h(b),h(new J("The node "+a+" is not in the digraph."))}};Y.prototype.predecessors_iter=Y.prototype.za;Y.prototype.Aa=function(a){try{return this.succ.get(a).keys()}catch(b){b instanceof K||h(b),h(new J("The node "+a+" is not in the digraph."))}};Y.prototype.successors=Y.prototype.Aa; Y.prototype.Va=function(a){try{return this.pred.get(a).keys()}catch(b){b instanceof K||h(b),h(new J("The node "+a+" is not in the digraph."))}};Y.prototype.predecessors=Y.prototype.Va;Y.prototype.B=Y.prototype.Aa;Y.prototype.neighbors=Y.prototype.B;Y.prototype.ba=Y.prototype.qa;Y.prototype.neighbors_iter=Y.prototype.ba; Y.prototype.g=function(a,b){v(a)&&(b=a,a=l);var c,d;if(a!=l){var e=[];c=Q(this.f(a),function(a){e[0]=a;e[1]=this.adj.get(a);return e},this)}else c=this.adj;return b?T(c,function(a){d=a[0];return C(a[1])},function(a){return[d,a[0],a[1]]}):T(c,function(a){d=a[0];return C(a[1])},function(a){return[d,a[0]]})};Y.prototype.edges_iter=Y.prototype.g;Y.prototype.ka=Y.prototype.g;Y.prototype.out_edges_iter=Y.prototype.ka;Y.prototype.oa=P.prototype.v;Y.prototype.out_edges=Y.prototype.oa; Y.prototype.Q=function(a,b){v(a)&&(b=a,a=l);var c,d;if(a!=l){var e=[];c=Q(this.f(a),function(a){e[0]=a;e[1]=this.pred.get(a);return e},this)}else c=this.pred;return b?T(c,function(a){d=a[0];return C(a[1])},function(a){a[2]=a[1];a[1]=d;return a}):T(c,function(a){d=a[0];return C(a[1])},function(a){a[1]=d;return a})};Y.prototype.in_edges_iter=Y.prototype.Q;Y.prototype.Y=function(a,b){return R(this.Q(a,b))};Y.prototype.in_edges=Y.prototype.Y; Y.prototype.u=function(a,b){var c;c=a!=l?Db(E(this.f(a),function(a){return[a,this.succ.get(a)]},this),Q(this.f(a),function(a){return[a,this.pred.get(a)]},this)):Db(C(this.succ),C(this.pred));return u(b)?Q(c,function(a){var c=a[1][1],f=0;a[0][1].forEach(function(a,c){f+=+H(c,b,1)});c.forEach(function(a,c){f+=+H(c,b,1)});return[a[0][0],f]}):E(c,function(a){return[a[0][0],a[0][1].count()+a[1][1].count()]})};Y.prototype.degree_iter=Y.prototype.u; Y.prototype.X=function(a,b){var c;c=a!=l?Q(this.f(a),function(a){return[a,this.pred.get(a)]},this):this.pred;return b!=l?Q(c,function(a){var c=0;a[1].forEach(function(a,d){c+=+H(d,b,1)});a[1]=c;return a}):Q(c,function(a){a[1]=a[1].count();return a})};Y.prototype.in_degree_iter=Y.prototype.X; Y.prototype.ca=function(a,b){var c;if(a!=l){var d=[];c=Q(this.f(a),function(a){d[0]=a;d[1]=this.succ.get(a);return d},this)}else c=C(this.succ);return b!=l?Q(c,function(a){var c=0;a[1].forEach(function(a,d){c+=+H(d,b,1)});return[a[0],c]}):Q(c,function(a){return[a[0],a[1].count()]})};Y.prototype.out_degree_iter=Y.prototype.ca;Y.prototype.va=function(a,b){return a!=l&&this.o(a)?this.X(a,b).next()[1]:new L(this.X(a,b))};Y.prototype.in_degree=Y.prototype.va; Y.prototype.ya=function(a,b){return a!=l&&this.o(a)?this.ca(a,b).next()[1]:new L(this.ca(a,b))};Y.prototype.out_degree=Y.prototype.ya;Y.prototype.clear=function(){this.succ.clear();this.pred.clear();this.node.clear();eb(this.graph)};Y.prototype.clear=Y.prototype.clear;Y.prototype.m=ba(n);Y.prototype.is_multigraph=Y.prototype.m;Y.prototype.c=ba(k);Y.prototype.is_directed=Y.prototype.c;Y.prototype.M=function(){return vb(this)};Y.prototype.to_directed=Y.prototype.M; Y.prototype.V=function(a){var b=new P;b.name(this.name());b.i(this);var c=this.pred,d=[];a?b.d(T(this.p(),function(a){d[0]=a[0];return C(a[1])},function(a){if(c.get(d[0]).a(a[0]))return d[1]=a[0],d[2]=U(a[1]),d})):b.d(T(this.p(),function(a){d[0]=a[0];return C(a[1])},function(a){d[1]=a[0];d[2]=U(a[1]);return d}));b.graph=U(this.graph);b.node=U(this.node);return b};Y.prototype.to_undirected=Y.prototype.V; Y.prototype.reverse=function(a){(a=!s(a)||a)?(a=new this.constructor(l,{name:"Reverse of ("+this.name()+")"}),a.i(this),a.d(Q(this.g(l,k),function(a){var c=a[0];a[0]=a[1];a[1]=c;a[2]=U(a[2]);return a})),a.graph=U(this.graph),a.node=U(this.node)):(a=this.succ,this.succ=this.pred,this.pred=a,this.adj=this.succ,a=this);return a};Y.prototype.reverse=Y.prototype.reverse; Y.prototype.H=function(a){a=this.f(a);var b=new this.constructor,c=b.succ,d=b.pred,e=this.succ;M(a,function(a){c.set(a,new L);d.set(a,new L)});c.forEach(function(a,b){e.get(a).forEach(function(e,r){c.a(e)&&(b.set(e,r),d.get(e).set(a,r))})});M(b,function(a){b.node.set(a,this.node.get(a))},this);b.graph=this.graph;return b};Y.prototype.subgraph=Y.prototype.H;function Z(a,b){if(!(this instanceof Z))return new Z(a,b);P.call(this,a,b)}pa(Z,P);w("jsnx.classes.MultiGraph",Z);w("jsnx.MultiGraph",Z);Z.__name__="MultiGraph"; Z.prototype.b=function(a,b,c,d){var e,f;c!=l&&(!u(c)&&!ha(c))&&(d=c,c=l);d=d||{};"object"!==q(d)&&h(new J("The attr_dict argument must be an object."));this.adj.a(a)||(this.adj.set(a,new L),this.node.set(a,{}));this.adj.a(b)||(this.adj.set(b,new L),this.node.set(b,{}));if(this.adj.get(a).a(b)){f=this.adj.get(a).get(b);if(c==l)for(c=$a(f);c in f;)c+=1;e=H(f,""+c,{});I(e,d);f[c]=e}else c!=l||(c=0),e={},I(e,d),f=ib(c,e),this.adj.get(a).set(b,f),this.adj.get(b).set(a,f)};Z.prototype.add_edge=Z.prototype.b; Z.prototype.d=function(a,b){b=b||{};"object"!==q(b)&&h(new J("The attr_dict argument must be an object."));M(a,function(a){var d=Ab(a),e,f,g=l,m={};4===d?(e=a[0],f=a[1],g=a[2],m=a[3]):3===d?(e=a[0],f=a[1],m=a[2]):2===d?(e=a[0],f=a[1]):h(new J("Edge tuple "+ub(a)+" must be a 2-tuple, 3-tuple or 4-tuple."));a=this.adj.a(e)?this.adj.get(e).get(f,{}):{};if(g==l)for(g=$a(a);g in a;)g+=1;a=H(a,g,{});I(a,b,m);this.b(e,f,g,a)},this)};Z.prototype.add_edges_from=Z.prototype.d; Z.prototype.z=function(a,b,c){var d;try{d=this.adj.get(a).get(b)}catch(e){e instanceof K||h(e),h(new J("The edge "+a+"-"+b+" is not in the graph"))}c!=l?(c in d||h(new J("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),fb(d,c)):fb(d,ab(d));0===$a(d)&&(this.adj.get(a).remove(b),a!==b&&this.adj.get(b).remove(a))};Z.prototype.remove_edge=Z.prototype.z;Z.prototype.L=function(a){M(a,function(a){try{this.z(a[0],a[1],a[2])}catch(c){c instanceof J||h(c)}},this)};Z.prototype.remove_edges_from=Z.prototype.L; Z.prototype.T=function(a,b,c){try{var d;if(c!=l){var e=this.adj.get(a).get(b);d=c in e}else d=this.adj.get(a).a(b);return d}catch(f){return f instanceof K||h(f),n}};Z.prototype.has_edge=Z.prototype.T;Z.prototype.v=function(a,b,c){return Qa(this.g(a,b,c))};Z.prototype.edges=Z.prototype.v; Z.prototype.g=function(a,b,c){v(a)&&(v(b)&&(c=b),b=a,a=l);var d=new L,e,f;if(a!=l){var g=[];a=Q(this.f(a),function(a){g[0]=a;g[1]=this.adj.get(a);return g},this)}else a=C(this.adj);return b?T(a,function(a){e=a[0];var b=new B,c=C(a[1]);b.next=function(){try{return c.next()}catch(a){a===z&&d.set(e,k),h(a)}};return b},function(a){f=a[0];if(!d.a(f))return Ib(a[1])},function(a){return c?[e,f,a[0],a[1]]:[e,f,a[1]]}):T(a,function(a){e=a[0];var b=new B,c=C(a[1]);b.next=function(){try{return c.next()}catch(a){a=== z&&d.set(e,k),h(a)}};return b},function(a){f=a[0];if(!d.a(f))return Ib(a[1])},function(a){return c?[e,f,a[0]]:[e,f]})};Z.prototype.edges_iter=Z.prototype.g;Z.prototype.W=function(a,b,c,d){s(d)||(d=l);try{return c!=l?H(this.adj.get(a).get(b),""+c,d):this.adj.get(a).get(b)}catch(e){return e instanceof K||h(e),d}};Z.prototype.get_edge_data=Z.prototype.W; Z.prototype.u=function(a,b){var c;if(a!=l){var d=[];c=Q(this.f(a),function(a){d[0]=a;d[1]=this.adj.get(a);return d},this)}else c=C(this.adj);return b!=l?E(c,function(a){var c=a[0];a=a[1];var d=0;a.forEach(function(a,c){F(c,function(a){d+=H(a,b,1)})});a.a(c)&&F(a.get(c),function(a){d+=H(a,b,1)});return[c,d]}):E(c,function(a){var b=a[0];a=a[1];var c=0;a.forEach(function(a,b){c+=$a(b)});return[b,c+ +(a.a(b)&&$a(a.get(b)))]})};Z.prototype.degree_iter=Z.prototype.u;Z.prototype.m=ba(k); Z.prototype.is_multigraph=Z.prototype.m;Z.prototype.c=ba(n);Z.prototype.is_directed=Z.prototype.c;Z.prototype.M=function(){var a=new $;a.i(this);a.d(function(){var a,c;return T(this.p(),function(c){a=c[0];return C(c[1])},function(a){c=a[0];return Ib(a[1])},function(d){return[a,c,d[0],U(d[1])]})}.call(this));a.graph=U(this.graph);a.node=U(this.node);return a};Z.prototype.to_directed=Z.prototype.M; Z.prototype.ea=function(a,b){var c=[];a?b?this.adj.forEach(function(a,b){b.a(a)&&F(b.get(a),function(b,e){c.push([a,a,e,b])})}):this.adj.forEach(function(a,b){b.a(a)&&F(b.get(a),function(b){c.push([a,a,b])})}):b?this.adj.forEach(function(a,b){b.a(a)&&F(b.get(a),function(b,e){c.push([a,a,e])})}):this.adj.forEach(function(a,b){b.a(a)&&F(b.get(a),function(){c.push([a,a])})});return c};Z.prototype.selfloop_edges=Z.prototype.ea; Z.prototype.R=function(a){if(a==l)return this.size();try{return $a(this.adj.get(a).get(a))}catch(b){return b instanceof K||h(b),0}};Z.prototype.number_of_edges=Z.prototype.R;Z.prototype.H=function(a){a=this.f(a);var b=new this.constructor,c=b.adj,d=this.adj;D(a,function(a){var b=new L;c.set(a,b);d.get(a).forEach(function(d,m){if(c.a(d)){var r=gb(m);b.set(d,r);c.get(d).set(a,r)}})});this.node.forEach(function(a,c){b.node.set(a,c)});b.graph=this.graph;return b};Z.prototype.subgraph=Z.prototype.H;function $(a,b){if(!(this instanceof $))return new $(a,b);Y.call(this,a,b)}pa($,Y);var gc=$.prototype,hc=Z.prototype,ic;for(ic in hc)hc.hasOwnProperty(ic)&&"constructor"!==ic&&(gc[ic]=hc[ic]);w("jsnx.classes.MultiDiGraph",$);w("jsnx.MultiDiGraph",$);$.__name__="MultiDiGraph"; $.prototype.b=function(a,b,c,d){var e,f;c!=l&&(!u(c)&&!ha(c))&&(d=c,c=l);d=d||{};"object"!==q(d)&&h(new J("The attr_dict argument must be an object."));this.succ.a(a)||(this.succ.set(a,new L),this.pred.set(a,new L),this.node.set(a,{}));this.succ.a(b)||(this.succ.set(b,new L),this.pred.set(b,new L),this.node.set(b,{}));if(this.succ.get(a).a(b)){f=this.adj.get(a).get(b);if(c==l)for(c=$a(f);c in f;)c+=1;e=H(f,c.toString(),{});I(e,d);f[c]=e}else c!=l||(c=0),e={},I(e,d),f=ib(c,e),this.succ.get(a).set(b, f),this.pred.get(b).set(a,f)};$.prototype.add_edge=$.prototype.b;$.prototype.z=function(a,b,c){var d;try{d=this.adj.get(a).get(b)}catch(e){e instanceof K||h(e),h(new J("The edge "+a+"-"+b+" is not in the graph"))}c!=l?(c in d||h(new J("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),fb(d,c)):fb(d,ab(d));0===$a(d)&&(this.succ.get(a).remove(b),this.pred.get(b).remove(a))};$.prototype.remove_edge=$.prototype.z; $.prototype.g=function(a,b,c){v(a)&&(v(b)&&(c=b),b=a,a=l);var d,e;if(a!=l){var f=[];a=Q(this.f(a),function(a){f[0]=a;f[1]=this.adj.get(a);return f},this)}else a=C(this.adj);return b?T(a,function(a){d=a[0];return C(a[1])},function(a){e=a[0];return Ib(a[1])},function(a){return c?[d,e,a[0],a[1]]:[d,e,a[1]]}):T(a,function(a){d=a[0];return C(a[1])},function(a){e=a[0];return Ib(a[1])},function(a){return c?[d,e,a[0]]:[d,e]})};$.prototype.edges_iter=$.prototype.g;$.prototype.ka=$.prototype.g; $.prototype.out_edges_iter=$.prototype.ka;$.prototype.oa=function(a,b,c){return Qa(this.ka(a,b,c))};$.prototype.out_edges=$.prototype.oa; $.prototype.Q=function(a,b,c){v(a)&&(b=a,a=l);var d,e;if(a!=l){var f=[];a=Q(this.f(a),function(a){f[0]=a;f[1]=this.pred.get(a);return f},this)}else a=C(this.pred);return b?T(a,function(a){d=a[0];return C(a[1])},function(a){e=a[0];return Ib(a[1])},function(a){return c?[e,d,a[0],a[1]]:[e,d,a[1]]}):T(a,function(a){d=a[0];return C(a[1])},function(a){e=a[0];return Ib(a[1])},function(a){return c?[e,d,a[0]]:[e,d]})};$.prototype.in_edges_iter=$.prototype.Q; $.prototype.Y=function(a,b,c){return Qa(this.Q(a,b,c))};$.prototype.in_edges=$.prototype.Y; $.prototype.u=function(a,b){var c;if(a!=l){var d=[],e=[];c=Db(E(this.f(a),function(a){d[0]=a;d[1]=this.succ.get(a);return d},this),E(this.f(a),function(a){e[0]=a;e[1]=this.pred.get(a);return e},this))}else c=Db(C(this.succ),C(this.pred));return b!=l?Q(c,function(a){var c=a[0][1],d=0;a[1][1].forEach(function(a,c){F(c,function(a){d+=+H(a,b,1)})});c.forEach(function(a,c){F(c,function(a){d+=+H(a,b,1)})});return[a[0][0],d]}):Q(c,function(a){var b=0,c=0;a[1][1].forEach(function(a,c){b+=$a(c)});a[0][1].forEach(function(a, b){c+=$a(b)});return[a[0][0],b+c]})};$.prototype.degree_iter=$.prototype.u;$.prototype.X=function(a,b){var c;if(a!=l){var d=[];c=Q(this.f(a),function(a){d[0]=a;d[1]=this.pred.get(a);return d},this)}else c=C(this.pred);return b!=l?Q(c,function(a){var c=0;a[1].forEach(function(a,d){F(d,function(a){c+=+H(a,b,1)})});return[a[0],c]}):Q(c,function(a){var b=0;a[1].forEach(function(a,c){b+=$a(c)});return[a[0],b]})};$.prototype.in_degree_iter=$.prototype.X; $.prototype.ca=function(a,b){var c;if(a!=l){var d=[];c=Q(this.f(a),function(a){d[0]=a;d[1]=this.succ.get(a);return d},this)}else c=C(this.succ);return b!=l?Q(c,function(a){var c=0;a[1].forEach(function(a,d){F(d,function(a){c+=+H(a,b,1)})});return[a[0],c]}):Q(c,function(a){var b=0;a[1].forEach(function(a,c){b+=$a(c)});return[a[0],b]})};$.prototype.out_degree_iter=$.prototype.ca;$.prototype.m=ba(k);$.prototype.is_multigraph=$.prototype.m;$.prototype.c=ba(k);$.prototype.is_directed=$.prototype.c; $.prototype.M=function(){return vb(this)};$.prototype.to_directed=$.prototype.M;$.prototype.V=function(a){var b=new Z;b.name(this.name());b.i(this);var c,d;a?b.d(T(this.p(),function(a){c=a[0];return C(a[1])},function(a){d=a[0];return Ib(a[1])},oa(function(a){if(this.T(d,c,a[0]))return[c,d,a[0],U(a[1])]},this))):b.d(T(this.p(),function(a){c=a[0];return C(a[1])},function(a){d=a[0];return Ib(a[1])},function(a){return[c,d,a[0],U(a[1])]}));b.graph=U(this.graph);b.node=U(this.node);return b}; $.prototype.to_undirected=$.prototype.V;$.prototype.H=function(a){a=this.f(a);var b=new this.constructor,c=b.succ,d=b.pred,e=this.succ;D(a,function(a){c.set(a,new L);d.set(a,new L)});c.forEach(function(a,b){e.get(a).forEach(function(e,r){if(c.a(e)){var y=gb(r);b.set(e,y);d.get(e).set(a,y)}})});this.node.forEach(function(a,c){b.node.set(a,c)});b.graph=this.graph;return b};$.prototype.subgraph=$.prototype.H; $.prototype.reverse=function(a){(a=!s(a)||a)?(a=new this.constructor(l,{name:"Reverse of ("+this.name()+")"}),a.i(this),a.d(E(this.g(l,k,k),function(a){return[a[1],a[0],a[2],U(a[3])]})),a.graph=U(this.graph),a.node=U(this.node)):(a=this.succ,this.succ=this.pred,this.pred=a,this.adj=this.succ,a=this);return a};$.prototype.reverse=$.prototype.reverse;function jc(a){return a.nodes()}w("jsnx.classes.func.nodes",jc);w("jsnx.nodes",jc);function kc(a){return a.C()}w("jsnx.classes.func.nodes_iter",kc);w("jsnx.nodes_iter",kc);function lc(a,b){return a.v(b)}w("jsnx.classes.func.edges",lc);w("jsnx.edges",lc);function mc(a,b){return a.g(b)}w("jsnx.classes.func.edges_iter",mc);w("jsnx.edges_iter",mc);w("jsnx.degree",function(a,b,c){return a.t(b,c)});function nc(a,b){return a.B(b)}w("jsnx.classes.func.neighbors",nc);w("jsnx.neighbors",nc); function oc(a){return a.S()}w("jsnx.classes.func.number_of_nodes",oc);w("jsnx.number_of_nodes",oc);function pc(a){return a.R()}w("jsnx.classes.func.number_of_edges",pc);w("jsnx.number_of_edges",pc);function qc(a){var b=a.S(),c=a.R();return 0===c?0:a.c()?c/(b*(b-1)):2*c/(b*(b-1))}w("jsnx.classes.func.density",qc);w("jsnx.density",qc);function rc(a){a=a.t().n();var b=Math.max.apply(Math,a)+1,c=La(b);x(a,function(a){c[a]+=1});return c}w("jsnx.classes.func.degree_histogram",rc); w("jsnx.degree_histogram",rc);function sc(a){return a.c()}w("jsnx.classes.func.is_directed",sc);w("jsnx.is_directed",sc);function tc(a){function b(){h(new J("Frozen graph can't be modified"))}a.add_node=a.N=b;a.add_nodes_from=a.i=b;a.remove_node=a.U=b;a.remove_nodes_from=a.da=b;a.add_edge=a.b=b;a.add_edges_from=a.d=b;a.remove_edge=a.z=b;a.remove_edges_from=a.L=b;a.clear=a.clear=b;a.frozen=a.La=k;return a}w("jsnx.classes.func.freeze",tc);w("jsnx.freeze",tc);function uc(a){return!!a.La} w("jsnx.classes.func.is_frozen",uc);w("jsnx.is_frozen",uc);function vc(a,b){return a.H(b)}w("jsnx.classes.func.subgraph",vc);w("jsnx.subgraph",vc);function wc(a,b){s(b)||(b=k);var c=new a.constructor;b&&c.i(a);return c}w("jsnx.classes.func.create_empty_copy",wc);w("jsnx.create_empty_copy",wc); function xc(a,b){var c="";if(b!=l)a.o(b)||h(new J("node "+b+" not in graph")),c=c+("Node "+b+" has the following properties:\n")+("Degree: "+a.t(b)+"\n"),c+="Neighbors: "+a.B(b).join(" ");else{var c=c+("Name: "+a.name()+"\n"),c=c+("Type: "+a.constructor.__name__+"\n"),c=c+("Number of nodes: "+a.S()+"\n"),c=c+("Number of edges: "+a.R()+"\n"),d=a.S();if(0b?(c.set(a[0],e),d=e,b=f):c.set(a[0],e)});var e=new N(c.keys()),f=e.O(d),g=new N,m=[],r=[];a=new B;a.next=function(){0===f.count()&&0===m.length&&h(z);var a,A;if(0O&&(da=a,O=X,O===ua)););if(O===ua)return r.pop(),this.next();b=-1;for(A=C(G);(a=Ra(A,l))!==l&&!(a=G.q(c.get(a)),X=a.count(),X>b&&(d=a,b=X,b===ua-1)););O>b&&(d=da);m.push([e,g,f]);e=G;g=W;f=e.O(d);return this.next()};return a}w("jsnx.algorithms.clique.find_cliques",Jc);w("jsnx.find_cliques",Jc); function Kc(a){var b=new L;D(a.p(),function(a){var c=new N(a[1].keys());c.remove(a[0]);b.set(a[0],c)});if(0===b.count())return[];a=new N(b.keys());var c=new N,d=[];Lc(b,a,c,[],d);return d}w("jsnx.algorithms.clique.find_cliques_recursive",Kc);w("jsnx.find_cliques_recursive",Kc); function Lc(a,b,c,d,e){var f=-1,g=b.count(),m,r,y,A;for(r=C(c);(y=Ra(r,l))!==l;)if(y=b.q(a.get(y)),A=y.count(),A>f&&(m=y,f=A,A===g))return;D(b,function(c){c=b.q(a.get(c));var d=c.count();d>f&&(m=c,f=d)});g=b.O(m);D(g,function(f){b.remove(f);d.push(f);var g=a.get(f);f=b.q(g);g=c.q(g);0===f.count()&&0===g.count()?e.push(Da(d)):0===g.count()&&1===f.count()?e.push(Ca(d,f.n())):Lc(a,f,g,d,e);c.add(d.pop())})}function Mc(a,b){b!=l||(b=Jc(a));var c=0;M(b,function(a){c=a.length>c?a.length:c});return c} w("jsnx.algorithms.clique.graph_clique_number",Mc);w("jsnx.graph_clique_number",Mc);function Nc(a,b){b!=l||(b=Jc(a));return R(b).length}w("jsnx.algorithms.clique.graph_number_of_cliques",Nc);w("jsnx.graph_number_of_cliques",Nc);function Oc(a,b,c){c=c!=l?Qa(c):Qa(Jc(a));b!=l||(b=a.nodes());var d;if(ga(b))d=new L,x(b,function(a){d.set(a,ta(c,function(b){return(new N(b)).a(a)}).length)});else{var e=b;d=ta(c,function(a){return(new N(a)).a(e)}).length}return d} w("jsnx.algorithms.clique.number_of_cliques",Oc);w("jsnx.number_of_cliques",Oc);function Pc(a,b){if(a.K()!=b.K())return n;var c=a.t(),d=Cc(a),e=Oc(a),f=[];c.forEach(function(a){f.push([c.get(a),d.get(a),e.get(a)])});f.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]!==b[1]?a[1]-b[1]:a[2]-b[2]});var g=b.t(),m=Cc(b),r=Oc(b),y=[];g.forEach(function(a){y.push([g.get(a),m.get(a),r.get(a)])});y.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]!==b[1]?a[1]-b[1]:a[2]-b[2]});return!Ia(f,y,function(a,b){return Ia(a,b)})?n:k}w("jsnx.algorithms.isomorphism.could_be_isomorphic",Pc); w("jsnx.could_be_isomorphic",Pc);function Qc(a,b){if(a.K()!=b.K())return n;var c=a.t(),d=Cc(a),e=[];c.forEach(function(a){e.push([c.get(a),d.get(a)])});e.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]-b[1]});var f=b.t(),g=Cc(b),m=[];f.forEach(function(a){m.push([f.get(a),g.get(a)])});m.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]-b[1]});return!Ia(e,m,function(a,b){return Ia(a,b)})?n:k}w("jsnx.algorithms.isomorphism.fast_could_be_isomorphic",Qc);w("jsnx.fast_could_be_isomorphic",Qc); function Rc(a,b){if(a.K()!=b.K())return n;var c=a.t().n();c.sort();var d=b.t().n();d.sort();return!Ia(c,d)?n:k}w("jsnx.algorithms.isomorphism.faster_could_be_isomorphic",Rc);w("jsnx.faster_could_be_isomorphic",Rc);function Sc(a,b){if("eg"===b)return Tc(a);if(b==l||"hh"===b)return Uc(a);h(new mb("`opt_method` must be 'eg' or 'hh'"))}w("jsnx.algorithms.graphical.is_valid_degree_sequence",Sc);w("jsnx.is_valid_degree_sequence",Sc);function Uc(a){if(0===a.length)return k;if(!Wa(a)||0>Math.min.apply(l,a)||0!==V.w.apply(l,a)%2)return n;for(a=Da(a);0a[0])break;var b=a.pop();if(0===b)return k;if(b>a.length)break;for(var c=a.length-1,b=a.length-(b+1);c>b;c--)a[c]-=1}return n} w("jsnx.algorithms.graphical.is_valid_degree_sequence_havel_hakimi",Uc);w("jsnx.is_valid_degree_sequence_havel_hakimi",Uc); function Tc(a){if(0===a.length)return k;if(!Wa(a)||0>Math.min.apply(l,a)||0!==V.w.apply(l,a)%2)return n;var b=a.length,c=Da(a).sort(function(a,b){return b-a}),d=[],e;e=1;for(a=c.length;eg)return n;return k}w("jsnx.algorithms.graphical.is_valid_degree_sequence_erdos_gallai",Tc); w("jsnx.is_valid_degree_sequence_erdos_gallai",Tc);function Vc(a){try{return Wc(a),k}catch(b){if(b instanceof pb)return n;h(b)}}w("jsnx.algorithms.dag.is_directed_acyclic_graph",Vc);w("jsnx.is_directed_acyclic_graph",Vc); function Wc(a,b){a.c()||h(new J("Topological sort not defined on undirected graphs."));var c=new N,d=[],e=new N;b!=l||(b=a.C());M(b,function(b){if(!e.a(b))for(b=[b];0=a.ia()){a=this.s;for(var d=0;d>1,a[d].getKey()>c.getKey())a[b]=a[d],b=d;else break;a[b]=c}p=ad.prototype; p.remove=function(){var a=this.s,b=a.length,c=a[0];if(!(0>=b)){if(1==b)Aa(a);else{a[0]=a.pop();for(var a=0,b=this.s,d=b.length,e=b[a];a>1;){var f=2*a+1,g=2*a+2,f=ge.getKey())break;b[a]=b[f];a=f}b[a]=e}return c.ra}};p.P=function(){for(var a=this.s,b=[],c=a.length,d=0;db?a:b}),ge=e.scale.linear().range([2,f.edge_style["stroke-width"]]).domain([0,za]);f.edge_style["stroke-width"]=function(a){return ge(X.call(this, a))}}m.select("svg.jsnx").remove();m.attr("width",G+"px").attr("height",W+"px").style("opacity",1E-6).transition().duration(1E3).style("opacity",1);var he={size:k,nodes:k,links:k,start:k};M(ua,function(a){if(!(a in he))A[a](ua[a])});A.nodes([]).links([]).size([G,W]);var db=1,fa=1;if(f.pan_zoom.enabled){var pd=f.pan_zoom.scale;(function(){var a=n,b=1,c=db;m.call(e.behavior.zoom().on("zoom",function(){var f=e.event.sourceEvent.shiftKey;(f=pd&&f||!(pd||f))&&!a?(b=e.event.scale,c=db,a=k):!f&&a&&(a=n); db=f?c*(e.event.scale/b):db;fa=!f?db/e.event.scale:fa;f=e.event.translate;r.attr("transform","translate("+f[0]+","+f[1]+")scale("+e.event.scale+")");d()}))})()}var nd=ea,Ha=f.edge_offset,wb=f.node_attr.r,xb=f.node_style["stroke-width"];"circle"===f.node_shape?(ia(wb)||(wb=function(){return f.node_attr.r}),ia(xb)||(xb=function(){return f.node_style["stroke-width"]}),Ha=function(a){return[wb(a.source)+xb(a.source),wb(a.target)+xb(a.target)]}):(ga(Ha)&&(Ha=function(){return f.edge_offset}),ha(Ha)&&(Ha= function(){return[f.edge_offset,f.edge_offset]}));var Ua=f.edge_style["stroke-width"];ia(Ua)||(Ua=function(){return f.edge_style["stroke-width"]});var yb=f.edge_label_offset,nd=od?function(){ya.l.each(function(a){if(a.source!==a.target){var b=e.select(this),c=a.source.x,d=a.source.y,f=a.target.x,g=a.target.y,m=V.sa(c,d,f,g),f=Math.sqrt(Math.pow(f-c,2)+Math.pow(g-d,2)),g=Ha(a),g=[g[0]*fa,g[1]*fa];b.attr("transform",["translate(",c,",",d,")rotate(",m,")"].join(""));c=Ua(a)*fa;d=f-g[1]-2*c;m=c/2;b.select(".line").attr("d", ["M",g[0],0,"L",g[0],-m,"L",d,-m,"L",d,-c,"L",f-g[1],0,"z"].join(" "));c=1/fa;b.select("text").attr("x",yb.x*c+g[0]+(f*c-g[0]-g[1])/2).attr("y",-Ua(a)/2+-yb.y*c).attr("transform","scale("+fa+")")}})}:function(){ya.l.each(function(a){if(a.source!==a.target){var b=e.select(this),c=a.source.x,d=a.source.y,g=a.target.x,m=a.target.y,r=V.sa(c,d,g,m),g=Math.sqrt(Math.pow(g-c,2)+Math.pow(m-d,2)),m=g/2,y=Ha(a),y=[y[0]*fa,y[1]*fa],A=1/fa,O=Ua(a)*fa,ua=90r;b.attr("transform",["translate(",c,",",d,")rotate(", r,")"].join(""));b.select(".line").attr("d",["M",y[0],O/4,"L",y[0],-O/4,"L",g-y[1],-O/4,"L",g-y[1],O/4,"z"].join(" "));f.with_edge_labels&&b.select("text").attr("x",(ua?1:-1)*yb.x*A+y[0]+(g*A-y[0]-y[1])/2).attr("y",-Ua(a)/4+-yb.y*A).attr("transform","scale("+fa+")"+(ua?"rotate(180,"+m*(1/fa)+",0)":""))}})};A.on("tick",d);G=a.C();W=a.g();g&&(c=n,G=a.f(g),W=a.g(g));ya.j=Bd(a,G,A,y,f.node_shape,O);ya.l=Cd(a,W,A,b,da);Dd(ya.j,{attr:f.node_attr,style:f.node_style,aa:f.label_style,$:f.label_attr},f.with_labels); Ed(ya.l,{attr:f.edge_attr,style:f.edge_style,aa:f.edge_label_style,$:f.edge_label_attr},f.with_edge_labels,l,od);c?Fd(a,A,f,ya):a.bound?Gd(a):Hd(a);A.start();return A});function Bd(a,b,c,d,e,f){var g=c.nodes();M(b,function(b){var c=a.node.get(b);b={node:b,data:c,G:a};g.push(b);c.__d3datum__=b});d=d.data(g,Id);b=d.enter().append("g").classed("node",k).call(c.drag);b.append(e).classed("node-shape",k);f&&b.append("text").text(f);return d} function Cd(a,b,c,d,e){var f=c.links();M(b,function(b){var c=b[0],d=b[1];b=b[2]||a.W(c,d);c={edge:[c,d],redge:[d,c],source:a.node.get(c).__d3datum__,target:a.node.get(d).__d3datum__,data:b,G:a};f.push(c);b.__d3datum__=c});d=d.data(f,Jd);b=d.enter().append("g").classed("edge",k);b.append("path").classed("line",k);e&&b.append("text").text(e);return d} function Dd(a,b,c,d){if(d!=l){var e={};M(d,function(a){e[t(a)?a[0]:a]=k});a=a.filter(function(a){return a.node in e})}var f=a.selectAll(".node-shape");F(b.attr,function(a,b){f.attr(b,a)});F(b.style,function(a,b){f.style(b,a)});if(c){var g=a.selectAll("text");F(b.$,function(a,b){g.attr(b,a)});F(b.aa,function(a,b){g.style(b,a)})}} function Ed(a,b,c,d,e){if(d!=l){var f={};M(d,function(a){f[[a[0],a[1]]]=k});a=a.filter(function(a){return a.edge in f||e||a.redge in f})}var g=a.selectAll(".line");F(b.attr,function(a,b){g.attr(b,a)});F(b.style,function(a,b){"stroke-width"!=b&&g.style(b,a)});g.style("stroke-width",0);if(c){var m=a.selectAll("text");F(b.$,function(a,b){m.attr(b,a)});F(b.aa,function(a,b){m.style(b,a)})}}function Id(a){return a.node}function Jd(a){return a.edge} function Kd(a,b,c,d){var e=c.nodes();M(a.f(b),function(b){Ba(e,a.node.get(b).__d3datum__)});d=d.data(e,Id);d.exit().remove();return d}function Ld(a,b,c,d){var e=c.links();M(b,function(b){Ba(e,H(a.W(b[0],b[1],{}),"__d3datum__",l))});d=d.data(e,Jd);d.exit().remove();return d} function Fd(a,b,c,d){Gd(a,n);var e=a.constructor.prototype,f=c.node_shape,g={attr:c.node_attr,style:c.node_style,$:c.label_attr,aa:c.label_style},m={attr:c.edge_attr,style:c.edge_style,$:c.edge_label_attr,aa:c.edge_label_style},r=c.labels,y=c.edge_labels,A=c.with_labels,G=c.with_edge_labels,W=a.c();a.add_node=a.N=function(a){var c=!this.o(a);e.add_node.apply(this,arguments);c&&(d.j=Bd(this,[a],b,d.j,f,r));Dd(d.j,g,A,[a]);b.start()};a.add_nodes_from=a.i=function(a){var c=ta(R(a),function(a){return!this.o(t(a)? a[0]:a)},this);e.add_nodes_from.apply(this,arguments);0=b||1<=b)return Xd(a,b,c);var e=1,f=-1;b=Math.log(1-b);if(c)for(d=new Y(d);e=a&&e=e&&e=b)return d;if(1<=b)return Qd(a,d);a=d.c()?Gb(S(a)):Fb(S(a));D(a,function(a){Math.random()c[0][0])return n;var e=c.pop();if(0===e[0])break;if(e[0]>c.length)return n;for(var f=c.length,g=f-e[0];gb||b>e-1||0>a||a>e-1)&&h(new J("invalid graph_description"));f.b(b,a)});f.name=d;return f} w("jsnx.generators.small.make_small_graph",ce);w("jsnx.make_small_graph",ce);function de(a){return be(["adjacencylist","Bull Graph",5,[[2,3],[1,3,4],[1,2,5],[2],[3]]],a)}w("jsnx.generators.small.bull_graph",de);w("jsnx.bull_graph",de);function ee(a){return be(["adjacencylist","Krackhardt Kite Social Network",10,[[2,3,4,6],[1,4,5,7],[1,4,6],[1,2,3,5,6,7],[2,4,7],[1,3,4,7,8],[2,4,5,6,8],[6,7,9],[8,10],[9]]],a)}w("jsnx.generators.small.krackhardt_kite_graph",ee);w("jsnx.krackhardt_kite_graph",ee);function fe(a,b,c){var d=b;!ia(d.set)&&!ia(d.get)&&(d=new L(d));ia(b)&&(d=new L,D(a.C(),function(a){d.set(a,b(a))}));return!s(c)||c?ie(a,d):je(a,d)}w("jsnx.relabel.relabel_nodes",fe);w("jsnx.relabel_nodes",fe); function je(a,b){var c=new N(b.keys()),d;if(0