forked from fkling/JSNetworkX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsnetworkx-node.js
153 lines (153 loc) · 72.1 KB
/
jsnetworkx-node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
(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 q,ca=this;
function r(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 da(a){return"array"==r(a)}function t(a){var b=r(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 ea(a){return"number"==typeof a}function fa(a){var b=typeof a;return"object"==b&&a!=l||"function"==b}var ga="closure_uid_"+(1E9*Math.random()>>>0),ha=0;
function ia(a,b,c){return a.call.apply(a.bind,arguments)}function ja(a,b,c){a||h(Error());if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function ka(a,b,c){ka=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ia:ja;return ka.apply(l,arguments)}
function w(a,b){var c=a.split("."),d=ca;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&s(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}function la(a,b){function c(){}c.prototype=b.prototype;a.Wa=b.prototype;a.prototype=new c;a.prototype.constructor=a};var x=Array.prototype,ma=x.indexOf?function(a,b,c){return x.indexOf.call(a,b,c)}:function(a,b,c){c=c==l?0:0>c?Math.max(0,a.length+c):c;if(u(a))return!u(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},y=x.forEach?function(a,b,c){x.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=u(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},na=x.filter?function(a,b,c){return x.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=u(a)?a.split(""):
a,m=0;m<d;m++)if(m in g){var p=g[m];b.call(c,p,m,a)&&(e[f++]=p)}return e},oa=x.map?function(a,b,c){return x.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=u(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e};function pa(a,b){if(a.reduce)return a.reduce(b,0);var c=0;y(a,function(d,e){c=b.call(aa,c,d,e,a)});return c}
var qa=x.some?function(a,b,c){return x.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=u(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return k;return n};function ra(a,b){var c;a:{c=a.length;for(var d=u(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(aa,d[e],e,a)){c=e;break a}c=-1}return 0>c?l:u(a)?a.charAt(c):a[c]}function sa(a){if(!da(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0}function ta(a){return x.concat.apply(x,arguments)}
function ua(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]}function wa(a,b,c,d){x.splice.apply(a,xa(arguments,1))}function xa(a,b,c){return 2>=arguments.length?x.slice.call(a,b):x.slice.call(a,b,c)}function ya(a,b,c){if(!t(a)||!t(b)||a.length!=b.length)return n;var d=a.length;c=c||za;for(var e=0;e<d;e++)if(!c(a[e],b[e]))return n;return k}function Ba(a,b){return a>b?1:a<b?-1:0}function za(a,b){return a===b}
function Ca(a){for(var b=[],c=0;c<a;c++)b[c]=0;return b}function Da(a){if(!arguments.length)return[];for(var b=[],c=0;;c++){for(var d=[],e=0;e<arguments.length;e++){var f=arguments[e];if(c>=f.length)return b;d.push(f[c])}b.push(d)}}function Ea(a){for(var b=Math.random,c=a.length-1;0<c;c--){var d=Math.floor(b()*(c+1)),e=a[c];a[c]=a[d];a[d]=e}};var z="StopIteration"in ca?ca.StopIteration:Error("StopIteration");function A(){}A.prototype.next=function(){h(z)};A.prototype.G=function(){return this};function Fa(a){if(a instanceof A)return a;if("function"==typeof a.G)return a.G(n);if(t(a)){var b=0,c=new A;c.next=function(){for(;;){b>=a.length&&h(z);if(b in a)return a[b++];b++}};return c}h(Error("Not implemented"))}
function B(a,b,c){if(t(a))try{y(a,b,c)}catch(d){d!==z&&h(d)}else{a=Fa(a);try{for(;;)b.call(c,a.next(),aa,a)}catch(e){e!==z&&h(e)}}}function Ha(a,b,c){var d=Fa(a);a=new A;a.next=function(){for(;;){var a=d.next();return b.call(c,a,aa,d)}};return a}function Ia(a,b){var c={};B(a,function(a){c=b.call(aa,c,a)});return c}function C(a){if(t(a))return ua(a);a=Fa(a);var b=[];B(a,function(a){b.push(a)});return b}function Ja(a,b){try{return Fa(a).next()}catch(c){return c!=z&&h(c),b}};function E(a,b,c){for(var d in a)b.call(c,a[d],d,a)}function Ka(a,b,c){var d={},e;for(e in a)d[e]=b.call(c,a[e],e,a);return d}function F(a){var b=0,c;for(c in a)b++;return b}function La(a){for(var b in a)return b}function Ma(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function H(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function Na(a){for(var b in a)return n;return k}function Oa(a){for(var b in a)delete a[b]}function I(a,b){b in a&&delete a[b]}function K(a,b,c){return b in a?a[b]:c}
function Pa(a){var b={},c;for(c in a)b[c]=a[c];return b}var Qa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function L(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Qa.length;f++)c=Qa[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}}
function Ra(a){var b=arguments.length;if(1==b&&da(arguments[0]))return Ra.apply(l,arguments[0]);b%2&&h(Error("Uneven number of arguments"));for(var c={},d=0;d<b;d+=2)c[arguments[d]]=arguments[d+1];return c};function Sa(a){if("function"==typeof a.t)return a.t();if(u(a))return a.split("");if(t(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Ma(a)};function Ta(a,b){this.h={};this.l=[];var c=arguments.length;if(1<c){c%2&&h(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.Y(a)}q=Ta.prototype;q.w=0;q.T=0;q.e=function(){return this.w};q.t=function(){Ua(this);for(var a=[],b=0;b<this.l.length;b++)a.push(this.h[this.l[b]]);return a};q.Z=function(){Ua(this);return this.l.concat()};q.ea=function(a){return Object.prototype.hasOwnProperty.call(this.h,a)};q.B=function(){return 0==this.w};
q.clear=function(){this.h={};this.T=this.w=this.l.length=0};q.remove=function(a){return Object.prototype.hasOwnProperty.call(this.h,a)?(delete this.h[a],this.w--,this.T++,this.l.length>2*this.w&&Ua(this),k):n};
function Ua(a){if(a.w!=a.l.length){for(var b=0,c=0;b<a.l.length;){var d=a.l[b];Object.prototype.hasOwnProperty.call(a.h,d)&&(a.l[c++]=d);b++}a.l.length=c}if(a.w!=a.l.length){for(var e={},c=b=0;b<a.l.length;)d=a.l[b],Object.prototype.hasOwnProperty.call(e,d)||(a.l[c++]=d,e[d]=1),b++;a.l.length=c}}q.set=function(a,b){Object.prototype.hasOwnProperty.call(this.h,a)||(this.w++,this.l.push(a),this.T++);this.h[a]=b};
q.Y=function(a){var b;a instanceof Ta?(b=a.Z(),a=a.t()):(b=H(a),a=Ma(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};q.I=function(){return new Ta(this)};q.G=function(a){Ua(this);var b=0,c=this.l,d=this.h,e=this.T,f=this,g=new A;g.next=function(){for(;;){e!=f.T&&h(Error("The map has changed since the iterator was created"));b>=c.length&&h(z);var g=c[b++];return a?g:d[g]}};return g};function M(a){this.h=new Ta;a&&this.Y(a)}function Va(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ga]||(a[ga]=++ha)):b.substr(0,1)+a}q=M.prototype;q.e=function(){return this.h.e()};q.add=function(a){this.h.set(Va(a),a)};q.Y=function(a){a=Sa(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};q.remove=function(a){return this.h.remove(Va(a))};q.clear=function(){this.h.clear()};q.B=function(){return this.h.B()};q.contains=function(a){return this.h.ea(Va(a))};
function Wa(a,b){for(var c=new M,d=Sa(b),e=0;e<d.length;e++){var f=d[e];a.contains(f)&&c.add(f)}return c}function Xa(a,b){for(var c=a.I(),d=Sa(b),e=d.length,f=0;f<e;f++)c.remove(d[f]);return c}q.t=function(){return this.h.t()};q.I=function(){return new M(this)};q.G=function(){return this.h.G(n)};function Ya(a){if(a!=l)try{a.clear()}catch(b){h(Error("Input graph is not a jsnx graph type"))}else a=new N;return a}
function Za(a,b,c){var d=l;if(a.hasOwnProperty("adj"))try{return d=$a(a.adj,b,a.j()),"graph"in a&&"object"===r(a.graph)&&(d.graph=Pa(a.graph)),"node"in a&&"object"===r(a.node)&&(d.node=Ka(a.node,function(a){return Pa(a)})),d}catch(e){h(Error("Input is not a correct jsnx graph"))}if("object"===r(a))try{return $a(a,b,c)}catch(f){try{return ab(a,b)}catch(g){h(Error("Input is not known type."))}}if(t(a))try{return bb(a,b)}catch(m){h(Error("Input is not valid edge list"))}return d}
w("jsnx.convert.to_networkx_graph",Za);w("jsnx.to_networkx_graph",Za);function cb(a){return a.L()}w("jsnx.convert.convert_to_undirected",cb);w("jsnx.convert_to_undirected",cb);function db(a){return a.A()}w("jsnx.convert.convert_to_directed",db);w("jsnx.convert_to_undirected",db);function eb(a,b){function c(a){return 0<=ma(b,a)}var d={};b!=l?b=O(b):(b=a,c=function(a){return b.r(a)});P(b,function(b){d[b]=na(a.C(b),c)});return d}w("jsnx.convert.to_dict_of_lists",eb);w("jsnx.to_dict_of_lists",eb);
function ab(a,b){var c=Ya(b);c.g(a);if(c.j()&&!c.c()){var d={};E(a,function(a,b){y(a,function(a){a in d||c.a(b,a)});d[b]=1})}else{var e=[];E(a,function(a,b){y(a,function(a){e.push([b,a])})});c.b(e)}return c}w("jsnx.convert.from_dict_of_lists",ab);
w("jsnx.convert.to_dict_of_dicts",function(a,b,c){var d={};b!=l?(b=O(b),c!=l?y(b,function(e){d[e]={};E(a.f(e),function(a,g){0<=ma(b,g)&&(d[e][g]=c)})}):y(b,function(c){d[c]={};E(a.f(c),function(a,g){0<=ma(b,g)&&(d[c][g]=a)})})):c!=l?B(a.o(),function(a,b){d[b]=Ka(a,function(){return c})}):B(a.o(),function(a,b){d[b]=Pa(a)});return d});
function $a(a,b,c){var d=Ya(b),e,f;d.g(a);c?d.c()?(d.j()?(e=[],E(a,function(a,b){t(a)&&h(Error());E(a,function(a,c){E(a,function(a,d){e.push([b,c,d,a])})})})):(e=[],E(a,function(a,b){t(a)&&h(Error());E(a,function(a,c){E(a,function(a){e.push([b,c,a])})})})),d.b(e)):d.j()?(f=new M,E(a,function(a,b){t(a)&&h(Error());E(a,function(a,c){f.contains([b,c].toString())||(e=[],E(a,function(a,d){e.push([b,c,d,a])}),d.b(e),f.add([c,b].toString()))})})):(f=new M,E(a,function(a,b){t(a)&&h(Error());E(a,function(a,
c){f.contains([b,c].toString())||(e=[],E(a,function(a){e.push([b,c,a])}),d.b(e),f.add([c,b].toString()))})})):d.j()&&!d.c()?(f=new M,E(a,function(a,b){t(a)&&h(Error());E(a,function(a,c){f.contains([b,c].toString())||(d.a(b,c,a),f.add([c,b].toString()))})})):(e=[],E(a,function(a,b){t(a)&&h(Error());E(a,function(a,c){e.push([b,c,a])})}),d.b(e));return d}w("jsnx.convert.from_dict_of_dicts",$a);w("jsnx.convert.to_edgelist",function(a,b){return b!=l?a.m(b,k):a.m(l,k)});
function bb(a,b){var c=Ya(b);c.b(a);return c}w("jsnx.convert.from_edgelist",bb);function fb(a){this.name="JSNetworkXException";this.message=a}w("jsnx.exception.JSNetworkXException",fb);fb.prototype=Error();fb.prototype.constructor=fb;w("jsnx.JSNetworkXException",fb);function Q(a){fb.call(this,a);this.name="JSNetworkXError"}la(Q,fb);w("jsnx.exception.JSNetworkXError",Q);w("jsnx.JSNetworkXError",Q);function gb(a){fb.call(this,a);this.name="JSNetworkXPointlessConcept"}la(gb,fb);w("jsnx.exception.JSNetworkXPointlessConcept",gb);w("jsnx.JSNetworkXPointlessConcept",gb);
function hb(a){fb.call(this,a);this.name="JSNetworkXAlgorithmError"}la(hb,fb);w("jsnx.exception.JSNetworkXAlgorithmError",hb);w("jsnx.JSNetworkXAlgorithmError",hb);function ib(a){hb.call(this,a);this.name="JSNetworkXUnfeasible"}la(ib,hb);w("jsnx.exception.JSNetworkXUnfeasible",ib);w("jsnx.JSNetworkXUnfeasible",ib);function jb(a){ib.call(this,a);this.name="JSNetworkXNoPath"}la(jb,ib);w("jsnx.exception.JSNetworkXNoPath",jb);w("jsnx.JSNetworkXNoPath",jb);
function kb(a){hb.call(this,a);this.name="JSNetworkXUnbounded"}la(kb,hb);w("jsnx.exception.JSNetworkXUnbounded",kb);w("jsnx.JSNetworkXUnbounded",kb);w("jsnx.filter",function(a,b,c){var d=Fa(a);a=new A;a.next=function(){for(;;){var a=d.next();if(b.call(c,a,aa,d))return a}};return a});function lb(a){return Ia(R(a),function(a,c){a[c[0]]=c[1];return a})}function mb(a){var b=0;s(b)||(b=l);var c={};P(a,function(a){c[a]=b});return c}function nb(a){return a!=l&&(a instanceof A||"function"==r(a.G))}function ob(a){if(a instanceof N)return a.K();if(u(a)||t(a))return a.length;if(pb(a))return F(a);h(new TypeError)}
function P(a,b,c,d){v(c)&&(d=c,c=l);if(d){var e=b;b=function(a){e.apply(this,a)}}a instanceof N?B(R(a),b,c):nb(a)?B(a,b,c):t(a)||u(a)?y(a,b,c):fa(a)&&P(H(a),b,c)}w("jsnx.forEach",P);function S(a,b,c){if(a instanceof N)return S(R(a),b,c);if(t(a))return oa(a,b,c);if(nb(a))return Ha(a,b,c);if(fa(a))return Ka(a,b,c);h(new TypeError)}w("jsnx.map",S);
function qb(a){var b=arguments,c=b[0];if(t(c))return Da.apply(l,b);if(nb(c)){var c=new A,d=b.length;c.next=function(){for(var a=[],c=0;c<d;c++)a.push(b[c].next());return a};return c}if(fa(c))return Da.apply(l,oa(b,H));h(new TypeError)}function sb(a,b){a="function"==r(b)?O(S(a,function(){return b.apply(l,arguments)})):O(a);return Math.max.apply(l,a)}
function T(a,b,c){if(0===arguments.length)return Fa([]);1===arguments.length?(b=a,a=0,c=1):2===arguments.length?c=1:3===arguments.length&&0===arguments[2]&&h("range() step argument must not be zero");var d=new A,e=0>c,f=a,g;d.next=function(){(e&&f<=b||!e&&f>=b)&&h(z);g=f;f+=c;return g};return d}
function tb(a){var b=O(a),c=b.length;if(2>c)return new A;var d=O(T(2));a=new A;a.next=function(){var a=oa(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 oa(d,function(a){return b[a]})};return a};return a}
function ub(a){var b=O(a),c=b.length,d=ea(2)?2:c;if(d>c)return new A;var e=O(T(c)),f=O(T(c,c-d,-1));a=new A;var g=new A,m,p=k;a.next=function(){this.next=m.next;return oa(e.slice(0,d),function(a){return b[a]})};g.next=function(){return p};m=U(g,function(a){a||h(z);p=n;return T(d-1,-1,-1)},function(a){if(!p)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;p=k;return R([oa(e.slice(0,d),function(a){return b[a]})])}},
function(a){return a});return a}function vb(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)!s(a[c])||"object"!==r(a[c])?a[c]=V(d[c]):"object"===r(a[c])&&"object"===r(d)&&vb(a[c],d[c]);for(var f=0;f<Qa.length;f++)c=Qa[f],Object.prototype.hasOwnProperty.call(d,c)&&(!s(a[c])||"object"!==r(a[c])?a[c]=V(d[c]):"object"===r(a[c])&&"object"===r(d)&&vb(a[c],d[c]))}}
function O(a){if(a instanceof N)return O(R(a));if(t(a))return ua(a);if(nb(a))return C(a);if(fa(a))return H(a);h(new TypeError)}w("jsnx.toArray",O);function wb(a){var b=[];E(a,function(a,d){b.push([d,a])});return b}function W(a){var b=new A,c=Fa(H(a));b.next=function(){var b=c.next();return[b,a[b]]};return b}function R(a){if(a instanceof N)return R(a.adj);"object"===r(a)&&(!t(a)&&!nb(a))&&(a=H(a));return Fa(a)}
function U(a,b){var c=new A,d=xa(arguments,1);if(0===d.length)return a;try{a=Fa(a)}catch(e){return c.next=function(){"Not implemented"===e.message&&h(new TypeError)},c}var f=0,g=d.length,m=[a];c.next=function(){do try{var a,b;do a=m[f].next(),s(a)&&(b=d[f](a));while(!s(a));if(nb(b)){if(f===g-1)return b;m.push(b);f+=1}else if(s(b))return b}catch(c){c!==z&&h(c),0<f?(m.pop(),f-=1):h(c)}while(1)};return c}w("jsnx.sentinelIterator",function(a,b){var c=new A;c.next=function(){return Ja(a,b)};return c});
function pb(a){var b=Object.prototype.hasOwnProperty;if(!a||"object"!==r(a)||a.nodeType||a==a.window)return n;try{if(a.constructor&&!b.call(a,"constructor")&&!b.call(a.constructor.prototype,"isPrototypeOf"))return n}catch(c){return n}for(var d in a);return d===aa||b.call(a,d)}
function V(a,b){b=b||[];var c=r(a);if("object"==c&&pb(a)||"array"==c){var d=ra(b,function(b){return a===b[0]});if(d!==l)return d[1];if(a.I)return d=[a,a.I()],b.push(d),d[1];c="array"==c?[]:{};d=[a,c];b.push(d);for(var e in a)c[e]=V(a[e],b);return c}return a}function xb(a){function b(){}var c={},d;b.prototype=a.constructor.prototype;for(d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);c=V(c);a=new b;for(d in c)a[d]=c[d];return a}var zb=function yb(b,c){return 0===c?b:yb(c,b%c)};function Ab(a){var b=[];Bb(new Cb,a,b);return b.join("")}function Cb(){this.X=aa}
function Bb(a,b,c){switch(typeof b){case "string":Db(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==l){c.push("null");break}if(da(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Bb(a,a.X?a.X.call(b,String(f),e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),Db(f,c),c.push(":"),
Bb(a,a.X?a.X.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:h(Error("Unknown type: "+typeof b))}}var Eb={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Fb=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Db(a,b){b.push('"',a.replace(Fb,function(a){if(a in Eb)return Eb[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Eb[a]=e+b.toString(16)}),'"')};var X={Ra:function(a){return Math.floor(Math.random()*a)},Xa:function(a,b){return a+Math.random()*(b-a)},La:function(a,b,c){return Math.min(Math.max(a,b),c)},Ba:function(a,b){var c=a%b;return 0>c*b?c+b:c},Oa:function(a,b,c){return a+c*(b-a)},Qa:function(a,b,c){return Math.abs(a-b)<=(c||1E-6)},ba:function(a){return X.Ba(a,360)},na:function(a){return a*Math.PI/180},Ga:function(a){return 180*a/Math.PI},Ja:function(a,b){return b*Math.cos(X.na(a))},Ka:function(a,b){return b*Math.sin(X.na(a))},Ha:function(a,
b,c,d){return X.ba(X.Ga(Math.atan2(d-b,c-a)))},Ia:function(a,b){var c=X.ba(b)-X.ba(a);180<c?c-=360:-180>=c&&(c=360+c);return c},Ua:function(a){return 0==a?0:0>a?-1:1},Pa: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;m<e+1;m++)g[m]=[],g[m][0]=0;for(var p=0;p<f+1;p++)g[0][p]=0;for(m=1;m<=e;m++)for(p=1;p<=e;p++)c(a[m-1],b[p-1])?g[m][p]=g[m-1][p-1]+1:g[m][p]=Math.max(g[m-1][p],g[m][p-1]);for(var D=[],m=e,p=f;0<m&&0<p;)c(a[m-1],b[p-
1])?(D.unshift(d(m-1,p-1)),m--,p--):g[m-1][p]>g[m][p-1]?m--:p--;return D},s:function(a){return pa(arguments,function(a,c){return a+c})},ua:function(a){return X.s.apply(l,arguments)/arguments.length},Va:function(a){var b=arguments.length;if(2>b)return 0;var c=X.ua.apply(l,arguments),b=X.s.apply(l,oa(arguments,function(a){return Math.pow(a-c,2)}))/(b-1);return Math.sqrt(b)},Na:function(a){return isFinite(a)&&0==a%1},Ma:function(a){return isFinite(a)&&!isNaN(a)},Ta:function(a,b){return Math.floor(a+
(b||2E-15))},Sa:function(a,b){return Math.ceil(a-(b||2E-15))}};function N(a,b){if(!(this instanceof N))return new N(a,b);this.graph={};this.node={};this.adj={};a!=l&&Za(a,this);L(this.graph,b||{});this.edge=this.adj}w("jsnx.classes.Graph",N);w("jsnx.Graph",N);N.__name__="Graph";N.prototype.ya=l;N.prototype.graph=N.prototype.ya;N.prototype.ja=l;N.prototype.node=N.prototype.ja;N.prototype.sa=l;N.prototype.adj=N.prototype.sa;N.prototype.wa=l;N.prototype.edge=N.prototype.wa;
N.prototype.name=function(a){if(s(a))this.graph.name=a.toString();else return this.graph.name||""};N.prototype.name=N.prototype.name;N.prototype.toString=function(){return this.name()};N.prototype.toString=N.prototype.toString;N.prototype.f=function(a){a in this.adj||h({name:"KeyError",message:"Graph does not contain node "+a+"."});return this.adj[a]};N.prototype.get_node=N.prototype.f;
N.prototype.H=function(a,b){b!=l||(b={});"object"!==r(b)&&h(new Q("The attr_dict argument must be an object."));a in this.adj?L(this.node[a],b||{}):(this.adj[a]={},this.node[a]=b||{})};N.prototype.add_node=N.prototype.H;N.prototype.g=function(a,b){var c,d,e,f,g;b!=l||(b={});P(a,function(a){c=!(a in this.adj);da(a)?(d=a[0],e=a[1],d in this.adj?(g=this.node[d],L(g,b,e)):(this.adj[d]={},f=Pa(b),L(f,e),this.node[d]=f)):c?(this.adj[a]={},this.node[a]=Pa(b)):L(this.node[a],b)},this)};
N.prototype.add_nodes_from=N.prototype.g;N.prototype.R=function(a){var b=this.adj,c;a in this.node||h(new Q("The node "+a+" is not in the graph"));c=H(b[a]);I(this.node,a);y(c,function(c){I(b[c],a)});I(b,a)};N.prototype.remove_node=N.prototype.R;N.prototype.W=function(a){var b=this.adj;P(a,function(a){try{I(this.node,a),E(b[a],function(d,f){I(b[f],a)}),I(b,a)}catch(d){}},this)};N.prototype.remove_nodes_from=N.prototype.W;N.prototype.D=function(a){return a?W(this.node):R(H(this.adj))};
N.prototype.nodes_iter=N.prototype.D;N.prototype.nodes=function(a){return C(this.D(a))};N.prototype.nodes=N.prototype.nodes;N.prototype.K=function(){return F(this.adj)};N.prototype.number_of_nodes=N.prototype.K;N.prototype.z=function(){return F(this.adj)};N.prototype.order=N.prototype.z;N.prototype.r=function(a){return!da(a)&&a in this.adj};N.prototype.has_node=N.prototype.r;
N.prototype.a=function(a,b,c){c=c||{};"object"!==r(c)&&h(new Q("The attr_dict argument must be an object."));a in this.adj||(this.adj[a]={},this.node[a]={});b in this.adj||(this.adj[b]={},this.node[b]={});var d=K(this.adj[a],b+"",{});L(d,c);this.adj[a][b]=d;this.adj[b][a]=d};N.prototype.add_edge=N.prototype.a;
N.prototype.b=function(a,b){b=b||{};"object"!==r(b)&&h(new Q("The attr_dict argument must be an object."));P(a,function(a){var d=ob(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 Q("Edge tuple "+a.toString()+" must be a 2-tuple or 3-tuple."));e in this.adj||(this.adj[e]={},this.node[e]={});f in this.adj||(this.adj[f]={},this.node[f]={});a=K(this.adj[e],f,{});L(a,b,g);this.adj[e][f]=a;this.adj[f][e]=a},this)};N.prototype.add_edges_from=N.prototype.b;
N.prototype.ra=function(a,b,c){c=c||{};u(b)||(c=b,b="weight");this.b(S(a,function(a){var c={};c[b]=a[2];s(c[b])||h(new TypeError("Values must consist of three elements: "+Ab(a)));return[a[0],a[1],c]}),c)};N.prototype.add_weighted_edges_from=N.prototype.ra;N.prototype.u=function(a,b){try{I(this.adj[a],b),a!=b&&I(this.adj[b],a)}catch(c){c instanceof TypeError&&h(new Q("The edge "+a+"-"+b+" is not in the graph")),h(c)}};N.prototype.remove_edge=N.prototype.u;
N.prototype.F=function(a){P(a,function(a){var c=a[0];a=a[1];c in this.adj&&a in this.adj[c]&&(I(this.adj[c],a),c!=a&&I(this.adj[a],c))},this)};N.prototype.remove_edges_from=N.prototype.F;N.prototype.U=function(a,b){return a in this.adj&&b in this.adj[a]};N.prototype.has_edge=N.prototype.U;N.prototype.C=function(a){a in this.adj||h(new Q("The node "+a+" is not in the graph."));return O(this.adj[a])};N.prototype.neighbors=N.prototype.C;
N.prototype.P=function(a){a in this.adj||h(new Q("The node "+a+" is not in the graph."));return R(this.adj[a])};N.prototype.neighbors_iter=N.prototype.P;N.prototype.m=function(a,b){return C(this.i(a,b))};N.prototype.edges=N.prototype.m;
N.prototype.i=function(a,b){v(a)&&(b=a,a=l);var c={},d,e;d=a!=l?S(this.d(a),function(a){return[a,this.adj[a]]},this):W(this.adj);return b?U(d,function(a){e=a[0];var b=new A,d=W(a[1]);b.next=function(){try{return d.next()}catch(a){a===z&&(c[e]=1),h(a)}};return b},function(a){if(!(a[0]in c))return[e,a[0],a[1]]}):U(d,function(a){e=a[0];var b=new A,d=R(a[1]);b.next=function(){try{return d.next()}catch(a){a===z&&(c[e]=1),h(a)}};return b},function(a){if(!(a in c))return[e,a]})};N.prototype.edges_iter=N.prototype.i;
N.prototype.$=function(a,b,c){s(c)||(c=l);return a in this.adj?K(this.adj[a],b.toString(),c):c};N.prototype.get_edge_data=N.prototype.$;N.prototype.ta=function(){return O(S(this.o(),function(a){return H(a[1])}))};N.prototype.adjacency_list=N.prototype.ta;N.prototype.o=function(){return W(this.adj)};N.prototype.adjacency_iter=N.prototype.o;N.prototype.p=function(a,b){return a!=l&&this.r(a)?this.q(a,b).next()[1]:lb(C(this.q(a,b)))};N.prototype.degree=N.prototype.p;
N.prototype.q=function(a,b){var c;c=a!=l?S(this.d(a),function(a){return[a,this.adj[a]]},this):W(this.adj);return b?S(c,function(a){var c=a[0];a=a[1];var f=0,g;for(g in a)f+=+K(a[g],b,1);f+=+(c in a&&K(a[c],b,1));return[c,f]}):S(c,function(a){return[a[0],F(a[1])+ +(a[0]in a[1])]})};N.prototype.degree_iter=N.prototype.q;N.prototype.clear=function(){this.name("");Oa(this.adj);Oa(this.node);Oa(this.graph)};N.prototype.clear=N.prototype.clear;N.prototype.copy=function(){return xb(this)};
N.prototype.copy=N.prototype.copy;N.prototype.j=ba(n);N.prototype.is_multigraph=N.prototype.j;N.prototype.c=ba(n);N.prototype.is_directed=N.prototype.c;N.prototype.A=function(){var a=new Y;a.name(this.name());a.g(this);a.b(function(){var a;return U(this.o(),function(c){a=c[0];return W(c[1])},function(c){return[a,c[0],V(c[1])]})}.call(this));a.graph=V(this.graph);a.node=V(this.node);return a};N.prototype.to_directed=N.prototype.A;N.prototype.L=function(){return xb(this)};
N.prototype.to_undirected=N.prototype.L;N.prototype.v=function(a){a=this.d(a);var b=new this.constructor,c=b.adj,d=this.adj;P(a,function(a){var b={};c[a]=b;E(d[a],function(d,m){m in c&&(b[m]=d,c[m][a]=d)})});P(b,function(a){b.node[a]=this.node[a]},this);b.graph=this.graph;return b};N.prototype.subgraph=N.prototype.v;N.prototype.Da=function(){return oa(na(wb(this.adj),function(a){return a[0]in a[1]}),function(a){return a[0]})};N.prototype.nodes_with_selfloops=N.prototype.Da;
N.prototype.S=function(a){return a?oa(na(wb(this.adj),function(a){return a[0]in a[1]}),function(a){var c=a[0];return[c,c,a[1][c]]}):oa(na(wb(this.adj),function(a){return a[0]in a[1]}),function(a){return[a[0],a[0]]})};N.prototype.selfloop_edges=N.prototype.S;N.prototype.Ea=function(){return this.S().length};N.prototype.number_of_selfloops=N.prototype.Ea;N.prototype.size=function(a){var b=X.s.apply(l,Ma(this.p(l,a)))/2;return a!=l?b:Math.floor(b)};N.prototype.size=N.prototype.size;
N.prototype.J=function(a,b){return a==l?Math.floor(this.size()):b in this.adj[a]?1:0};N.prototype.number_of_edges=N.prototype.J;N.prototype.qa=function(a,b){var c=O(a),d=c[0],c=S(xa(c,1),function(a){return[d,a]});this.b(c,b)};N.prototype.add_star=N.prototype.qa;N.prototype.pa=function(a,b){var c=O(a),c=Da(xa(c,0,c.length-1),xa(c,1));this.b(c,b)};N.prototype.add_path=N.prototype.pa;N.prototype.oa=function(a,b){var c=O(a),c=Da(c,ta(xa(c,1),[c[0]]));this.b(c,b)};N.prototype.add_cycle=N.prototype.oa;
N.prototype.d=function(a){return a!=l?this.r(a)?R([a.toString()]):function(a,c){var d=new A,e=U(a,function(a){if(a in c)return a.toString()});d.next=function(){try{return e.next()}catch(a){a instanceof TypeError&&h(new Q("nbunch is not a node or a sequence of nodes")),h(a)}};return d}(a,this.adj):R(this.adj)};N.prototype.nbunch_iter=N.prototype.d;function Y(a,b){if(!(this instanceof Y))return new Y(a,b);this.graph={};this.node={};this.adj={};this.pred={};this.succ=this.adj;a!=l&&Za(a,this);L(this.graph,b||{});this.edge=this.adj}w("jsnx.classes.DiGraph",Y);w("jsnx.DiGraph",Y);la(Y,N);Y.__name__="DiGraph";Y.prototype.H=function(a,b){b!=l||(b={});"object"!==r(b)&&h(new Q("The attr_dict argument must be an object."));a in this.succ?L(this.node[a],b):(this.succ[a]={},this.pred[a]={},this.node[a]=b)};Y.prototype.add_node=Y.prototype.H;
Y.prototype.g=function(a,b){var c,d,e,f,g;b!=l||(b={});P(R(a),function(a){c=!(a in this.succ);da(a)?(d=a[0],e=a[1],d in this.succ?(g=this.node[d],L(g,b,e)):(this.succ[d]={},this.pred[d]={},f=Pa(b),L(f,e),this.node[d]=f)):c?(this.succ[a]={},this.pred[a]={},this.node[a]=Pa(b)):L(this.node[a],b)},this)};Y.prototype.add_nodes_from=Y.prototype.g;
Y.prototype.R=function(a){a in this.node||h(new Q("The node "+a+" is not in the graph"));var b=this.succ[a];I(this.node,a);E(b,function(b,d){I(this.pred[d],a)},this);I(this.succ,a);E(this.pred[a],function(b,d){I(this.succ[d],a)},this);I(this.pred,a)};Y.prototype.remove_node=Y.prototype.R;
Y.prototype.W=function(a){var b;P(a,function(a){a in this.succ&&(b=this.succ[a],I(this.node,a),E(b,function(b,e){I(this.pred[e],a)},this),I(this.succ,a),E(this.pred[a],function(b,e){I(this.succ[e],a)},this),I(this.pred,a))},this)};Y.prototype.remove_nodes_from=Y.prototype.W;
Y.prototype.a=function(a,b,c){c=c||{};"object"!==r(c)&&h(new Q("The attr_dict argument must be an object."));a in this.succ||(this.succ[a]={},this.pred[a]={},this.node[a]={});b in this.succ||(this.succ[b]={},this.pred[b]={},this.node[b]={});var d=K(this.adj[a],""+b,{});L(d,c);this.succ[a][b]=d;this.pred[b][a]=d};Y.prototype.add_edge=Y.prototype.a;
Y.prototype.b=function(a,b){b=b||{};"object"!==r(b)&&h(new Q("The attr_dict argument must be an object."));P(a,function(a){var d=ob(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 Q("Edge tuple "+a.toString()+" must be a 2-tuple or 3-tuple."));e in this.succ||(this.succ[e]={},this.pred[e]={},this.node[e]={});f in this.succ||(this.succ[f]={},this.pred[f]={},this.node[f]={});a=K(this.adj[e],f,{});L(a,b,g);this.succ[e][f]=a;this.pred[f][e]=a},this)};
Y.prototype.add_edges_from=Y.prototype.b;Y.prototype.u=function(a,b){try{I(this.succ[a],b),I(this.pred[b],a)}catch(c){c instanceof TypeError&&h(new Q("The edge "+a+"-"+b+" is not in the graph")),h(c)}};Y.prototype.remove_edge=Y.prototype.u;Y.prototype.F=function(a){P(a,function(a){var c=a[0];a=a[1];c in this.succ&&a in this.succ[c]&&(I(this.succ[c],a),I(this.pred[a],c))},this)};Y.prototype.remove_edges_from=Y.prototype.F;Y.prototype.Aa=function(a,b){return a in this.succ&&b in this.succ[a]};
Y.prototype.has_successor=Y.prototype.Aa;Y.prototype.za=function(a,b){return a in this.pred&&b in this.pred[a]};Y.prototype.has_predecessor=Y.prototype.za;Y.prototype.ca=function(a){a in this.succ||h(new Q("The node "+a+" is not in the digraph."));return R(this.succ[a])};Y.prototype.successors_iter=Y.prototype.ca;Y.prototype.la=function(a){a in this.pred||h(new Q("The node "+a+" is not in the digraph."));return R(this.pred[a])};Y.prototype.predecessors_iter=Y.prototype.la;
Y.prototype.ma=function(a){a in this.succ||h(new Q("The node "+a+" is not in the digraph."));return O(this.succ[a])};Y.prototype.successors=Y.prototype.ma;Y.prototype.Fa=function(a){a in this.succ||h(new Q("The node "+a+" is not in the digraph."));return O(this.pred[a])};Y.prototype.predecessors=Y.prototype.Fa;Y.prototype.C=Y.prototype.ma;Y.prototype.neighbors=Y.prototype.C;Y.prototype.P=Y.prototype.ca;Y.prototype.neighbors_iter=Y.prototype.P;
Y.prototype.i=function(a,b){v(a)&&(b=a,a=l);var c,d,e;c=a!=l?S(this.d(a),function(a){return[a,this.adj[a]]},this):wb(this.adj);return b?U(c,function(a){d=a[0];e=a[1];return W(e)},function(a){return[d,a[0],a[1]]}):U(c,function(a){d=a[0];e=a[1];return W(e)},function(a){return[d,a[0]]})};Y.prototype.edges_iter=Y.prototype.i;Y.prototype.V=Y.prototype.i;Y.prototype.out_edges_iter=Y.prototype.V;Y.prototype.aa=N.prototype.m;Y.prototype.out_edges=Y.prototype.aa;
Y.prototype.O=function(a,b){v(a)&&(b=a,a=l);var c,d;c=a!=l?S(this.d(a),function(a){return[a,this.pred[a]]},this):wb(this.pred);return b?U(c,function(a){d=a[0];return W(a[1])},function(a){return[a[0],d,a[1]]}):U(c,function(a){d=a[0];return W(a[1])},function(a){return[a[0],d]})};Y.prototype.in_edges_iter=Y.prototype.O;Y.prototype.N=function(a,b){return O(this.O(a,b))};Y.prototype.in_edges=Y.prototype.N;
Y.prototype.q=function(a,b){var c;c=a!=l?qb(S(this.d(a),function(a){return[a,this.succ[a]]},this),S(this.d(a),function(a){return[a,this.pred[a]]},this)):qb(W(this.succ),W(this.pred));return u(b)?S(c,function(a){var c=a[0][1],f=a[1][1],g=0,m;for(m in c)g+=+K(c[m],b,1);for(m in f)g+=+K(f[m],b,1);return[a[0][0],g]}):S(c,function(a){return[a[0][0],ob(a[0][1])+ob(a[1][1])]})};Y.prototype.degree_iter=Y.prototype.q;
Y.prototype.M=function(a,b){var c;c=a!=l?S(this.d(a),function(a){return[a,this.pred[a]]},this):W(this.pred);return b!=l?S(c,function(a){var c=0,f=a[1],g;for(g in f)c+=+K(f[g],b,1);return[a[0],c]}):S(c,function(a){return[a[0],F(a[1])]})};Y.prototype.in_degree_iter=Y.prototype.M;
Y.prototype.Q=function(a,b){var c;c=a!=l?S(this.d(a),function(a){return[a,this.succ[a]]},this):W(this.succ);return b!=l?S(c,function(a){var c=0,f=a[1],g;for(g in f)c+=+K(f[g],b,1);return[a[0],c]}):S(c,function(a){return[a[0],F(a[1])]})};Y.prototype.out_degree_iter=Y.prototype.Q;Y.prototype.ga=function(a,b){return a!=l&&this.r(a)?this.M(a,b).next()[1]:lb(this.M(a,b))};Y.prototype.in_degree=Y.prototype.ga;Y.prototype.ka=function(a,b){return a!=l&&this.r(a)?this.Q(a,b).next()[1]:lb(this.Q(a,b))};
Y.prototype.out_degree=Y.prototype.ka;Y.prototype.clear=function(){Oa(this.succ);Oa(this.pred);Oa(this.node);Oa(this.graph)};Y.prototype.clear=Y.prototype.clear;Y.prototype.j=ba(n);Y.prototype.is_multigraph=Y.prototype.j;Y.prototype.c=ba(k);Y.prototype.is_directed=Y.prototype.c;Y.prototype.A=function(){return xb(this)};Y.prototype.to_directed=Y.prototype.A;
Y.prototype.L=function(a){var b=new N;b.name(this.name());b.g(this);var c=this.pred,d;a?b.b(U(this.o(),function(a){d=a[0];return W(a[1])},function(a){if(a[0]in c[d])return[d,a[0],V(a[1])]})):b.b(U(this.o(),function(a){d=a[0];return W(a[1])},function(a){return[d,a[0],V(a[1])]}));b.graph=V(this.graph);b.node=V(this.node);return b};Y.prototype.to_undirected=Y.prototype.L;
Y.prototype.reverse=function(a){(a=!s(a)||a)?(a=new this.constructor(l,{name:"Reverse of ("+this.name()+")"}),a.g(this),a.b(S(this.i(l,k),function(a){return[a[1],a[0],V(a[2])]})),a.graph=V(this.graph),a.node=V(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.v=function(a){a=this.d(a);var b=new this.constructor,c=b.succ,d=b.pred,e=this.succ;P(a,function(a){c[a]={};d[a]={}});P(c,function(a){var b=c[a];E(e[a],function(e,p){p in c&&(b[p]=e,d[p][a]=e)})});P(b,function(a){b.node[a]=this.node[a]},this);b.graph=this.graph;return b};Y.prototype.subgraph=Y.prototype.v;function Gb(a,b){var c=T(a),d,e,f=new A;try{e=[c.next()]}catch(g){return g!==z&&h(g),f}f.next=function(){0===e.length&&h(z);return e.splice(0,1)[0]};return U(f,function(a){d=a;return T(b)},function(){try{var a=c.next();e.push(a);return[d,a]}catch(b){b!==z&&h(b)}})}function Hb(a,b,c){c=Ib(b,c);c.b(Gb(b,a));return c}w("jsnx.generators.classic.full_rary_tree",Hb);w("jsnx.full_rary_tree",Hb);function Jb(a,b,c){b=1===a?2:Math.floor((1-Math.pow(a,b+1))/(1-a));c=Ib(b,c);c.b(Gb(b,a));return c}
w("jsnx.generators.classic.balanced_tree",Jb);w("jsnx.balanced_tree",Jb);function Kb(a,b){var c=Ib(a,b);c.name("complete_graph("+a+")");1<a&&c.b(c.c()?ub(T(a)):tb(T(a)));return c}w("jsnx.generators.classic.complete_graph",Kb);w("jsnx.complete_graph",Kb);function Lb(a,b){var c=Mb(a,b);c.name("cycle_graph("+a+")");1<a&&c.a(a-1,0);return c}w("jsnx.generators.classic.cycle_graph",Lb);w("jsnx.cycle_graph",Lb);
function Ib(a,b){a instanceof N&&(b=a,a=l);a!=l||(a=0);var c;b!=l?(c=b,c.clear()):c=new N;c.g(T(a));c.name("empty_graph("+a+")");return c}w("jsnx.generators.classic.empty_graph",Ib);w("jsnx.empty_graph",Ib);
function Nb(a,b,c,d){var e=Ib(0,d);e.name("grid_2d_graph");d=C(T(a));var f=C(T(b));y(d,function(a){y(f,function(b){e.H([a,b].toString())})});B(T(1,a),function(a){y(f,function(b){e.a([a,b].toString(),[a-1,b].toString())})});y(d,function(a){B(T(1,b),function(b){e.a([a,b].toString(),[a,b-1].toString())})});e.c()&&(B(T(0,a-1),function(a){y(f,function(b){e.a([a,b].toString(),[a+1,b].toString())})}),y(d,function(a){B(T(0,b-1),function(b){e.a([a,b].toString(),[a,b+1].toString())})}));c&&(2<b&&(y(d,function(a){e.a([a,
0].toString(),[a,b-1].toString())}),e.c()&&y(d,function(a){e.a([a,b-1].toString(),[a,0].toString())})),2<a&&(y(f,function(b){e.a([0,b].toString(),[a-1,b].toString())}),e.c()&&y(f,function(b){e.a([a-1,b].toString(),[0,b].toString())})),e.name("periodic_grid_2d_graph("+a+","+b+")"));return e}w("jsnx.generators.classic.grid_2d_graph",Nb);w("jsnx.grid_2d_graph",Nb);function Ob(a){a=Ib(0,a);a.name("null_graph()");return a}w("jsnx.generators.classic.null_graph",Ob);w("jsnx.null_graph",Ob);
function Mb(a,b){var c=Ib(a,b);c.name("path_graph("+a+")");c.b(Ha(T(a-1),function(a){return[a,a+1]}));return c}w("jsnx.generators.classic.path_graph",Mb);w("jsnx.path_graph",Mb);function Pb(a){a=Ib(1,a);a.name("null_graph()");return a}w("jsnx.generators.classic.trivial_graph",Pb);w("jsnx.trivial_graph",Pb);function Qb(a,b,c){c!=l||(c=n);var d=Ib(a);d.name("fast_gnp_random_graph("+a+","+b+")");if(0>=b||1<=b)return Rb(a,b,c);var e=1,f=-1;b=Math.log(1-b);if(c)for(d=new Y(d);e<a;){c=Math.log(1-Math.random());f=f+1+Math.floor(c/b);for(e===f&&(f+=1);f>=a&&e<a;)f-=a,e+=1,e==f&&(f+=1);e<a&&d.a(e,f)}else for(;e<a;){c=Math.log(1-Math.random());for(f=f+1+Math.floor(c/b);f>=e&&e<a;)f-=e,e+=1;e<a&&d.a(e,f)}return d}w("jsnx.generators.random_graphs.fast_gnp_random_graph",Qb);w("jsnx.fast_gnp_random_graph",Qb);
function Rb(a,b,c){var d;d=c?new Y:new N;d.g(T(a));d.name("gnp_random_graph("+a+","+b+")");if(0>=b)return d;if(1<=b)return Kb(a,d);a=d.c()?ub(T(a)):tb(T(a));B(a,function(a){Math.random()<b&&d.a(a[0],a[1])});return d}w("jsnx.generators.random_graphs.gnp_random_graph",Rb);w("jsnx.gnp_random_graph",Rb);w("jsnx.binomial_graph",Rb);w("jsnx.erdos_renyi_graph",Rb);function Sb(a,b){Tb(a)||h(new Q("Invalid degree sequence"));b!=l&&(b.c()&&h(new Q("Directed Graph not supported")),b.j()&&h(new Q("Havel-Hakimi requires simple graph")));var c=a.length,d=Ib(c,b);if(0===c||0===Math.max.apply(l,a))return d;for(c=C(S(d,function(b){return[a[b],b]}));0<c.length;){c.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:+a[1]-+b[1]});if(0>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];g<f;g++)d.a(e[1],c[g][1]),c[g][0]-=1}d.name("havel_hakimi_graph "+
d.z()+" nodes "+d.size()+" edges");return d}w("jsnx.generators.degree_seq.havel_hakimi_graph",Sb);w("jsnx.havel_hakimi_graph",Sb);function Ub(){var a=new N;a.g(T(34));a.name("Zachary's Karate Club");var b=0;y("0 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0;1 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0;1 1 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0;1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1;0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 1;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1;0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1;0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1;0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1;0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1;0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 0".split(";"),
function(c){P(c.split(" "),function(c,e){"1"===c&&a.a(b,e)});b+=1});return a}w("jsnx.generators.social.karate_club_graph",Ub);w("jsnx.karate_club_graph",Ub);
function Vb(){var a=new N;a.g("Evelyn Jefferson;Laura Mandeville;Theresa Anderson;Brenda Rogers;Charlotte McDowd;Frances Anderson;Eleanor Nye;Pearl Oglethorpe;Ruth DeSand;Verne Sanderson;Myra Liddel;Katherina Rogers;Sylvia Avondale;Nora Fayette;Helen Lloyd;Dorothy Murchison;Olivia Carleton;Flora Price".split(";"),{va:0});a.g("E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13 E14".split(" "),{va:1});a.b([["Evelyn Jefferson","E1"],["Evelyn Jefferson","E2"],["Evelyn Jefferson","E3"],["Evelyn Jefferson","E4"],
["Evelyn Jefferson","E5"],["Evelyn Jefferson","E6"],["Evelyn Jefferson","E8"],["Evelyn Jefferson","E9"],["Laura Mandeville","E1"],["Laura Mandeville","E2"],["Laura Mandeville","E3"],["Laura Mandeville","E5"],["Laura Mandeville","E6"],["Laura Mandeville","E7"],["Laura Mandeville","E8"],["Theresa Anderson","E2"],["Theresa Anderson","E3"],["Theresa Anderson","E4"],["Theresa Anderson","E5"],["Theresa Anderson","E6"],["Theresa Anderson","E7"],["Theresa Anderson","E8"],["Theresa Anderson","E9"],["Brenda Rogers",
"E1"],["Brenda Rogers","E3"],["Brenda Rogers","E4"],["Brenda Rogers","E5"],["Brenda Rogers","E6"],["Brenda Rogers","E7"],["Brenda Rogers","E8"],["Charlotte McDowd","E3"],["Charlotte McDowd","E4"],["Charlotte McDowd","E5"],["Charlotte McDowd","E7"],["Frances Anderson","E3"],["Frances Anderson","E5"],["Frances Anderson","E6"],["Frances Anderson","E8"],["Eleanor Nye","E5"],["Eleanor Nye","E6"],["Eleanor Nye","E7"],["Eleanor Nye","E8"],["Pearl Oglethorpe","E6"],["Pearl Oglethorpe","E8"],["Pearl Oglethorpe",
"E9"],["Ruth DeSand","E5"],["Ruth DeSand","E7"],["Ruth DeSand","E8"],["Ruth DeSand","E9"],["Verne Sanderson","E7"],["Verne Sanderson","E8"],["Verne Sanderson","E9"],["Verne Sanderson","E12"],["Myra Liddel","E8"],["Myra Liddel","E9"],["Myra Liddel","E10"],["Myra Liddel","E12"],["Katherina Rogers","E8"],["Katherina Rogers","E9"],["Katherina Rogers","E10"],["Katherina Rogers","E12"],["Katherina Rogers","E13"],["Katherina Rogers","E14"],["Sylvia Avondale","E7"],["Sylvia Avondale","E8"],["Sylvia Avondale",
"E9"],["Sylvia Avondale","E10"],["Sylvia Avondale","E12"],["Sylvia Avondale","E13"],["Sylvia Avondale","E14"],["Nora Fayette","E6"],["Nora Fayette","E7"],["Nora Fayette","E9"],["Nora Fayette","E10"],["Nora Fayette","E11"],["Nora Fayette","E12"],["Nora Fayette","E13"],["Nora Fayette","E14"],["Helen Lloyd","E7"],["Helen Lloyd","E8"],["Helen Lloyd","E10"],["Helen Lloyd","E11"],["Helen Lloyd","E12"],["Dorothy Murchison","E8"],["Dorothy Murchison","E9"],["Olivia Carleton","E9"],["Olivia Carleton","E11"],
["Flora Price","E9"],["Flora Price","E11"]]);return a}w("jsnx.generators.social.davis_southern_women_graph",Vb);w("jsnx.davis_southern_women_graph",Vb);
function Wb(){var a=new N;a.a("Acciaiuoli","Medici");a.a("Castellani","Peruzzi");a.a("Castellani","Strozzi");a.a("Castellani","Barbadori");a.a("Medici","Barbadori");a.a("Medici","Ridolfi");a.a("Medici","Tornabuoni");a.a("Medici","Albizzi");a.a("Medici","Salviati");a.a("Salviati","Pazzi");a.a("Peruzzi","Strozzi");a.a("Peruzzi","Bischeri");a.a("Strozzi","Ridolfi");a.a("Strozzi","Bischeri");a.a("Ridolfi","Tornabuoni");a.a("Tornabuoni","Guadagni");a.a("Albizzi","Ginori");a.a("Albizzi","Guadagni");a.a("Bischeri",
"Guadagni");a.a("Guadagni","Lamberteschi");return a}w("jsnx.generators.social.florentine_families_graph",Wb);w("jsnx.florentine_families_graph",Wb);function Xb(a,b){b!=l&&b.c()&&h(new Q("Directed Graph not supported"));return Yb(a,b)}function Yb(a,b){var c=a[0],d=a[1],e=a[2],f=Ib(e,b),g=f.nodes();if("adjacencylist"==c){var m=a[3];m.length!=e&&h(new Q("invalid graph_description"));P(g,function(a){P(m[a],function(b){f.a(b-1,a)})})}else"edgelist"==c&&P(a[3],function(a){var b=a[0]-1;a=a[1]-1;(0>b||b>e-1||0>a||a>e-1)&&h(new Q("invalid graph_description"));f.a(b,a)});f.name=d;return f}w("jsnx.generators.small.make_small_graph",Yb);
w("jsnx.make_small_graph",Yb);function Zb(a){return Xb(["adjacencylist","Bull Graph",5,[[2,3],[1,3,4],[1,2,5],[2],[3]]],a)}w("jsnx.generators.small.bull_graph",Zb);w("jsnx.bull_graph",Zb);function $b(a){return Xb(["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",$b);w("jsnx.krackhardt_kite_graph",$b);function ac(a,b){a.c()&&h(new Q("triangles() is not defined for directed graphs."));if(b!=l&&a.r(b))return Math.floor(bc(a,b).next()[2]/2);var c={};B(bc(a,b),function(a){c[a[0]]=Math.floor(a[2]/2)});return c}w("jsnx.algorithms.cluster.triangles",ac);w("jsnx.triangles",ac);
function bc(a,b){a.j()&&h(new Q("Not defined for multigraphs."));var c;c=b!=l?U(a.d(b),function(b){return[b,a.f(b)]}):W(a.adj);return Ha(c,function(b){var c=new M(H(b[1])),f=0;c.remove(b[0]);B(c,function(b){var d=new M(H(a.f(b)));d.remove(b);f+=Wa(c,d).e()});return[b[0],c.e(),f]})}
function cc(a,b,c){a.j()&&h(new Q("Not defined for multigraphs."));u(c)||(c="weight");var d;d=0===a.m().length?1:sb(a.m(k),function(a){return K(a[2],c,1)});b=b!=l?U(a.d(b),function(b){return[b,a.f(b)]}):W(a.adj);return Ha(b,function(b){var f=b[0],g=new M(H(b[1]));g.remove(f);var m=0,p=new M;B(g,function(b){var e=K(a.f(f)[b],c,1)/d;p.add(b);var J=Xa(new M(H(a.f(b))),p);B(Wa(g,J),function(g){var p=K(a.f(b)[g],c,1)/d;g=K(a.f(f)[g],c,1)/d;m+=Math.pow(e*p*g,1/3)})});return[f,g.e(),2*m]})}
function dc(a,b,c,d){2===arguments.length?u(b)?(c=b,b=l):v(b)&&(d=b,b=l):3===arguments.length&&v(c)&&(d=c,c=l);d!=l||(d=k);var e=Ma(fc(a,b,c));d||(e=na(e,function(a){return 0<a}));return X.s.apply(X,e)/e.length}w("jsnx.algorithms.cluster.average_clustering",dc);w("jsnx.average_clustering",dc);
function fc(a,b,c){a.c()&&h(new Q("Clustering algorithms are not defined for directed graphs."));c=c!=l?cc(a,b,c):bc(a,b);var d={};B(c,function(a){d[a[0]]=0===a[2]?0:a[2]/(a[1]*(a[1]-1))});return b!=l&&a.r(b)?Ma(d)[0]:d}w("jsnx.algorithms.cluster.clustering",fc);w("jsnx.clustering",fc);function gc(a){var b=0,c=0;B(bc(a),function(a){c+=a[1]*(a[1]-1);b+=a[2]});return 0===b?0:b/c}w("jsnx.algorithms.cluster.transitivity",gc);w("jsnx.transitivity",gc);
function hc(a,b){var c=b==l?R(a):a.d(b),d={};B(c,function(b){var c=d[b]=0;B(tb(H(a.f(b))),function(g){var m=g[0];g=g[1];var p=Wa(new M(H(a.f(m))),H(a.f(g)));p.remove(b);p=p.e();d[b]+=p;var D=p+1,G=a.f(m);g in G&&(D+=1);c+=(F(a.f(m))-D)*(F(a.f(g))-D)+p});0<c&&(d[b]/=c)});return b!=l&&a.r(b)?Ma(d)[0]:d}w("jsnx.algorithms.cluster.square_clustering",hc);w("jsnx.square_clustering",hc);function ic(a){var b=-1,c={},d=new M;B(a.o(),function(a){var e=new M(H(a[1]));e.remove(a[0]);var f=e.e();f>b?(c[a[0]]=d=e,b=f):c[a[0]]=e});var e=new M(H(c)),f=Xa(e,d),g=new M,m=[],p=[];a=new A;a.next=function(){0===f.e()&&0===m.length&&h(z);var a,G;if(0<f.e())a=Fa(f).next(),f.remove(a);else{var J=m.pop();e=J[0];g=J[1];f=J[2];p.pop();return this.next()}p.push(a);e.remove(a);g.add(a);var va=c[a],J=Wa(e,va),va=Wa(g,va);if(0===J.e()&&(0===va.e()&&(G=ua(p)),p.pop(),G))return G;if(0===va.e()&&1===J.e())return G=
ta(p,J.t()),p.pop(),G;var rb=J.e(),Ga=-1,ec,Aa;for(G=Fa(va);(a=Ja(G,l))!==l&&!(a=Wa(J,c[a]),Aa=a.e(),Aa>Ga&&(ec=a,Ga=Aa,Ga===rb)););if(Ga===rb)return p.pop(),this.next();b=-1;for(G=Fa(J);(a=Ja(G,l))!==l&&!(a=Wa(J,c[a]),Aa=a.e(),Aa>b&&(d=a,b=Aa,b===rb-1)););Ga>b&&(d=ec);m.push([e,g,f]);e=J;g=va;f=Xa(e,d);return this.next()};return a}w("jsnx.algorithms.clique.find_cliques",ic);w("jsnx.find_cliques",ic);
function jc(a){var b={};B(a.o(),function(a){var c=new M(H(a[1]));c.remove(a[0]);b[a[0]]=c});if(Na(b))return[];a=new M(H(b));var c=new M,d=[];kc(b,a,c,[],d);return d}w("jsnx.algorithms.clique.find_cliques_recursive",jc);w("jsnx.find_cliques_recursive",jc);
function kc(a,b,c,d,e){var f=-1,g=b.e(),m,p,D,G;for(p=Fa(c);(D=Ja(p,l))!==l;)if(D=Wa(b,a[D]),G=D.e(),G>f&&(m=D,f=G,G===g))return;B(b,function(c){c=Wa(b,a[c]);var d=c.e();d>f&&(m=c,f=d)});g=Xa(b,m);B(g,function(f){b.remove(f);d.push(f);var g=a[f];f=Wa(b,g);g=Wa(c,g);f.B()&&g.B()?e.push(ua(d)):g.B()&&1===f.e()?e.push(ta(d,f.t())):kc(a,f,g,d,e);c.add(d.pop())})}function lc(a,b){b!=l||(b=ic(a));var c=0;P(b,function(a){c=a.length>c?a.length:c});return c}w("jsnx.algorithms.clique.graph_clique_number",lc);
w("jsnx.graph_clique_number",lc);function mc(a,b){b!=l||(b=ic(a));return O(b).length}w("jsnx.algorithms.clique.graph_number_of_cliques",mc);w("jsnx.graph_number_of_cliques",mc);function nc(a,b,c){c=c!=l?C(c):C(ic(a));b!=l||(b=a.nodes());var d;if(da(b))d={},y(b,function(a){d[a]=na(c,function(b){return 0<=ma(b,a)||0<=ma(b,a+"")}).length});else{var e=b;d=na(c,function(a){return 0<=ma(a,e)||0<=ma(a,e+"")}).length}return d}w("jsnx.algorithms.clique.number_of_cliques",nc);w("jsnx.number_of_cliques",nc);function oc(a,b){if(a.z()!=b.z())return n;var c,d=a.p(),e=ac(a),f=nc(a),g=[];for(c in d)g.push([d[c],e[c],f[c]]);g.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 d=b.p(),e=ac(b),f=nc(b),m=[];for(c in d)m.push([d[c],e[c],f[c]]);m.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!ya(g,m,function(a,b){return ya(a,b)})?n:k}w("jsnx.algorithms.isomorphism.could_be_isomorphic",oc);w("jsnx.could_be_isomorphic",oc);
function pc(a,b){if(a.z()!=b.z())return n;var c,d=a.p(),e=ac(a),f=[];for(c in d)f.push([d[c],e[c]]);f.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]-b[1]});var d=b.p(),e=ac(b),g=[];for(c in d)g.push([d[c],e[c]]);g.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]-b[1]});return!ya(f,g,function(a,b){return ya(a,b)})?n:k}w("jsnx.algorithms.isomorphism.fast_could_be_isomorphic",pc);w("jsnx.fast_could_be_isomorphic",pc);
function qc(a,b){if(a.z()!=b.z())return n;var c=Ma(a.p());c.sort();var d=Ma(b.p());d.sort();return!ya(c,d)?n:k}w("jsnx.algorithms.isomorphism.faster_could_be_isomorphic",qc);w("jsnx.faster_could_be_isomorphic",qc);function rc(){}rc.fa=function(){return rc.ha?rc.ha:rc.ha=new rc};rc.prototype.Ca=0;rc.fa();function sc(a){if(!t(a))return n;for(var b=0,c=a.length;b<c;b++)if(window.isNaN(a[b]))return n;return k}w("jsnx.utils.misc.is_list_of_ints",sc);w("jsnx.utils.is_list_of_ints",sc);function tc(a){var b=0;return Ha(a,function(a){return b+=a})}w("jsnx.utils.misc.cumulative_sum",tc);w("jsnx.utils.cumulative_sum",tc);function uc(){return":"+(rc.fa().Ca++).toString(36)}w("jsnx.utils.misc.generate_unique_node",uc);w("jsnx.utils.generate_unique_node",uc);function Tb(a,b){if("eg"===b)return vc(a);if(b==l||"hh"===b)return wc(a);h(new fb("`opt_method` must be 'eg' or 'hh'"))}w("jsnx.algorithms.graphical.is_valid_degree_sequence",Tb);w("jsnx.is_valid_degree_sequence",Tb);function wc(a){if(0===a.length)return k;if(!sc(a)||0>Math.min.apply(l,a)||0!==X.s.apply(l,a)%2)return n;for(a=ua(a);0<a.length;){x.sort.call(a,Ba);if(0>a[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",wc);w("jsnx.is_valid_degree_sequence_havel_hakimi",wc);
function vc(a){if(0===a.length)return k;if(!sc(a)||0>Math.min.apply(l,a)||0!==X.s.apply(l,a)%2)return n;var b=a.length,c=ua(a).sort(function(a,b){return b-a}),d=[],e;e=1;for(a=c.length;e<a;e++)c[e]<c[e-1]&&d.push(e);var f,g;e=0;for(a=d.length;e<a;e++)if(f=X.s.apply(l,c.slice(0,d[e])),g=d[e]*(d[e]-1)+X.s.apply(l,C(Ha(T(d[e],b),function(a){return Math.min(d[e],c[a])}))),f>g)return n;return k}w("jsnx.algorithms.graphical.is_valid_degree_sequence_erdos_gallai",vc);
w("jsnx.is_valid_degree_sequence_erdos_gallai",vc);function xc(a){try{return yc(a),k}catch(b){if(b instanceof ib)return n;h(b)}}w("jsnx.algorithms.dag.is_directed_acyclic_graph",xc);w("jsnx.is_directed_acyclic_graph",xc);
function yc(a,b){a.c()||h(new Q("Topological sort not defined on undirected graphs."));var c={},d=[],e={};b!=l||(b=a.D());P(b,function(b){if(!(b in e))for(b=[b];0<b.length;){var g=b[b.length-1];if(g in e)b.pop();else{c[g]=k;var m=[];E(a.f(g),function(a,b){b in e||(b in c&&h(new ib("Graph contains a cycle")),m.push(b))});0<m.length?b.push.apply(b,m):(e[g]=k,wa(d,aa,0,g.toString()))}}});return d}w("jsnx.algorithms.dag.topological_sort",yc);w("jsnx.topological_sort",yc);
function zc(a,b){function c(a,b,d,e){b.add(e);E(a.f(e),function(e,p){if(b.contains(p))b.contains(p)&&!(0<=ma(d,p))&&h(new ib("Graph contains a cycle"));else if(!c(a,b,d,p))return n});wa(d,aa,0,e.toString());return k}a.c()||h(new Q("Topological sort not defined on undirected graphs."));var d=new M,e=[];b!=l||(b=a.D());P(b,function(b){!(0<=ma(e,b))&&!c(a,d,e,b)&&h(new ib("Graph contains a cycle"))});return e}w("jsnx.algorithms.dag.topological_sort_recursive",zc);
w("jsnx.topological_sort_recursive",zc);var Bc=function Ac(b){b.c()||h(new Q("is_aperiodic not defined for undirected graphs."));var c=b.D().next(),d={};d[c]=0;for(var c=[c],e=0,f=1;0<c.length;){var g=[];y(c,function(c){E(b.f(c),function(b,D){D in d?e=zb(e,d[c]-d[D]+1):(g.push(D),d[D]=f)})});c=g;f+=1}return ob(d)===ob(b)?1===e:1===e&&Ac(b.v(Xa(new M(b.nodes()),H(d))))};w("jsnx.algorithms.dag.is_aperiodic",Bc);w("jsnx.is_aperiodic",Bc);function Cc(a,b){this.ia=a;this.da=b}Cc.prototype.getKey=function(){return this.ia};Cc.prototype.I=function(){return new Cc(this.ia,this.da)};function Dc(a){this.n=[];if(a)a:{var b,c;if(a instanceof Dc){if(b=a.Z(),c=a.t(),0>=a.e()){a=this.n;for(var d=0;d<b.length;d++)a.push(new Cc(b[d],c[d]));break a}}else b=H(a),c=Ma(a);for(d=0;d<b.length;d++)Ec(this,b[d],c[d])}}function Ec(a,b,c){var d=a.n;d.push(new Cc(b,c));b=d.length-1;a=a.n;for(c=a[b];0<b;)if(d=b-1>>1,a[d].getKey()>c.getKey())a[b]=a[d],b=d;else break;a[b]=c}q=Dc.prototype;
q.remove=function(){var a=this.n,b=a.length,c=a[0];if(!(0>=b)){if(1==b)sa(a);else{a[0]=a.pop();for(var a=0,b=this.n,d=b.length,e=b[a];a<d>>1;){var f=2*a+1,g=2*a+2,f=g<d&&b[g].getKey()<b[f].getKey()?g:f;if(b[f].getKey()>e.getKey())break;b[a]=b[f];a=f}b[a]=e}return c.da}};q.t=function(){for(var a=this.n,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].da);return b};q.Z=function(){for(var a=this.n,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].getKey());return b};
q.ea=function(a){return qa(this.n,function(b){return b.getKey()==a})};q.I=function(){return new Dc(this)};q.e=function(){return this.n.length};q.B=function(){return 0==this.n.length};q.clear=function(){sa(this.n)};function Fc(){Dc.call(this)}la(Fc,Dc);function Gc(a,b){Ec(a,0,b)};function Hc(a,b){b!=l||(b={});"object"!==r(b)&&h(new Q("The arg_dict argument must be an object."));var c=mb(a),d=a.nodes();"k"in b&&(Ea(d),d=d.slice(0,b.k));P(d.sort(),function(d){var f=[],f=K(b,"weight",l)===l?Ic(a,d):Jc(a,d,b.weight),g=f[0],m=f[1],f=f[2];c=K(b,"endpoints",n)?Kc(c,g,m,f,d):Lc(c,g,m,f,d)});return c=Mc(c,ob(a),K(b,"normalized",k),a.c(),K(b,"k",l))}w("jsnx.algorithms.centrality.betweenness.betweenness_centrality",Hc);w("jsnx.betweenness_centrality",Hc);
function Nc(a,b){b!=l||(b={});"object"!==r(b)&&h(new Q("The arg_dict argument must be an object."));var c=mb(a);vb(c,mb(a.m()));var d=a.nodes();P(d.sort(),function(d){var f=[],f=K(b,"weight",l)===l?Ic(a,d):Jc(a,d,b.weight);c=Oc(c,f[0],f[1],f[2],d)});P(d.sort(),function(a){delete c[a]});return c=Pc(c,ob(a),K(b,"normalized",k),a.c())}w("jsnx.algorithms.centrality.betweenness.edge_betweenness_centrality",Nc);w("jsnx.edge_betweenness_centrality",Nc);
function Ic(a,b){var c=[],d={};P(a.nodes(),function(a){d[a]=[]});var e=mb(a),f={};e[b]=1;f[b]=0;for(var g=[b];0<g.length;){var m=g.shift();c.push(m);var p=f[m],D=e[m];P(a.C(m),function(a){a in f||(g.push(a),f[a]=p+1);f[a]==p+1&&(e[a]+=D,d[a].push(m))})}return[c,d,e]}
function Jc(a,b,c){var d=[],e={};P(a.nodes(),function(a){e[a]=[]});var f=mb(a),g={};f[b]=1;var m={};m[b]=0;var p=new Fc;for(Gc(p,[b,b]);!p.B();){var D=p.n[0]&&p.n[0].getKey();b=p.remove();var G=b[0],J=b[1];J in g||(f[J]+=f[G],d.push(J),g[J]=D,P(a.i(J,k),function(a){var b=a[1];a=D+K(a[2],c,1);!(b in g)&&(!(b in m)||a<m[b])?(m[b]=a,Ec(p,a,[J,b]),f[b]=0,e[b]=[J]):a==m[b]&&(f[b]+=f[J],e[b].push(J))}))}return[d,e,f]}
function Lc(a,b,c,d,e){for(var f=mb(b);0<b.length;){var g=b.pop(),m=(1+f[g])/d[g];P(c[g],function(a){f[a]+=d[a]*m});g!=e&&(a[g]+=f[g])}return a}function Kc(a,b,c,d,e){a[e]+=b.length-1;for(var f=mb(b);0<b.length;){var g=b.pop(),m=(1+f[g])/d[g];P(c[g],function(a){f[a]+=d[a]*m});g!=e&&(a[g]+=f[g]+1)}return a}function Oc(a,b,c,d,e){for(var f=mb(b);0<b.length;){var g=b.pop(),m=(1+f[g])/d[g];P(c[g],function(b){var c=d[b]*m;[b,g]in a?a[[b,g]]+=c:a[[g,b]]+=c;f[b]+=c});g!=e&&(a[g]+=f[g])}return a}
function Mc(a,b,c,d,e){var f;v(c)&&c?2<b&&(f=1/((b-1)*(b-2))):v(d)&&!d&&(f=0.5);if(s(f)){e!=l&&(f=f*b/e);for(var g in a)a[g]*=f}return a}function Pc(a,b,c,d){var e;v(c)&&c?1<b&&(e=1/(b*(b-1))):v(d)&&!d&&(e=0.5);if(s(e))for(var f in a)a[f]*=e;return a};function Qc(a,b,c){var d={},e=0,f={};for(f[b]=1;0<F(f);){b=f;f={};E(b,function(b,c){c in d||(d[c]=e,L(f,a.f(c)))});if(ea(c)&&c<=e)break;e+=1}return d}w("jsnx.algorithms.shortest_paths.unweighted.single_source_shortest_path_length",Qc);w("jsnx.single_source_shortest_path_length",Qc);function Rc(a,b){var c={};P(a,function(d){c[d]=Qc(a,d,b)});return c}w("jsnx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path_length",Rc);w("jsnx.all_pairs_shortest_path_length",Rc);
function Sc(a,b,c){b=b.toString();c=c.toString();c=Tc(a,b,c);a=c[0];b=c[1];c=c[2];for(var d=[];c!=l;)d.push(c),c=b[c];for(c=a[d[0]];c!=l;)d.unshift(c),c=a[c];return d}w("jsnx.algorithms.shortest_paths.unweighted.bidirectional_shortest_path",Sc);w("jsnx.bidirectional_shortest_path",Sc);
function Tc(a,b,c){(!s(b)||!s(c))&&h(new fb("Bidirectional shortest path called without source or target"));var d={},e={};if(c===b)return d[c]=l,e[b]=l,[d,e,b];var f,g;a.c()?(f=a.la,g=a.ca):g=f=a.P;d[b]=l;e[c]=l;for(var m=[b],p=[c],D,G;0<m.length&&0<p.length&&!G;)m.length<=p.length?(D=m,m=[],y(D,function(b){G||B(g.call(a,b),function(a){G||(a in d||(m.push(a),d[a]=b),a in e&&(G=[d,e,a]))})})):(D=p,p=[],y(D,function(b){G||B(f.call(a,b),function(a){G||(a in e||(e[a]=b,p.push(a)),a in d&&(G=[d,e,a]))})}));
if(G)return G;h(new jb("No path between "+b+" and "+c+"."))}function Uc(a,b,c){b=b.toString();var d=0,e={};e[b]=1;var f={};f[b]=[b];if(0===c)return f;for(;0<F(e)&&!(b=e,e={},E(b,function(b,c){E(a.f(c),function(a,b){b in f||(f[b]=f[c].concat([b]),e[b]=1)})}),d+=1,s(c)&&c<=d););return f}w("jsnx.algorithms.shortest_paths.unweighted.single_source_shortest_path",Uc);w("jsnx.single_source_shortest_path",Uc);function Vc(a,b){var c={};P(a,function(d){c[d]=Uc(a,d,b)});return c}
w("jsnx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path",Vc);w("jsnx.all_pairs_shortest_path",Vc);function Wc(a,b,c,d,e){b=b.toString();var f=0,g=[b],m={};m[b]=f;var p={};for(p[b]=[];0<g.length&&!(f+=1,b=g,g=[],y(b,function(b){E(a.f(b),function(a,c){c in m?m[c]===f&&p[c].push(b):(p[c]=[b],m[c]=f,g.push(c))})}),d!=l&&d<=f););return c!=l?(c=c.toString(),e?!(c in p)?[[],-1]:[p[c],m[c]]:!(c in p)?[]:p[c]):e?[p,m]:p}w("jsnx.algorithms.shortest_paths.unweighted.predecessor",Wc);
w("jsnx.predecessor",Wc);function Xc(a,b,c){var d=b;"function"==r(b)&&(d={},B(a.D(),function(a){d[a]=b(a)}));return!s(c)||c?Yc(a,d):Zc(a,d)}w("jsnx.relabel.relabel_nodes",Xc);w("jsnx.relabel_nodes",Xc);
function Zc(a,b){var c=new M(H(b)),d;if(0<Wa(c,b).e()){c=new Y(wb(b));c.F(c.S());try{d=yc(c)}catch(e){e instanceof ib&&h(new ib("The node label sets are overlapping and no ordering can resolve the mapping. Use copy=True."))}d.reverse()}else d=c;var f=a.j(),g=a.c(),m;B(d,function(c){var d;c in b&&(d=b[c],a.r(c)||h(new Q("Node "+c+" is not in the graph.")),a.H(d,a.node[c]),f?(m=oa(a.m(c,k,k),function(a){return[d,a[1],a[2],a[3]]}),g&&(m=ta(m,oa(a.N(c,k,k),function(a){return[a[0],d,a[2],a[3]]})))):(m=
oa(a.m(c,k),function(a){return[d,a[1],a[2]]}),g&&(m=ta(m,oa(a.N(c,k),function(a){return[a[0],d,a[2]]})))),a.R(c),a.b(m))});return a}
function Yc(a,b){var c=new a.constructor;c.name("("+a.name()+")");a.j()?c.b(Ha(a.i(l,k,k),function(a){return[K(b,a[0],a[0]),K(b,a[1],a[1]),a[2],Pa(a[3])]})):c.b(Ha(a.i(l,k),function(a){return[K(b,a[0],a[0]),K(b,a[1],a[1]),Pa(a[2])]}));c.g(Ha(R(a),function(a){return K(b,a,a)}));var d={},e;for(e in a.node)d[K(b,e,e)]=Pa(a.node[e]);L(c.node,d);L(c.graph,Pa(a.graph));return c}
function $c(a,b,c,d){3===arguments.length&&v(c)?(d=c,c=l):2===arguments.length&&(v(b)?(d=b,b=l):u(b)&&(c=b,b=l));b!=l||(b=0);c!=l||(c="default");d!=l||(d=k);var e={},f,g,m,p;if("default"===c){f=a.nodes();g=0;m=b;for(p=f.length;g<p;g++,m++)e[f[g]]=m}else if("sorted"===c){f=a.nodes();f.sort();g=0;m=b;for(p=f.length;g<p;g++,m++)e[f[g]]=m}else if("increasing degree"===c){f=C(a.q());f.sort(function(a,b){return a[1]-b[1]});g=0;m=b;for(p=f.length;g<p;g++,m++)e[f[g][0]]=m}else if("decreasing degree"===c){f=
C(a.q());f.sort(function(a,b){return b[1]-a[1]});g=0;m=b;for(p=f.length;g<p;g++,m++)e[f[g][0]]=m}else h(new Q("Unkown node ordering: "+c));g=Xc(a,e);g.name("("+a.name()+")_with_int_labels");d||(g.node_labels=e);return g}w("jsnx.relabel.convert_node_labels_to_integers",$c);w("jsnx.convert_node_labels_to_integers",$c);function Z(a,b){if(!(this instanceof Z))return new Z(a,b);N.call(this,a,b)}la(Z,N);w("jsnx.classes.MultiGraph",Z);w("jsnx.MultiGraph",Z);Z.__name__="MultiGraph";
Z.prototype.a=function(a,b,c,d){var e,f;c!=l&&(!u(c)&&!ea(c))&&(d=c,c=l);d=d||{};"object"!==r(d)&&h(new Q("The attr_dict argument must be an object."));a in this.adj||(this.adj[a]={},this.node[a]={});b in this.adj||(this.adj[b]={},this.node[b]={});if(b in this.adj[a]){f=this.adj[a][b];if(c==l)for(c=F(f);c in f;)c+=1;e=K(f,""+c,{});L(e,d);f[c]=e}else c!=l||(c=0),e={},L(e,d),f=Ra(c,e),this.adj[a][b]=f,this.adj[b][a]=f};Z.prototype.add_edge=Z.prototype.a;
Z.prototype.b=function(a,b){b=b||{};"object"!==r(b)&&h(new Q("The attr_dict argument must be an object."));P(a,function(a){var d=ob(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 Q("Edge tuple "+Ab(a)+" must be a 2-tuple, 3-tuple or 4-tuple."));a=e in this.adj?K(this.adj[e],f,{}):{};if(g==l)for(g=F(a);g in a;)g+=1;a=K(a,g,{});L(a,b,m);this.a(e,f,g,a)},this)};Z.prototype.add_edges_from=Z.prototype.b;
Z.prototype.u=function(a,b,c){(!(a in this.adj)||!(b in this.adj[a]))&&h(new Q("The edge "+a+"-"+b+" is not in the graph"));var d=this.adj[a][b];c!=l?(c in d||h(new Q("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),I(d,c)):I(d,La(d));0===F(d)&&(I(this.adj[a],b),a!=b&&I(this.adj[b],a))};Z.prototype.remove_edge=Z.prototype.u;Z.prototype.F=function(a){P(a,function(a){try{this.u(a[0],a[1],a[2])}catch(c){c instanceof Q||h(c)}},this)};Z.prototype.remove_edges_from=Z.prototype.F;
Z.prototype.U=function(a,b,c){return c!=l?a in this.adj&&b in this.adj[a]&&c in this.adj[a][b]:a in this.adj&&b in this.adj[a]};Z.prototype.has_edge=Z.prototype.U;Z.prototype.m=function(a,b,c){return C(this.i(a,b,c))};Z.prototype.edges=Z.prototype.m;
Z.prototype.i=function(a,b,c){v(a)&&(v(b)&&(c=b),b=a,a=l);var d={},e,f;a=a!=l?S(this.d(a),function(a){return[a,this.adj[a]]},this):W(this.adj);return b?U(a,function(a){e=a[0];var b=new A,c=W(a[1]);b.next=function(){try{return c.next()}catch(a){a===z&&(d[e]=1),h(a)}};return b},function(a){f=a[0];if(!(f in d))return W(a[1])},function(a){return c?[e,f,a[0],a[1]]:[e,f,a[1]]}):U(a,function(a){e=a[0];var b=new A,c=W(a[1]);b.next=function(){try{return c.next()}catch(a){a===z&&(d[e]=1),h(a)}};return b},function(a){f=
a[0];if(!(f in d))return W(a[1])},function(a){return c?[e,f,a[0]]:[e,f]})};Z.prototype.edges_iter=Z.prototype.i;Z.prototype.$=function(a,b,c,d){s(d)||(d=l);return a in this.adj&&b in this.adj[a]?c!=l?K(this.adj[a][b],""+c,d):this.adj[a][b]:d};Z.prototype.get_edge_data=Z.prototype.$;
Z.prototype.q=function(a,b){var c;c=a!=l?S(this.d(a),function(a){return[a,this.adj[a]]},this):W(this.adj);return b!=l?Ha(c,function(a){var c=a[0];a=a[1];var f=0;E(a,function(a){E(a,function(a){f+=K(a,b,1)})});c in a&&E(a[c],function(a){f+=K(a,b,1)});return[c,f]}):Ha(c,function(a){var b=a[0];a=a[1];var c=0;E(a,function(a){c+=F(a)});return[b,c+ +(b in a&&F(a[b]))]})};Z.prototype.degree_iter=Z.prototype.q;Z.prototype.j=ba(k);Z.prototype.is_multigraph=Z.prototype.j;Z.prototype.c=ba(n);
Z.prototype.is_directed=Z.prototype.c;Z.prototype.A=function(){var a=new $;a.g(this);a.b(function(){var a,c;return U(this.o(),function(c){a=c[0];return W(c[1])},function(a){c=a[0];return W(a[1])},function(d){return[a,c,d[0],V(d[1])]})}.call(this));a.graph=V(this.graph);a.node=V(this.node);return a};Z.prototype.to_directed=Z.prototype.A;
Z.prototype.S=function(a,b){var c=[];a?b?E(this.adj,function(a,b){b in a&&E(a[b],function(a,d){c.push([b,b,d,a])})}):E(this.adj,function(a,b){b in a&&E(a[b],function(a){c.push([b,b,a])})}):b?E(this.adj,function(a,b){b in a&&E(a[b],function(a,d){c.push([b,b,d])})}):E(this.adj,function(a,b){b in a&&E(a[b],function(){c.push([b,b])})});return c};Z.prototype.selfloop_edges=Z.prototype.S;Z.prototype.J=function(a,b){return a==l?this.size():a in this.adj&&b in this.adj[a]?F(this.adj[a][b]):0};
Z.prototype.number_of_edges=Z.prototype.J;Z.prototype.v=function(a){a=this.d(a);var b=new this.constructor,c=b.adj,d=this.adj;B(a,function(a){var b={};c[a]=b;E(d[a],function(d,m){if(m in c){var p=Pa(d);b[m]=p;c[m][a]=p}})});E(this.node,function(a,c){b.node[c]=a});b.graph=this.graph;return b};Z.prototype.subgraph=Z.prototype.v;function $(a,b){if(!(this instanceof $))return new $(a,b);Y.call(this,a,b)}la($,Y);var ad=$.prototype,bd=Z.prototype,cd;for(cd in bd)bd.hasOwnProperty(cd)&&"constructor"!==cd&&(ad[cd]=bd[cd]);w("jsnx.classes.MultiDiGraph",$);w("jsnx.MultiDiGraph",$);$.__name__="MultiDiGraph";
$.prototype.a=function(a,b,c,d){var e,f;c!=l&&(!u(c)&&!ea(c))&&(d=c,c=l);d=d||{};"object"!==r(d)&&h(new Q("The attr_dict argument must be an object."));a in this.succ||(this.succ[a]={},this.pred[a]={},this.node[a]={});b in this.succ||(this.succ[b]={},this.pred[b]={},this.node[b]={});if(b in this.succ[a]){f=this.adj[a][b];if(c==l)for(c=F(f);c in f;)c+=1;e=K(f,c.toString(),{});L(e,d);f[c]=e}else c!=l||(c=0),e={},L(e,d),f=Ra(c,e),this.succ[a][b]=f,this.pred[b][a]=f};$.prototype.add_edge=$.prototype.a;
$.prototype.u=function(a,b,c){(!(a in this.adj)||!(b in this.adj[a]))&&h(new Q("The edge "+a+"-"+b+" is not in the graph"));var d=this.adj[a][b];c!=l?(c in d||h(new Q("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),I(d,c)):I(d,La(d));0===F(d)&&(I(this.succ[a],b),I(this.pred[b],a))};$.prototype.remove_edge=$.prototype.u;
$.prototype.i=function(a,b,c){v(a)&&(v(b)&&(c=b),b=a,a=l);var d,e;a=a!=l?S(this.d(a),function(a){return[a,this.adj[a]]},this):wb(this.adj);return b?U(a,function(a){d=a[0];return W(a[1])},function(a){e=a[0];return W(a[1])},function(a){return c?[d,e,a[0],a[1]]:[d,e,a[1]]}):U(a,function(a){d=a[0];return W(a[1])},function(a){e=a[0];return W(a[1])},function(a){return c?[d,e,a[0]]:[d,e]})};$.prototype.edges_iter=$.prototype.i;$.prototype.V=$.prototype.i;$.prototype.out_edges_iter=$.prototype.V;
$.prototype.aa=function(a,b,c){return C(this.V(a,b,c))};$.prototype.out_edges=$.prototype.aa;$.prototype.O=function(a,b,c){v(a)&&(b=a,a=l);var d,e;a=a!=l?S(this.d(a),function(a){return[a,this.pred[a]]},this):wb(this.pred);return b?U(a,function(a){d=a[0];return W(a[1])},function(a){e=a[0];return W(a[1])},function(a){return c?[e,d,a[0],a[1]]:[e,d,a[1]]}):U(a,function(a){d=a[0];return W(a[1])},function(a){e=a[0];return W(a[1])},function(a){return c?[e,d,a[0]]:[e,d]})};$.prototype.in_edges_iter=$.prototype.O;
$.prototype.N=function(a,b,c){return C(this.O(a,b,c))};$.prototype.in_edges=$.prototype.N;
$.prototype.q=function(a,b){var c;c=a!=l?qb(Ha(this.d(a),function(a){return[a,this.succ[a]]},this),Ha(this.d(a),function(a){return[a,this.pred[a]]},this)):qb(W(this.succ),W(this.pred));return b!=l?S(c,function(a){var c=a[0][1],f=0;E(a[1][1],function(a){E(a,function(a){f+=+K(a,b,1)})});E(c,function(a){E(a,function(a){f+=+K(a,b,1)})});return[a[0][0],f]}):S(c,function(a){var b=0,c=0;E(a[1][1],function(a){b+=ob(a)});E(a[0][1],function(a){c+=ob(a)});return[a[0][0],b+c]})};$.prototype.degree_iter=$.prototype.q;
$.prototype.M=function(a,b){var c;c=a!=l?S(this.d(a),function(a){return[a,this.pred[a]]},this):W(this.pred);return b!=l?S(c,function(a){var c=0;E(a[1],function(a){E(a,function(a){c+=+K(a,b,1)})});return[a[0][0],c]}):S(c,function(a){var b=0;E(a[1],function(a){b+=F(a)});return[a[0],b]})};$.prototype.in_degree_iter=$.prototype.M;
$.prototype.Q=function(a,b){var c;c=a!=l?S(this.d(a),function(a){return[a,this.succ[a]]},this):W(this.succ);return b!=l?S(c,function(a){var c=0;E(a[1],function(a){E(a,function(a){c+=+K(a,b,1)})});return[a[0][0],c]}):S(c,function(a){var b=0;E(a[1],function(a){b+=F(a)});return[a[0],b]})};$.prototype.out_degree_iter=$.prototype.Q;$.prototype.j=ba(k);$.prototype.is_multigraph=$.prototype.j;$.prototype.c=ba(k);$.prototype.is_directed=$.prototype.c;$.prototype.A=function(){return xb(this)};
$.prototype.to_directed=$.prototype.A;$.prototype.L=function(a){var b=new Z;b.name(this.name());b.g(this);var c,d;a?b.b(U(this.o(),function(a){c=a[0];return W(a[1])},function(a){d=a[0];return W(a[1])},ka(function(a){if(this.U(d,c,a[0]))return[c,d,a[0],V(a[1])]},this))):b.b(U(this.o(),function(a){c=a[0];return W(a[1])},function(a){d=a[0];return W(a[1])},function(a){return[c,d,a[0],V(a[1])]}));b.graph=V(this.graph);b.node=V(this.node);return b};$.prototype.to_undirected=$.prototype.L;
$.prototype.v=function(a){a=this.d(a);var b=new this.constructor,c=b.succ,d=b.pred,e=this.succ;B(a,function(a){c[a]={};d[a]={}});P(c,function(a){var b=c[a];E(e[a],function(e,p){if(p in c){var D=Pa(e);b[p]=D;d[p][a]=D}})});P(b,function(a){b.node[a]=this.node[a]},this);b.graph=this.graph;return b};$.prototype.subgraph=$.prototype.v;
$.prototype.reverse=function(a){(a=!s(a)||a)?(a=new this.constructor(l,{name:"Reverse of ("+this.name()+")"}),a.g(this),a.b(Ha(this.i(l,k,k),function(a){return[a[1],a[0],a[2],V(a[3])]})),a.graph=V(this.graph),a.node=V(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 dd(a){return a.nodes()}w("jsnx.classes.func.nodes",dd);w("jsnx.nodes",dd);function ed(a){return a.D()}w("jsnx.classes.func.nodes_iter",ed);w("jsnx.nodes_iter",ed);function fd(a,b){return a.m(b)}w("jsnx.classes.func.edges",fd);w("jsnx.edges",fd);w("jsnx.edges_iter",function(a,b){return a.i(b)});w("jsnx.degree",function(a,b,c){return a.p(b,c)});function gd(a,b){return a.C(b)}w("jsnx.classes.func.neighbors",gd);w("jsnx.neighbors",gd);w("jsnx.number_of_nodes",function(a){return a.K()});
function hd(a){return a.J()}w("jsnx.classes.func.number_of_edges",hd);w("jsnx.number_of_edges",hd);function id(a){var b=a.K(),c=a.J();return 0===c?0:a.c()?c/(b*(b-1)):2*c/(b*(b-1))}w("jsnx.classes.func.density",id);w("jsnx.density",id);function jd(a){a=Ma(a.p());var b=Math.max.apply(Math,a)+1,c=Ca(b);y(a,function(a){c[a]+=1});return c}w("jsnx.classes.func.degree_histogram",jd);w("jsnx.degree_histogram",jd);function kd(a){return a.c()}w("jsnx.classes.func.is_directed",kd);w("jsnx.is_directed",kd);
function ld(a){function b(){h(new Q("Frozen graph can't be modified"))}a.add_node=a.H=b;a.add_nodes_from=a.g=b;a.remove_node=a.R=b;a.remove_nodes_from=a.W=b;a.add_edge=a.a=b;a.add_edges_from=a.b=b;a.remove_edge=a.u=b;a.remove_edges_from=a.F=b;a.clear=a.clear=b;a.frozen=a.xa=k;return a}w("jsnx.classes.func.freeze",ld);w("jsnx.freeze",ld);function md(a){return!!a.xa}w("jsnx.classes.func.is_frozen",md);w("jsnx.is_frozen",md);function nd(a,b){return a.v(b)}w("jsnx.classes.func.subgraph",nd);
w("jsnx.subgraph",nd);function od(a,b){s(b)||(b=k);var c=new a.constructor;b&&c.g(a);return c}w("jsnx.classes.func.create_empty_copy",od);w("jsnx.create_empty_copy",od);
function pd(a,b){var c="";if(b!=l)a.r(b)||h(new Q("node "+b+" not in graph")),c=c+("Node "+b+" has the following properties:\n")+("Degree: "+a.p(b)+"\n"),c+="Neighbors: "+a.C(b).join(" ");else{var c=c+("Name: "+a.name()+"\n"),c=c+("Type: "+a.constructor.__name__+"\n"),c=c+("Number of nodes: "+a.K()+"\n"),c=c+("Number of edges: "+a.J()+"\n"),d=a.K();if(0<d)if(a.c())c+="Average in degree: "+(X.s.apply(l,Ma(a.ga()))/d).toFixed(4)+"\n",c+="Average out degree: "+(X.s.apply(l,Ma(a.ka()))/d).toFixed(4);
else var e=X.s.apply(l,Ma(a.p())),c=c+("Average degree: "+(e/d).toFixed(4))}return c}w("jsnx.classes.func.info",pd);w("jsnx.info",pd);function qd(a,b,c){E(c,function(c,e){a.node[e][b]=c})}w("jsnx.classes.func.set_node_attributes",qd);w("jsnx.set_node_attributes",qd);function rd(a,b){var c={};E(a.ja,function(a,e){b in a&&(c[e]=a[b])});return c}w("jsnx.classes.func.get_node_attributes",rd);w("jsnx.get_node_attributes",rd);function sd(a,b,c){E(c,function(b,c){c=c.split(",");a.f(c[0])[c[1]]=b})}
w("jsnx.classes.func.set_edge_attributes",sd);w("jsnx.set_edge_attributes",sd);function td(a,b){var c={};E(a.m(l,k),function(a){b in a[2]&&(c[[a[0],a[1]]]=a[2][b])});return c}w("jsnx.classes.func.get_edge_attributes",td);w("jsnx.get_edge_attributes",td);w("jsnx.version","0.1.1");}));