forked from fkling/JSNetworkX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsnetworkx.js
285 lines (285 loc) · 132 KB
/
jsnetworkx.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<<<<<<< HEAD
(function(){function h(a){throw a;}var j=void 0,l=!0,m=null,n=!1;function aa(a){return function(){return a}}var p,ba=ba||{},ca=this;function da(){}
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 t(a){return a!==j}function fa(a){return"array"==r(a)}function w(a){var b=r(a);return"array"==b||"object"==b&&"number"==typeof a.length}function x(a){return"string"==typeof a}function ha(a){return"boolean"==typeof a}function ja(a){return"number"==typeof a}function ka(a){return"function"==r(a)}function la(a){var b=typeof a;return"object"==b&&a!=m||"function"==b}var ma="closure_uid_"+(1E9*Math.random()>>>0),oa=0;
function y(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&&t(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}function pa(a,b){function c(){}c.prototype=b.prototype;a.zb=b.prototype;a.prototype=new c;a.prototype.constructor=a};var z=Array.prototype,qa=z.indexOf?function(a,b,c){return z.indexOf.call(a,b,c)}:function(a,b,c){c=c==m?0:0>c?Math.max(0,a.length+c):c;if(x(a))return!x(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},ra=z.forEach?function(a,b,c){z.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=x(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},sa=z.filter?function(a,b,c){return z.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=x(a)?
a.split(""):a,k=0;k<d;k++)if(k in g){var q=g[k];b.call(c,q,k,a)&&(e[f++]=q)}return e},ta=z.map?function(a,b,c){return z.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=x(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e};function va(a,b){var c=qa(a,b);0<=c&&z.splice.call(a,c,1)}function wa(a){return z.concat.apply(z,arguments)}function xa(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 ya(a,b,c){return 2>=arguments.length?z.slice.call(a,b):z.slice.call(a,b,c)}function za(a,b,c){if(!w(a)||!w(b)||a.length!=b.length)return n;var d=a.length;c=c||Aa;for(var e=0;e<d;e++)if(!c(a[e],b[e]))return n;return l}function Ba(a,b){return a>b?1:a<b?-1:0}function Aa(a,b){return a===b}function Ca(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)}};var A="StopIteration"in ca?ca.StopIteration:Error("StopIteration");function B(){}B.prototype.next=function(){h(A)};B.prototype.u=function(){return this};function E(a){if(a instanceof B)return a;if("function"==typeof a.u)return a.u(n);if(w(a)){var b=0,c=new B;c.next=function(){for(;;){b>=a.length&&h(A);if(b in a)return a[b++];b++}};return c}h(Error("Not implemented"))}function F(a,b,c){if(w(a))try{ra(a,b,c)}catch(d){d!==A&&h(d)}else{a=E(a);try{for(;;)b.call(c,a.next(),j,a)}catch(e){e!==A&&h(e)}}}
function Ea(a,b,c){var d=E(a);a=new B;a.next=function(){for(;;){var a=d.next();if(b.call(c,a,j,d))return a}};return a}function G(a,b,c){var d=E(a);a=new B;a.next=function(){for(;;){var a=d.next();return b.call(c,a,j,d)}};return a}function Fa(a,b,c){var d=c;F(a,function(a){d=b.call(j,d,a)});return d}function Ka(a){var b=arguments,c=b.length,d=0,e=new B;e.next=function(){try{return d>=c&&h(A),E(b[d]).next()}catch(a){return(a!==A||d>=c)&&h(a),d++,this.next()}};return e}
function H(a){if(w(a))return xa(a);a=E(a);var b=[];F(a,function(a){b.push(a)});return b}function La(a,b){try{return E(a).next()}catch(c){return c!=A&&h(c),b}};function Ma(){}Ma.ya=function(){return Ma.Aa?Ma.Aa:Ma.Aa=new Ma};Ma.prototype.Ua=0;Ma.ya();var Na={};function Oa(a){if(!w(a))return n;for(var b=0,c=a.length;b<c;b++)if(window.isNaN(a[b]))return n;return l}y("jsnx.utils.is_list_of_ints",Oa);y("jsnx.utils.cumulative_sum",function(a){var b=0;return G(a,function(a){return b+=a})});y("jsnx.utils.generate_unique_node",function(){return":"+(Ma.ya().Ua++).toString(36)});function I(a,b){for(var c in a)b.call(j,a[c],c,a)}function Pa(a,b,c){var d={},e;for(e in a)d[e]=b.call(c,a[e],e,a);return d}function Qa(a){var b=0,c;for(c in a)b++;return b}function L(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function M(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function Ra(a){for(var b in a)delete a[b]}function Va(a){"__d3datum__"in a&&delete a.__d3datum__}function O(a,b,c){return b in a?a[b]:c}function Wa(a){var b={},c;for(c in a)b[c]=a[c];return b}var Xa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
function P(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<Xa.length;f++)c=Xa[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function Ya(a){return a instanceof B||ka(a.u)}function Za(a){if(x(a)||w(a)||"length"in a)return a.length;if($a(a))return Qa(a);h(new TypeError)}function Q(a,b,c,d){ha(c)&&(d=c,c=m);if(d){var e=b;b=function(a){e.apply(this,a)}}Ya(a)?F(a,b,c):w(a)||x(a)?ra(a,b,c):la(a)&&Q(M(a),b,c)}y("jsnx.forEach",Q);function ab(a,b){if(w(a))return ta(a,b,j);if(Ya(a))return G(a,b,j);if(la(a))return Pa(a,b,j);h(new TypeError)}
function bb(){var a=arguments,b=a[0];if(w(b))return Ca.apply(m,a);if(Ya(b)){var b=new B,c=a.length;b.next=function(){for(var b=[],e=0;e<c;e++)b.push(a[e].next());return b};return b}if(la(b))return Ca.apply(m,ta(a,M));h(new TypeError)}
function cb(a,b,c){if(0===arguments.length)return[];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 B,e=0>c,f=a,g;d.next=function(){(e&&f<=b||!e&&f>=b)&&h(A);g=f;f+=c;return g};return d}
function db(a){var b=eb(a),c=b.length;if(2>c)return new B;var d=eb(cb(2));a=new B;a.next=function(){var a=ta(d,function(a){return b[a]});this.next=function(){var a=n,e;for(e=2;e--;)if(d[e]!=e+c-2){a=l;break}a||h(A);d[e]+=1;for(a=e+1;2>a;a++)d[a]=d[a-1]+1;return ta(d,function(a){return b[a]})};return a};return a}
function fb(a){var b=eb(a),c=b.length,d=ja(2)?2:c;if(d>c)return new B;var e=eb(cb(c)),f=eb(cb(c,c-d,-1));a=new B;var g=new B,k,q=l;a.next=function(){this.next=k.next;return ta(e.slice(0,d),function(a){return b[a]})};g.next=function(){return q};k=gb(g,function(a){a||h(A);q=n;return cb(d-1,-1,-1)},function(a){if(!q)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 k=f[a],g=e[a];e[a]=e[e.length-k];e[e.length-k]=g;q=l;return hb([ta(e.slice(0,d),function(a){return b[a]})])}},
function(a){return a});return a}function ib(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)!t(a[c])||"object"!==r(a[c])?a[c]=R(d[c]):"object"===r(a[c])&&"object"===r(d)&&ib(a[c],d[c]);for(var f=0;f<Xa.length;f++)c=Xa[f],Object.prototype.hasOwnProperty.call(d,c)&&(!t(a[c])||"object"!==r(a[c])?a[c]=R(d[c]):"object"===r(a[c])&&"object"===r(d)&&ib(a[c],d[c]))}}function eb(a){if(w(a))return xa(a);if(Ya(a))return H(a);if(la(a))return M(a);h(new TypeError)}y("jsnx.toArray",eb);
function pb(a){var b=new B,c=E(M(a));b.next=function(){var b=c.next();return[b,a[b]]};return b}function hb(a){"object"===r(a)&&(!w(a)&&!Ya(a))&&(a=M(a));return E(a)}
function gb(a){var b=new B,c=ya(arguments,1);if(0===c.length)return a;try{a=E(a)}catch(d){return b.next=function(){"Not implemented"===d.message&&h(new TypeError)},b}var e=m;b.next=function(){var d,g;try{for(;!t(d);)d=e.next()}catch(k){for(;!t(g)||!t(d);)g=a.next(),d=c[0](g);if(Ya(d))return e=gb.apply(m,wa([d],ya(c,1))),b.next();e=m}return d};return b}y("jsnx.sentinelIterator",function(a,b){var c=new B;c.next=function(){return La(a,b)};return c});
function $a(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===j||b.call(a,d)}
function R(a,b){b=b||[];var c=r(a);if("object"==c&&$a(a)||"array"==c){var d;d=b;var e;a:{e=function(b){return a===b[0]};for(var f=d.length,g=x(d)?d.split(""):d,k=0;k<f;k++)if(k in g&&e.call(j,g[k])){e=k;break a}e=-1}d=0>e?m:x(d)?d.charAt(e):d[e];if(d!==m)return d[1];if(a.$)return d=[a,a.$()],b.push(d),d[1];c="array"==c?[]:{};d=[a,c];b.push(d);for(var q in a)c[q]=R(a[q],b);return c}return a}
function qb(a){function b(){}var c={},d;b.prototype=a.constructor.prototype;for(d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);c=R(c);a=new b;for(d in c)a[d]=c[d];return a};function rb(a){if("function"==typeof a.J)return a.J();if(x(a))return a.split("");if(w(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return L(a)};function sb(a,b){this.b={};this.p=[];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.N(a)}p=sb.prototype;p.n=0;p.H=0;p.c=function(){return this.n};p.J=function(){this.L();for(var a=[],b=0;b<this.p.length;b++)a.push(this.b[this.p[b]]);return a};p.fa=function(){this.L();return this.p.concat()};p.d=function(a){return tb(this.b,a)};p.ba=function(){return 0==this.n};
p.clear=function(){this.b={};this.H=this.n=this.p.length=0};p.remove=function(a){return tb(this.b,a)?(delete this.b[a],this.n--,this.H++,this.p.length>2*this.n&&this.L(),l):n};p.L=function(){if(this.n!=this.p.length){for(var a=0,b=0;a<this.p.length;){var c=this.p[a];tb(this.b,c)&&(this.p[b++]=c);a++}this.p.length=b}if(this.n!=this.p.length){for(var d={},b=a=0;a<this.p.length;)c=this.p[a],tb(d,c)||(this.p[b++]=c,d[c]=1),a++;this.p.length=b}};p.get=function(a,b){return tb(this.b,a)?this.b[a]:b};
p.set=function(a,b){tb(this.b,a)||(this.n++,this.p.push(a),this.H++);this.b[a]=b};p.N=function(a){var b;a instanceof sb?(b=a.fa(),a=a.J()):(b=M(a),a=L(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};p.$=function(){return new sb(this)};p.D=function(){return this.u(l)};p.aa=function(){return this.u(n)};
p.u=function(a){this.L();var b=0,c=this.p,d=this.b,e=this.H,f=this,g=new B;g.next=function(){for(;;){e!=f.H&&h(Error("The map has changed since the iterator was created"));b>=c.length&&h(A);var k=c[b++];return a?k:d[k]}};return g};function tb(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function S(a){this.b=new sb;a&&this.N(a)}function ub(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ma]||(a[ma]=++oa)):b.substr(0,1)+a}p=S.prototype;p.c=function(){return this.b.c()};p.add=function(a){this.b.set(ub(a),a)};p.N=function(a){a=rb(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};p.remove=function(a){return this.b.remove(ub(a))};p.clear=function(){this.b.clear()};p.ba=function(){return this.b.ba()};p.contains=function(a){return this.b.d(ub(a))};
function vb(a,b){for(var c=new S,d=rb(b),e=0;e<d.length;e++){var f=d[e];a.contains(f)&&c.add(f)}return c}function wb(a,b){for(var c=a.$(),d=rb(b),e=d.length,f=0;f<e;f++)c.remove(d[f]);return c}p.J=function(){return this.b.J()};p.$=function(){return new S(this)};p.u=function(){return this.b.u(n)};function xb(a){if(a!=m)try{a.clear()}catch(b){h(Error("Input graph is not a jsnx graph type"))}else a=new Na.Fa;return a}
function yb(a,b,c){var d;if(a.hasOwnProperty("adj"))try{return d=zb(a.adj,b,a.o()),"graph"in a&&"object"===r(a.graph)&&(d.graph=Wa(a.graph)),"node"in a&&"object"===r(a.node)&&(d.node=Pa(a.node,function(a){return Wa(a)})),d}catch(e){h(Error("Input is not a correct jsnx graph"))}if("object"===r(a))try{return zb(a,b,c)}catch(f){try{var g=xb(b);g.m(a);if(g.o()&&!g.h()){var k={};I(a,function(a,b){ra(a,function(a){a in k||g.v(b,a)});k[b]=1})}else{var q=[];I(a,function(a,b){ra(a,function(a){q.push([b,a])})});
g.e(q)}return g}catch(C){h(Error("Input is not known type."))}}if(w(a))try{var s=xb(b);s.e(a);return s}catch(D){h(Error("Input is not valid edge list"))}}y("jsnx.to_networkx_graph",yb);y("jsnx.convert_to_undirected",Na.ib);y("jsnx.convert_to_undirected",Na.hb);y("jsnx.to_dict_of_lists",Na.Ab);
function zb(a,b,c){var d=xb(b),e,f;d.m(a);c?d.h()?(d.o()?(e=[],I(a,function(a,b){w(a)&&h(Error());I(a,function(a,c){I(a,function(a,d){e.push([b,c,d,a])})})})):(e=[],I(a,function(a,b){w(a)&&h(Error());I(a,function(a,c){I(a,function(a){e.push([b,c,a])})})})),d.e(e)):d.o()?(f=new S,I(a,function(a,b){w(a)&&h(Error());I(a,function(a,c){f.contains([b,c].toString())||(e=[],I(a,function(a,d){e.push([b,c,d,a])}),d.e(e),f.add([c,b].toString()))})})):(f=new S,I(a,function(a,b){w(a)&&h(Error());I(a,function(a,
c){f.contains([b,c].toString())||(e=[],I(a,function(a){e.push([b,c,a])}),d.e(e),f.add([c,b].toString()))})})):d.o()&&!d.h()?(f=new S,I(a,function(a,b){w(a)&&h(Error());I(a,function(a,c){f.contains([b,c].toString())||(d.v(b,c,a),f.add([c,b].toString()))})})):(e=[],I(a,function(a,b){w(a)&&h(Error());I(a,function(a,c){e.push([b,c,a])})}),d.e(e));return d};function Ab(a){this.name="JSNetworkXException";this.message=a}Ab.prototype=Error();Ab.prototype.constructor=Ab;y("jsnx.JSNetworkXException",Ab);function T(a){Ab.call(this,a);this.name="JSNetworkXError"}pa(T,Ab);y("jsnx.JSNetworkXError",T);function Bb(a){Ab.call(this,a);this.name="JSNetworkXPointlessConcept"}pa(Bb,Ab);y("jsnx.JSNetworkXPointlessConcept",Bb);function Cb(a){Ab.call(this,a);this.name="JSNetworkXAlgorithmError"}pa(Cb,Ab);y("jsnx.JSNetworkXAlgorithmError",Cb);
function Db(a){Cb.call(this,a);this.name="JSNetworkXUnfeasible"}pa(Db,Cb);y("jsnx.JSNetworkXUnfeasible",Db);function Eb(a){Db.call(this,a);this.name="JSNetworkXNoPath"}pa(Eb,Db);y("jsnx.JSNetworkXNoPath",Eb);function Fb(a){Cb.call(this,a);this.name="JSNetworkXUnbounded"}pa(Fb,Cb);y("jsnx.JSNetworkXUnbounded",Fb);var V={tb:function(a){return Math.floor(Math.random()*a)},Cb:function(a,b){return a+Math.random()*(b-a)},fb:function(a,b,c){return Math.min(Math.max(a,b),c)},Ta:function(a,b){var c=a%b;return 0>c*b?c+b:c},qb:function(a,b,c){return a+c*(b-a)},sb:function(a,b,c){return Math.abs(a-b)<=(c||1E-6)},wa:function(a){return V.Ta(a,360)},Ea:function(a){return a*Math.PI/180},ab:function(a){return 180*a/Math.PI},cb:function(a,b){return b*Math.cos(V.Ea(a))},eb:function(a,b){return b*Math.sin(V.Ea(a))},xa:function(a,
b,c,d){return V.wa(V.ab(Math.atan2(d-b,c-a)))},bb:function(a,b){var c=V.wa(b)-V.wa(a);180<c?c-=360:-180>=c&&(c=360+c);return c},wb:function(a){return 0==a?0:0>a?-1:1},rb: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=[],k=0;k<e+1;k++)g[k]=[],g[k][0]=0;for(var q=0;q<f+1;q++)g[0][q]=0;for(k=1;k<=e;k++)for(q=1;q<=e;q++)g[k][q]=c(a[k-1],b[q-1])?g[k-1][q-1]+1:Math.max(g[k-1][q],g[k][q-1]);for(var C=[],k=e,q=f;0<k&&0<q;)c(a[k-1],b[q-1])?(C.unshift(d(k-
1,q-1)),k--,q--):g[k-1][q]>g[k][q-1]?k--:q--;return C},F:function(a){var b;b=arguments;var c=function(a,b){return a+b};if(b.reduce)b=b.reduce(c,0);else{var d=0;ra(b,function(a){d=c.call(j,d,a)});b=d}return b},Ma:function(a){return V.F.apply(m,arguments)/arguments.length},xb:function(a){var b=arguments.length;if(2>b)return 0;var c=V.Ma.apply(m,arguments),b=V.F.apply(m,ta(arguments,function(a){return Math.pow(a-c,2)}))/(b-1);return Math.sqrt(b)},ob:function(a){return isFinite(a)&&0==a%1},nb:function(a){return isFinite(a)&&
!isNaN(a)},vb:function(a,b){return Math.floor(a+(b||2E-15))},ub:function(a,b){return Math.ceil(a-(b||2E-15))}};function Hb(a){var b=[];Ib(new Jb,a,b);return b.join("")}function Jb(){this.ta=j}
function Ib(a,b,c){switch(typeof b){case "string":Kb(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==m){c.push("null");break}if(fa(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Ib(a,a.ta?a.ta.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),Kb(f,c),c.push(":"),
Ib(a,a.ta?a.ta.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:h(Error("Unknown type: "+typeof b))}}var Lb={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Mb=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Kb(a,b){b.push('"',a.replace(Mb,function(a){if(a in Lb)return Lb[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Lb[a]=e+b.toString(16)}),'"')};var Nb={};y("jsnx.Map.Entry",function(a,b){this.key=a;this.value=b});function Ob(a){this.b={};this.k=[];this.ra={};a&&(this.ra.hash=a)}p=Ob.prototype;p.n=0;p.H=0;p.c=function(){return this.n};p.J=function(){this.L();for(var a=[],b=0;b<this.k.length;b++)a.push(this.b[this.k[b]][1]);return a};p.fa=function(){this.L();for(var a=[],b=0;b<this.k.length;b++)a.push(this.b[this.k[b]][0]);return a};p.d=function(a){var b=Pb(this,a);return Object.prototype.hasOwnProperty.call(obj,b)?this.b[b][0]===a:n};
p.ba=function(){return 0==this.n};p.clear=function(){this.b={};this.H=this.n=this.k.length=0};p.remove=function(a){a=Pb(this,a);return Object.prototype.hasOwnProperty.call(this.b,a)?(delete this.b[a],this.n--,this.H++,this.k.length>2*this.n&&this.L(),l):n};
p.L=function(){if(this.n!=this.k.length){for(var a=0,b=0;a<this.k.length;){var c=this.k[a];Object.prototype.hasOwnProperty.call(this.b,c)&&(this.k[b++]=c);a++}this.k.length=b}if(this.n!=this.k.length){for(var d={},b=a=0;a<this.k.length;)c=this.k[a],Object.prototype.hasOwnProperty.call(d,c)||(this.k[b++]=key,d[c]=1),a++;this.k.length=b}};
p.get=function(a,b){var c=Pb(this,val);return Object.prototype.hasOwnProperty.call(this.b,c)?(c=this.b[c],a!==c[0]&&h(Error("Provided key not equal to hashed key")),c[1]):b};p.set=function(a,b){var c=Pb(this,a);Object.prototype.hasOwnProperty.call(this.b,c)||(this.n++,this.k.push(c),this.H++);this.b[c]=[a,b]};p.N=function(a){var b;if(a instanceof Ob)b=a.fa(),a=a.J();else{if(a instanceof B){F(a,function(a){this.set(a[0],a[1])},this);return}b=M(a);a=L(a)}for(var c=0;c<b.length;c++)this.set(b[c],a[c])};
p.$=function(){return new Ob(this)};p.D=function(){return this.u(l)};p.aa=function(){return this.u(n)};function Qb(a){return a.u(2)}p.u=function(a){this.L();var b=0,c=this.k,d=this.b,e=this.H,f=this,g=new B;g.next=function(){for(;;){e!=f.H&&h(Error("The map has changed since the iterator was created"));b>=c.length&&h(A);var k=c[b++],k=d[k];return a?1==a?k[0]:k:k[1]}};return g};
function Pb(a,b){var c="";return c="hash"in a.ra?a.ra.hash(b):"hash"in b?"function"===typeof b.hash?b.hash():""+b.hash:"[object Object]"===Object.prototype.toString.call(b)?b[ma]||(b[ma]=++oa):""+b};function W(a,b){if(!(this instanceof W))return new W(a,b);this.i={};P(this.i,b||{});this.j=X(this);this.q=X(this);a!=m&&yb(a,this)}y("jsnx.classes.Graph",W);y("jsnx.Graph",W);W.__name__="Graph";W.prototype.i=m;W.prototype.q=m;W.prototype.Pa=function(){return this.i};W.prototype.graph=W.prototype.Pa;W.prototype.P=function(a){return this.j.get(a)};W.prototype.node=W.prototype.P;W.prototype.g=function(a){return 0<arguments.length?this.q:this.q.get(a)};W.prototype.adj=W.prototype.g;W.prototype.Na=W.prototype.g;
W.prototype.edge=W.prototype.Na;function X(a){return new Nb(a.i.hash)}W.prototype.name=function(a){if(t(a))this.i.name=a.toString();else return this.i.name||""};W.prototype.name=W.prototype.name;W.prototype.toString=function(){return this.name()};W.prototype.toString=W.prototype.toString;W.prototype.u=function(){return this.j.D()};W.prototype.__iterator__=W.prototype.u;W.prototype.t=function(a){this.a(a)||h({name:"KeyError",message:"Graph does not contain node "+a+"."});return this.g(a)};
W.prototype.get_node=W.prototype.t;W.prototype.Z=function(a,b){b!=m||(b={});"object"!==r(b)&&h(new T("The attr_dict argument must be an object."));this.ea(a,b)};W.prototype.add_node=W.prototype.Z;W.prototype.ea=function(a,b){this.a(a)?b&&P(this.P(a),b||{}):(this.q.set(a,X(this)),this.j.set(a,b||X(this)))};W.prototype.m=function(a,b){var c,d,e;b=b||{};Q(a,function(a){c=!this.a(a);fa(a)?(d=a[0],e=a[1],this.ea(d,P(Wa(b),e))):c?this.ea(a,Wa(b)):P(this.P(a),b)},this)};W.prototype.add_nodes_from=W.prototype.m;
W.prototype.sa=function(a){this.a(a)||h(new T("The node "+a+" is not in the graph"));this.Da(a)};W.prototype.remove_node=W.prototype.sa;W.prototype.Da=function(a){var b=this.W(a);this.j.remove(a);F(b,function(b){this.g(b).remove(a)});this.q.remove(a)};W.prototype.va=function(a){Q(a,this.Da,this)};W.prototype.remove_nodes_from=W.prototype.va;W.prototype.w=function(a){return a?Qb(this.j):this.j.D()};W.prototype.nodes_iter=W.prototype.w;W.prototype.nodes=function(a){return H(this.w(a))};
W.prototype.nodes=W.prototype.nodes;W.prototype.la=function(){return this.j.c()};W.prototype.number_of_nodes=W.prototype.la;W.prototype.Q=function(){return this.j.c()};W.prototype.order=W.prototype.Q;W.prototype.a=function(a){return!fa(a)&&this.j.d(a)};W.prototype.has_node=W.prototype.a;W.prototype.v=function(a,b,c){c=c||{};"object"!==r(c)&&h(new T("The attr_dict argument must be an object."));this.S(a,b,c)};W.prototype.add_edge=W.prototype.v;
W.prototype.S=function(a,b,c){this.O(a);this.O(b);var d=this.g(a),e={};d.d(b)?(e=d.get(b),P(e,c)):(P(e,c),this.g(a).set(b,e),this.g(b).set(a,e))};W.prototype.e=function(a,b){b=b||{};"object"!==r(b)&&h(new T("The attr_dict argument must be an object."));Q(a,function(a){var d=Za(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 T("Edge tuple "+a.toString()+" must be a 2-tuple or 3-tuple."));a=Wa(b);P(a,g);this.S(e,f,a)},this)};W.prototype.add_edges_from=W.prototype.e;
W.prototype.Ka=function(a,b,c){c=c||{};x(b)||(c=b,b="weight");this.e(ab(a,function(a){var c={};c[b]=a[2];t(c[b])||h(new TypeError("Values must consist of three elements: "+Hb(a)));return[a[0],a[1],c]}),c)};W.prototype.add_weighted_edges_from=W.prototype.Ka;W.prototype.X=function(a,b){try{this.na(a,b)}catch(c){c instanceof TypeError&&h(new T("The edge "+a+"-"+b+" is not in the graph")),h(c)}};W.prototype.remove_edge=W.prototype.X;
W.prototype.na=function(a,b){this.a(a)&&this.a(b)&&(this.g(a).remove(b),a!=b&&this.g(b).remove(a))};W.prototype.M=function(a){Q(a,function(a){this.na(a[0],a[1])},this)};W.prototype.remove_edges_from=W.prototype.M;W.prototype.C=function(a,b){return this.a(a)&&this.a(b)&&this.g(a).d(b)};W.prototype.has_edge=W.prototype.C;W.prototype.V=function(a){return H(this.W(a))};W.prototype.neighbors=W.prototype.V;W.prototype.W=function(a){this.a(a)||h(new T("The node "+a+" is not in the graph."));return this.g(a).D()};
W.prototype.neighbors_iter=W.prototype.W;W.prototype.I=function(a,b){return H(this.f(a,b))};W.prototype.edges=W.prototype.I;W.prototype.f=function(a){ha(a)&&(a=m);return this.T(visitor,this.s(a))};W.prototype.edges_iter=W.prototype.f;W.prototype.T=function(a,b){var c=X(this),d=m;return gb(b,function(a){d=a[0];var b=new B,g=Qb(a[1]);b.next=function(){try{return g.next()}catch(a){a===A&&c.set(d,l),h(a)}};return b},function(b){if(!c.d(b[0]))return a(d,b)})};
W.prototype.ga=function(a,b,c){t(c)||(c=m);return this.a(a)?this.g(a).get(b,c):c};W.prototype.get_edge_data=W.prototype.ga;W.prototype.La=function(){return H(G(this.s(),function(a){return a[1].fa()}))};W.prototype.adjacency_list=W.prototype.La;function Rb(a,b){var c=m;b!=m?(!fa(b)&&!ba.pb(b)&&(b=[b]),c=G(hb(b),function(b){return[b,a.get(b)]})):c=Qb(a);return c}W.prototype.s=function(a){return Rb(this.q,a)};W.prototype.adjacency_iter=W.prototype.s;
W.prototype.A=function(a,b){if(this.a(a))return this.B(a,b).next()[1];var c=X(this);c.N(this.B(a,b));return c};W.prototype.degree=W.prototype.A;W.prototype.B=function(a,b){var c=this.s(a),d=Sb;b&&(d=jsnc.gb.Fa.yb);return G(c,function(a){var c=a[0];a=a[1];a=d(c,b)(0,a);return[c,a]})};W.prototype.degree_iter=W.prototype.B;W.prototype.clear=function(){this.name("");this.q.clear();this.j.clear();Ra(this.graph)};W.prototype.clear=W.prototype.clear;W.prototype.copy=function(){return qb(this)};
W.prototype.copy=W.prototype.copy;W.prototype.o=aa(n);W.prototype.is_multigraph=W.prototype.o;W.prototype.h=aa(n);W.prototype.is_directed=W.prototype.h;W.prototype.Y=function(){var a=new Y(m,this.i);a.m(G(this.w(l),function(a){return[a[0],R(a[1])]}));a.e(G(this.f(j,l),function(a){return[a[0],a[1],R(a[2])]}));return a};W.prototype.to_directed=W.prototype.Y;
W.prototype.pa=function(){var a=new W(m,this.i);a.m(G(this.w(l),function(a){return[a[0],R(a[1])]}));a.e(G(this.f(j,l),function(a){return[a[0],a[1],R(a[2])]}));return a};W.prototype.to_undirected=W.prototype.pa;W.prototype.R=function(a){a=this.K(a);var b=new this.constructor(m,this.i),c=b.j,d=b.q,e=this.q;F(a,function(a){var g=X(b);d.set(a,g);F(Qb(e.get(a)),function(b){c.d(u[0]);g.set(b[0],b[1]);d.get(b[0]).set(a,b[1])})});F(d.D(),function(a){b.Z(a,this.P(a))},this);return b};
W.prototype.subgraph=W.prototype.R;W.prototype.Va=function(){return H(G(Ea(this.s(),function(a){return a[1].d(a[0])}),function(a){return a[0]}))};W.prototype.nodes_with_selfloops=W.prototype.Va;W.prototype.oa=function(a){function b(a){return[a[0],a[0]]}a&&(b=function(a){var b=a[0];return[b,b,a[1].get(b)]});return H(G(Ea(this.s(),function(a){return a[1].d(a[0])}),b))};W.prototype.selfloop_edges=W.prototype.oa;W.prototype.Wa=function(){return this.oa().length};W.prototype.number_of_selfloops=W.prototype.Wa;
W.prototype.size=function(a){var b=V.F.apply(m,this.A(m,a).J())/2;return a!=m?b:Math.floor(b)};W.prototype.size=W.prototype.size;W.prototype.ca=function(a,b){return a==m?Math.floor(this.size()):this.C(a,b)?1:0};W.prototype.number_of_edges=W.prototype.ca;W.prototype.Ja=function(a,b){var c=eb(a),d=c[0],c=ab(ya(c,1),function(a){return[d,a]});this.e(c,b)};W.prototype.add_star=W.prototype.Ja;W.prototype.Ia=function(a,b){var c=eb(a),c=Ca(ya(c,0,c.length-1),ya(c,1));this.e(c,b)};W.prototype.add_path=W.prototype.Ia;
W.prototype.Ga=function(a,b){var c=eb(a),c=Ca(c,wa(ya(c,1),[c[0]]));this.e(c,b)};W.prototype.add_cycle=W.prototype.Ga;W.prototype.K=function(a){return a!=m?this.a(a)?hb([a]):hb(a):this.j.D()};W.prototype.nbunch_iter=W.prototype.K;function Sb(a){return function(b,c){b+=+c.c();return b+=+c.d(a)}}function Tb(a,b){return function(c,d){c=Fa(d.aa(),function(a,c){return a+ +O(c,b,1)},c);c+=+(d.d(a)&&O(d.get(a),b,1))}};function Y(a,b){if(!(this instanceof Y))return new Y(a,b);this.i={};this.j=X(this);this.q=X(this);this.z=X(this);this.l=this.q;a!=m&&yb(a,this);P(this.i,b||{});this.kb=this.q}y("jsnx.classes.DiGraph",Y);y("jsnx.DiGraph",Y);pa(Y,W);Y.__name__="DiGraph";p=Y.prototype;p.z=m;p.l=m;function Ub(a,b){return b!=m?a.z.get(b):a.z}function Vb(a,b){return b!=m?a.l.get(b):a.l}p.ea=function(a,b){this.j.d(a)?P(this.j.get(a),b):(this.l.set(a,X(this)),this.z.set(a,X(this)),this.j.set(a,b))};
p.S=function(a,b,c){c=c||{};this.O(a);this.O(b);var d=Vb(this,a),e={};d.d(b)?(e=d.get(b),P(e,c)):(P(e,c),Vb(this,a).set(b,e),Ub(this,b).set(a,e))};p.Ca=function(a,b){this.Qa(a)&&this.Qa(b)&&(Vb(this,a).remove(b),Ub(this,b).remove(a))};p.M=W.prototype.M;Y.prototype.remove_edges_from=Y.prototype.M;Y.prototype.Sa=function(a,b){return this.a(a)&&Vb(this,a).d(b)};Y.prototype.has_successor=Y.prototype.Sa;Y.prototype.Ra=function(a,b){return this.a(a)&&Ub(this,a).d(b)};Y.prototype.has_predecessor=Y.prototype.Ra;
Y.prototype.$a=W.prototype.W;Y.prototype.successors_iter=Y.prototype.$a;Y.prototype.Ya=function(a){this.a(a)||h(new T("The node "+a+" is not in the digraph."));return Ub(this,a).D()};Y.prototype.predecessors_iter=Y.prototype.Ya;Y.prototype.Za=W.prototype.V;Y.prototype.successors=Y.prototype.Za;Y.prototype.Xa=function(a){this.a(a)||h(new T("The node "+a+" is not in the digraph."));return Ub(this,a).fa()};Y.prototype.predecessors=Y.prototype.Xa;Y.prototype.V=W.prototype.V;Y.prototype.neighbors=Y.prototype.V;
Y.prototype.W=W.prototype.W;Y.prototype.neighbors_iter=Y.prototype.W;Y.prototype.f=W.prototype.f;Y.prototype.ma=W.prototype.f;Y.prototype.out_edges_iter=Y.prototype.ma;Y.prototype.ua=W.prototype.I;Y.prototype.out_edges=Y.prototype.ua;Y.prototype.s=function(a,b,c){var d=m,e=n,f=l;b!=m&&(e=b);c!=m&&(f=c);e?(d=Rb(this.z,a),f&&(d=bb(d,Rb(this.l,a)))):f&&(d=Rb(this.l,a));return d};Y.prototype.adjacency_iter=Y.prototype.s;Y.prototype.U=function(a,b){return this.T(a,b,l,n)};Y.prototype.in_edges_iter=Y.prototype.U;
Y.prototype.T=function(a,b,c,d){ha(a)&&(a=m);b=n;var e=l;c!=m&&(b=c);d!=m&&(e=d);b&&e&&h(Error("Why are you iterating over both directions?"));a=this.s(a,b,e);return gb(a,function(a){return Qb(a[1])},function(){})};Y.prototype.ia=function(a,b){return H(this.U(a,b))};Y.prototype.in_edges=Y.prototype.ia;Y.prototype.B=function(a,b){return this.qa(a,b,l,l)};Y.prototype.degree_iter=Y.prototype.B;Y.prototype.ha=function(a,b){return this.qa(a,b,l,n)};Y.prototype.in_degree_iter=Y.prototype.ha;
Y.prototype.qa=function(a,b,c,d){var e=n,f=l;c!=m&&(e=c);d!=m&&(f=d);node_nbrs=this.s(a,e,f);var g=Sb;b&&(g=Tb);return G(m,function(a){var c=0,d,s=g(a[0],b);e&&f?(d=a[0][0],c=s(0,a[0][1])+s(0,a[1][1])):(d=a[0],c=s(c,a[1]));return[d,c]})};Y.prototype.da=function(a,b){return this.qa(a,b,n,l)};Y.prototype.out_degree_iter=Y.prototype.da;Y.prototype.za=function(a,b){if(this.a(a))return this.ha(a,b).next()[1];var c=X(this);c.N(this.ha(a,b));return c};Y.prototype.in_degree=Y.prototype.za;
Y.prototype.Ba=function(a,b){if(this.a(a))return this.da(a,b).next()[1];var c=X(this);c.N(this.da(a,b));return c};Y.prototype.out_degree=Y.prototype.Ba;Y.prototype.clear=function(){this.l.clear();this.z.clear();this.j.clear();Ra(this.i)};Y.prototype.clear=Y.prototype.clear;Y.prototype.o=aa(n);Y.prototype.is_multigraph=Y.prototype.o;Y.prototype.h=aa(l);Y.prototype.is_directed=Y.prototype.h;
Y.prototype.Y=function(){var a=new Y(m,this.i);a.m(G(this.w(l),function(a){return[a[0],R(a[1])]}));a.e(G(this.f(j,l),function(a){return[a[0],a[1],R(a[2])]}));return a};Y.prototype.to_directed=Y.prototype.Y;Y.prototype.pa=function(a){var b=new W;b.name(this.name());b.m(G(this.w(l),function(a){return[a[0],R(a[1])]}));a=a?Ea(this.f(l),function(a){return this.C(a[1],a[0])},this):this.f(l);b.e(G(a,function(a){return[a[0],a[1],R(a[2])]}));b.i=R(this.i);return b};Y.prototype.to_undirected=Y.prototype.pa;
Y.prototype.reverse=function(a){(a=!t(a)||a)?(a=new this.constructor(m,{name:"Reverse of ("+this.name()+")"}),a.m(G(this.w(l),function(a){return[a[0],R(a[1])]})),a.e(G(this.f(l),function(a){return[a[1],a[0],R(a[2])]})),a.i=R(this.i)):(a=this.l,this.l=this.z,this.z=a,this.q=this.l,a=this);return a};Y.prototype.reverse=Y.prototype.reverse;
Y.prototype.R=function(a){a=this.K(a);var b=new this.constructor(this.ra),c=b.l,d=b.z,e=this.l;F(a,function(a){var g=a[0],k=X(b);c.set(g,k);F(Qb(e.get(g)),function(a){var b=a[0];c.d(b)&&(k.set(b,a[1]),d.get(b).set(g,a[1]))})});F(H_adj.D(),function(a){b.Z(a,this.P(a))},this);return b};Y.prototype.subgraph=Y.prototype.R;function Z(a,b){if(!(this instanceof Z))return new Z(a,b);W.call(this,a,b)}pa(Z,W);y("jsnx.classes.MultiGraph",Z);y("jsnx.MultiGraph",Z);Z.__name__="MultiGraph";Z.prototype.v=function(a,b,c,d){c!=m&&(!x(c)&&!ja(c))&&(d=c,c=m);d=d||{};"object"!==r(d)&&h(new T("The attr_dict argument must be an object."));this.S(a,b,c,d)};Z.prototype.add_edge=Z.prototype.v;
Z.prototype.S=function(a,b,c,d){this.O(a);this.O(b);var e=this.g(a),f=this.g(b);if(e.d(b)){keydict=e.get(b);if(c==m)for(c=keydict.c();keydict.d(c);)c+=1;datadict=keydict.get(c,{});P(datadict,d);keydict.set(c,datadict)}else c!=m||(c=0),datadict={},P(datadict,d),keydict=new Ob,keydict.set(c,datadict),e.set(b,keydict),f.set(a,keydict)};
Z.prototype.e=function(a,b){b=b||{};"object"!==r(b)&&h(new T("The attr_dict argument must be an object."));Q(a,function(a){var d=Za(a),e,f,g=m,k={};4===d?(e=a[0],f=a[1],g=a[2],k=a[3]):3===d?(e=a[0],f=a[1],k=a[2]):2===d?(e=a[0],f=a[1]):h(new T("Edge tuple "+Hb(a)+" must be a 2-tuple, 3-tuple or 4-tuple."));a=Wa(b);P(a,k);this.S(e,f,g,a)},this)};Z.prototype.add_edges_from=Z.prototype.e;
Z.prototype.X=function(a,b,c){var d=this.g(a);(!t(d)||!d.d(b))&&h(new T("The edge "+a+"-"+b+" is not in the graph"));this.na(a,b,c)};Z.prototype.remove_edge=Z.prototype.X;Z.prototype.na=function(a,b,c){var d=this.g(a),e=d.get(b);c!=m?(e.d(c)||h(new T("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),e.remove(c)):e.remove(e.D().next());0===e.c()&&(d.remove(b),a!=b&&this.g(b).remove(a))};
Z.prototype.M=function(a){Q(a,function(a){try{this.na(a[0],a[1],a[2])}catch(c){c instanceof T||h(c)}},this)};Z.prototype.remove_edges_from=Z.prototype.M;Z.prototype.C=function(a,b,c){var d=m;if(c!=m)return d=this.g(a),t(d)?d.d(b)&&d.get(b).d(c):n;d=this.g(a);return t(d)&&d.d(b)};Z.prototype.has_edge=Z.prototype.C;Z.prototype.I=function(a,b,c){return H(this.f(a,b,c))};Z.prototype.edges=Z.prototype.I;
Z.prototype.ga=function(a,b,c,d){t(d)||(d=m);return this.a(a)&&this.g(a).d(b)?c!=m?this.g(a).get(b).get(c,d):this.g(a).get(b):d};Z.prototype.get_edge_data=Z.prototype.ga;Z.prototype.B=function(a,b){var c,d;c=this.s(a);b!=m?Wb:d=Xb;return G(c,function(a){var c=a[0],g=0,g=d(c,b)(0,a[1]);return[c,g]})};Z.prototype.degree_iter=Z.prototype.B;Z.prototype.o=aa(l);Z.prototype.is_multigraph=Z.prototype.o;Z.prototype.h=aa(n);Z.prototype.is_directed=Z.prototype.h;
Z.prototype.Y=function(){var a=new $(m,this.i);a.m(this.w(l));a.e(G(this.f(m,l,l),function(a){return[a[0],a[1],a[2],R(a[3])]}));return a};Z.prototype.to_directed=Z.prototype.Y;Z.prototype.oa=function(a,b){function c(){}var d=[],c=a?b?function(a,b){d.push([a,a,b[0],b[1]])}:function(a,b){d.push([a,a,b[1]])}:b?function(a,b){d.push([a,a,b[0]])}:function(a){d.push([a,a])};F(this.s(),function(a){var b=a[1],d=a[0];b.d(d)&&F(Qb(b.get(d)),function(a){c(d,a)})});return d};Z.prototype.selfloop_edges=Z.prototype.oa;
Z.prototype.ca=function(a,b){return a==m?this.size():this.a(a)&&this.C(a,b)?this.g(a).get(b).c():0};Z.prototype.number_of_edges=Z.prototype.ca;Z.prototype.R=function(a){a=this.K(a);var b=new this.constructor(m,this.i),c=b.q,d=this.q,e=b.j;F(a,function(a){var b=X(this);c.set(a,b);F(Qb(d.get(a)),function(d){var e=d[1];d=d[0];if(c.d(d)){var C=X(this);C.N(G(Qb(e),function(a){return[a[0],R(a[1])]}));b.set(d,C);c.get(d).set(a,C)}})});F(c.D(),function(a){e.set(a[0],a[1])});return b};
Z.prototype.subgraph=Z.prototype.R;function Xb(a){return function(b,c){var d=0,d=Fa(c.aa(),function(a){d+=a.c()},d);return d+(+c.d(a)&&c.get(a).c())}}function Wb(a,b){return function(c,d){var e;e=Fa(d.aa(),function(a,c){return a+Fa(c.aa(),function(a,c){return a+O(c,b,1)},0)},0);d.d(a)&&(e=Fa(d.get(a).aa(),function(a,c){return a+O(c,b,1)},e));return e}};function $(a,b){if(!(this instanceof $))return new $(a,b);Y.call(this,a,b)}pa($,Y);var Yb=$.prototype,Zb=Z.prototype,$b;for($b in Zb)Zb.hasOwnProperty($b)&&"constructor"!==$b&&(Yb[$b]=Zb[$b]);y("jsnx.classes.MultiDiGraph",$);y("jsnx.MultiDiGraph",$);$.__name__="MultiDiGraph";$.prototype.ea=function(a,b){this.a(v)||(this.l.set(v,X(this)),this.z.set(v,X(this)),this.j.set(v,b||{}))};
$.prototype.v=function(a,b,c,d){c!=m&&(!x(c)&&!ja(c))&&(d=c,c=m);d=d||{};"object"!==r(d)&&h(new T("The attr_dict argument must be an object."));this.Ha(a,b,c,d)};$.prototype.add_edge=$.prototype.v;
$.prototype.S=function(a,b,c,d){this.O(a);this.O(b);if(this.C(a,b)){keydict=this.g(a).get(b);if(c==m)for(c=keydict.c();keydict.d(c);)c+=1;datadict=keydict.get(c,{});P(datadict,d);keydict.set(c,datadict)}else c!=m||(c=0),datadict={},P(datadict,d),keydict=new Ob,keydict.set(c,datadict),Vb(this,a).set(b,keydict),Ub(this,b).set(a,keydict)};$.prototype.X=function(a,b,c){(!this.a(a)||!this.C(a,b))&&h(new T("The edge "+a+"-"+b+" is not in the graph"));this.Ca(a,b,c)};$.prototype.remove_edge=$.prototype.X;
$.prototype.Ca=function(a,b,c){var d=Vb(this,a).get(b);c!=m?(d.d(c)||h(new T("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),d.remove(c)):d.remove(d.D().next());0===d.c()&&(Vb(this,a).remove(b),Ub(this,b).remove(a))};
$.prototype.T=function(a,b,c,d,e){ha(a)&&(b=a,a=m);var f=n,g=l;d!=m&&(f=d);e!=m&&(g=e);f&&g&&h(Error("Why are you iterating over both directions?"));var k;k=b?c?g?function(a,b,c){return[a,b,c[0],c[1]]}:function(a,b,c){return[b,a,c[0],c[1]]}:g?function(a,b,c){return[a,b,c[1]]}:function(a,b,c){return[b,a,c[1]]}:c?g?function(a,b,c){return[a,b,c[0]]}:function(a,b,c){return[b,a,c[0]]}:g?function(a,b){return[a,b]}:function(a,b){return[b,a]};var q=m,C=m;a=this.s(a,f,g);return gb(a,function(a){q=a[0];return Qb(a[1])},
function(a){C=a[0];return Qb(a[1])},function(a){return k(q,C,a)})};$.prototype.f=function(a,b,c){return this.T(a,b,c,n,l)};$.prototype.edges_iter=$.prototype.f;$.prototype.ma=$.prototype.f;$.prototype.ua=function(a,b,c){return H(this.ma(a,b,c))};$.prototype.out_edges=$.prototype.ua;$.prototype.U=function(a,b,c){return this.T(a,b,c,l,n)};$.prototype.in_edges_iter=$.prototype.U;$.prototype.ma=function(a,b,c){return this.T(a,b,c,n,l)};$.prototype.out_edges_iter=$.prototype.ma;
$.prototype.ia=function(a,b,c){return H(this.U(a,b,c))};$.prototype.in_edges=$.prototype.ia;$.prototype.qa=function(a,b,c,d){var e=n,f=l;c!=m&&(e=c);d!=m&&(f=d);node_nbrs=this.s(a,e,f);var g=Xb;b&&(g=Wb);return G(m,function(a){var c=0,d,s=g(a[0],b);e&&f?(d=a[0][0],c=s(0,a[0][1])+s(0,a[1][1])):(d=a[0],c=s(c,a[1]));return[d,c]})};$.prototype.B=Y.prototype.B;$.prototype.degree_iter=$.prototype.B;$.prototype.ha=Y.prototype.mb;$.prototype.in_degree_iter=$.prototype.ha;$.prototype.da=Y.prototype.da;
$.prototype.out_degree_iter=$.prototype.da;$.prototype.o=aa(l);$.prototype.is_multigraph=$.prototype.o;$.prototype.h=aa(l);$.prototype.is_directed=$.prototype.h;$.prototype.Y=function(){return qb(this)};$.prototype.to_directed=$.prototype.Y;$.prototype.pa=function(a){var b=new Z;b.i=R(this.i);b.m(this.w(l));var c=this;a?F(this.f(m,l,l),function(a){c.C(a[0],a[1],a[2])&&N.Ha(a[0],a[1],a[2],R(a[3]))}):b.e(G(this.f(m,l,l),function(a){return[a[0],a[1],a[2],R(a[3])]}));return b};
$.prototype.to_undirected=$.prototype.pa;$.prototype.R=function(a){a=this.K(a);var b=this,c=new this.constructor(m,this.i),d=c.l,e=c.z,f=this.l;Q(a,function(a){var b=X(c);d.set(a,b);F(Qb(f.get(a)),function(c){var f=c[0];c=c[1];d.d(f)&&(c=c.$(),b.set(f,c),e.get(f).set(a,c))})});F(a,function(a){c.O(a,b.P(a))});return c};$.prototype.subgraph=$.prototype.R;
$.prototype.reverse=function(a){(a=!t(a)||a)?(a=new this.constructor(m,this.i),a.name("Reverse of ("+this.name()+")"),a.m(this.w(l)),a.e(G(this.f(l,l),function(a){return[a[1],a[0],a[2],R(a[3])]}))):(a=this.l,this.l=this.z,this.z=a,this.q=this.l,a=this);return a};$.prototype.reverse=$.prototype.reverse;y("jsnx.nodes",function(a){return a.nodes()});y("jsnx.nodes_iter",function(a){return a.w()});y("jsnx.edges",function(a,b){return a.I(b)});y("jsnx.edges_iter",function(a,b){return a.f(b)});y("jsnx.degree",function(a,b,c){return a.A(b,c)});y("jsnx.neighbors",function(a,b){return a.V(b)});y("jsnx.number_of_nodes",function(a){return a.la()});y("jsnx.number_of_edges",function(a){return a.ca()});y("jsnx.density",function(a){var b=a.la(),c=a.ca();return 0===c?0:a.h()?c/(b*(b-1)):2*c/(b*(b-1))});
y("jsnx.degree_histogram",function(a){a=L(a.A());for(var b=Math.max.apply(Math,a)+1,c=[],d=0;d<b;d++)c[d]=0;ra(a,function(a){c[a]+=1});return c});y("jsnx.is_directed",function(a){return a.h()});y("jsnx.freeze",function(a){function b(){h(new T("Frozen graph can't be modified"))}a.Z=b;a.m=b;a.sa=b;a.va=b;a.v=b;a.e=b;a.X=b;a.M=b;a.clear=b;a.Oa=l;return a});y("jsnx.is_frozen",function(a){return!!a.Oa});y("jsnx.subgraph",function(a,b){return a.R(b)});
y("jsnx.create_empty_copy",function(a,b){t(b)||(b=l);var c=new a.constructor;b&&c.m(a);return c});
y("jsnx.info",function(a,b){var c="";if(b!=m)a.a(b)||h(new T("node "+b+" not in graph")),c=c+("Node "+b+" has the following properties:\n")+("Degree: "+a.A(b)+"\n"),c+="Neighbors: "+a.V(b).join(" ");else{var c=c+("Name: "+a.name()+"\n"),c=c+("Type: "+a.constructor.__name__+"\n"),c=c+("Number of nodes: "+a.la()+"\n"),c=c+("Number of edges: "+a.ca()+"\n"),d=a.la();if(0<d)if(a.h())c+="Average in degree: "+(V.F.apply(m,L(a.za()))/d).toFixed(4)+"\n",c+="Average out degree: "+(V.F.apply(m,L(a.Ba()))/d).toFixed(4);
else var e=V.F.apply(m,L(a.A())),c=c+("Average degree: "+(e/d).toFixed(4))}return c});y("jsnx.set_node_attributes",function(a,b,c){I(c,function(c,e){a.P[e][b]=c})});function ac(a,b){var c={};I(a.P,function(a,e){b in a&&(c[e]=a[b])});return c}y("jsnx.get_node_attributes",ac);y("jsnx.set_edge_attributes",function(a,b,c){I(c,function(b,c){c=c.split(",");a.t(c[0])[c[1]]=b})});ac=function(a,b){var c={};I(a.I(l),function(a){b in a[2]&&(c[[a[0],a[1]]]=a[2][b])});return c};y("jsnx.get_edge_attributes",{}.lb);var bc={};function cc(a,b){a.h()&&h(new T("triangles() is not defined for directed graphs."));if(a.a(b))return Math.floor(dc(a,b).next()[2]/2);var c={};F(dc(a,b),function(a){c[a[0]]=Math.floor(a[2]/2)});return c}y("jsnx.triangles",cc);
function dc(a,b){a.o()&&h(new T("Not defined for multigraphs."));var c;c=b!=m?gb(a.K(b),function(b){return[b,a.t(b)]}):pb(a.adj);return G(c,function(b){var c=new S(M(b[1])),f=0;c.remove(b[0]);F(c,function(b){var d=new S(M(a.t(b)));d.remove(b);f+=vb(c,d).c()});return[b[0],c.c(),f]})}
y("jsnx.average_clustering",function(a,b,c,d){2===arguments.length?x(b)?(c=b,b=m):ha(b)&&(d=b,b=m):3===arguments.length&&ha(c)&&(d=c,c=m);c!=m||(c=m);d!=m||(d=l);var e=L(ec(a,b,c));d||(e=sa(e,function(a){return 0<a}));return V.F.apply(V,e)/e.length});
function ec(a,b,c){a.h()&&h(new T("Clustering algorithms are not defined for directed graphs."));if(c!=m){var d=c;a.o()&&h(new T("Not defined for multigraphs."));t(d)||(d="weight");var e;if(0===a.I().length)c=1;else{c=a.I(l);var f=function(a){return O(a[2],d,1)};c=ka(f)?ab(c,function(){return f.apply(m,arguments)}):eb(c);c=Math.max.apply(m,c)}e=c;c=b!=m?gb(a.K(b),function(b){return[b,a.t(b)]}):pb(a.adj);c=G(c,function(b){var c=b[0],f=new S(M(b[1]));f.remove(c);var g=0,D=new S;F(f,function(b){var k=
O(a.t(c)[b],d,1)/e;D.add(b);var ga=wb(new S(M(a.t(b))),D);F(vb(f,ga),function(f){var C=O(a.t(b)[f],d,1)/e;f=O(a.t(c)[f],d,1)/e;g+=Math.pow(k*C*f,1/3)})});return[c,f.c(),2*g]})}else c=dc(a,b);var g={};F(c,function(a){g[a[0]]=0===a[2]?0:a[2]/(a[1]*(a[1]-1))});return a.a(b)?L(g)[0]:g}y("jsnx.clustering",ec);y("jsnx.transitivity",function(a){var b=0,c=0;F(dc(a),function(a){c+=a[1]*(a[1]-1);b+=a[2]});return 0===b?0:b/c});
y("jsnx.square_clustering",function(a,b){var c=b==m?a:a.K(b),d={};F(c,function(b){var c=d[b]=0;F(db(M(a.t(b))),function(g){var k=g[0];g=g[1];var q=vb(new S(M(a.t(k))),M(a.t(g)));q.remove(b);q=q.c();d[b]+=q;var C=q+1,s=a.t(k);g in s&&(C+=1);c+=(Qa(a.t(k))-C)*(Qa(a.t(g))-C)+q});0<c&&(d[b]/=c)});return a.a(b)?L(d)[0]:d});function fc(a){var b=-1,c={},d=new S;F(a.s(),function(a){var e=new S(M(a[1]));e.remove(a[0]);var f=e.c();f>b?(c[a[0]]=d=e,b=f):c[a[0]]=e});var e=new S(M(c)),f=wb(e,d),g=new S,k=[],q=[];a=new B;a.next=function(){0===f.c()&&0===k.length&&h(A);var a,s;if(0<f.c())a=La(f),f.remove(a);else{var D=k.pop();e=D[0];g=D[1];f=D[2];q.pop();return this.next()}q.push(a);e.remove(a);g.add(a);var U=c[a],D=vb(e,U),U=vb(g,U);if(0===D.c()&&(0===U.c()&&(s=xa(q)),q.pop(),s))return s;if(0===U.c()&&1===D.c())return s=wa(q,
D.J()),q.pop(),s;var Da=D.c(),ga=-1,Ga,ia;for(s=E(U);(a=La(s,m))!==m&&!(a=vb(D,c[a]),ia=a.c(),ia>ga&&(Ga=a,ga=ia,ga===Da)););if(ga===Da)return q.pop(),this.next();b=-1;for(s=E(D);(a=La(s,m))!==m&&!(a=vb(D,c[a]),ia=a.c(),ia>b&&(d=a,b=ia,b===Da-1)););ga>b&&(d=Ga);k.push([e,g,f]);e=D;g=U;f=wb(e,d);return this.next()};return a}y("jsnx.find_cliques",fc);
y("jsnx.find_cliques_recursive",function(a){var b={};F(a.s(),function(a){var c=new S(M(a[1]));c.remove(a[0]);b[a[0]]=c});a:{for(var c in b){a=n;break a}a=l}if(a)return[];a=new S(M(b));c=new S;var d=[];gc(b,a,c,[],d);return d});
function gc(a,b,c,d,e){var f=-1,g=b.c(),k,q,C,s;for(q=E(c);(C=La(q,m))!==m;)if(C=vb(b,a[C]),s=C.c(),s>f&&(k=C,f=s,s===g))return;F(b,function(c){c=vb(b,a[c]);var d=c.c();d>f&&(k=c,f=d)});g=wb(b,k);F(g,function(f){b.remove(f);d.push(f);var g=a[f];f=vb(b,g);g=vb(c,g);f.ba()&&g.ba()?e.push(xa(d)):g.ba()&&1===f.c()?e.push(wa(d,f.J())):gc(a,f,g,d,e);c.add(d.pop())})}y("jsnx.graph_clique_number",function(a,b){b!=m||(b=fc(a));var c=0;Q(b,function(a){c=a.length>c?a.length:c});return c});
y("jsnx.graph_number_of_cliques",function(a,b){b!=m||(b=fc(a));return eb(b).length});function hc(a,b,c){c!=m||(c=H(fc(a)));b!=m||(b=a.nodes());var d;if(fa(b))d={},ra(b,function(a){d[a]=sa(c,function(b){return 0<=qa(b,a)||0<=qa(b,a+"")}).length});else{var e=b;d=sa(c,function(a){return 0<=qa(a,e)||0<=qa(a,e+"")}).length}return d}y("jsnx.number_of_cliques",hc);function ic(a,b){if(a.Q()!=b.Q())return n;var c=a.A(),d=cc(a),e=hc(a),f=[],g;for(g in c)f.push([c[g],d[g],e[g]]);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 c=b.A(),d=cc(b),e=hc(b),k=[];for(g in c)k.push([c[g],d[g],e[g]]);k.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!za(f,k,function(a,b){return za(a,b)})?n:l}y("jsnx.algorithms.isomorphism.could_be_isomorphic",ic);y("jsnx.could_be_isomorphic",ic);
function jc(a,b){if(a.Q()!=b.Q())return n;var c=a.A(),d=cc(a),e=[],f;for(f in c)e.push([c[f],d[f]]);e.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]-b[1]});var c=b.A(),d=cc(b),g=[];for(f in c)g.push([c[f],d[f]]);g.sort(function(a,b){return a[0]!==b[0]?a[0]-b[0]:a[1]-b[1]});return!za(e,g,function(a,b){return za(a,b)})?n:l}y("jsnx.algorithms.isomorphism.fast_could_be_isomorphic",jc);y("jsnx.fast_could_be_isomorphic",jc);
function kc(a,b){if(a.Q()!=b.Q())return n;var c=L(a.A());c.sort();var d=L(b.A());d.sort();return!za(c,d)?n:l}y("jsnx.algorithms.isomorphism.faster_could_be_isomorphic",kc);y("jsnx.faster_could_be_isomorphic",kc);function lc(a,b){if("eg"===b)return mc(a);if(b==m||"hh"===b)return nc(a);h(new Ab("`opt_method` must be 'eg' or 'hh'"))}y("jsnx.is_valid_degree_sequence",lc);function nc(a){if(0===a.length)return l;if(!Oa(a)||0>Math.min.apply(m,a)||0!==V.F.apply(m,a)%2)return n;for(a=xa(a);0<a.length;){z.sort.call(a,Ba);if(0>a[0])break;var b=a.pop();if(0===b)return l;if(b>a.length)break;for(var c=a.length-1,b=a.length-(b+1);c>b;c--)a[c]-=1}return n}y("jsnx.is_valid_degree_sequence_havel_hakimi",nc);
function mc(a){if(0===a.length)return l;if(!Oa(a)||0>Math.min.apply(m,a)||0!==V.F.apply(m,a)%2)return n;var b=a.length,c=xa(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=V.F.apply(m,c.slice(0,d[e])),g=d[e]*(d[e]-1)+V.F.apply(m,H(G(cb(d[e],b),function(a){return Math.min(d[e],c[a])}))),f>g)return n;return l}y("jsnx.is_valid_degree_sequence_erdos_gallai",mc);var oc,pc=m,xc="add_node add_nodes_from add_edge add_edges_from remove_node remove_nodes_from remove_edge remove_edges_from clear".split(" ");
y("jsnx.draw",function(a,b,c){function d(){J.attr("transform",function(a){return["translate(",a.x,",",a.y,")scale(",ea,")"].join("")});Gb()}ha(b)&&(c=b,b=m);b=b||pc||{};var e=b.d3||window.d3,f={};ib(f,yc,b);pc=b;e||h(Error("D3 requried for draw()"));f.element==m&&oc==m&&h(Error("Output element required for draw()"));oc=O(f,"element",oc);e.select(oc).select("svg.jsnx").remove();var g=e.select(oc),k=g.append("svg").classed("jsnx",l).attr("pointer-events","all"),q=k.append("g");b=q.append("g").classed("edges",
l).selectAll("g.edge");var C=q.append("g").classed("nodes",l).selectAll("g.node"),s=e.layout.force(),D=f.width||parseInt(g.style("width"),10),U=f.height||parseInt(g.style("height"),10),Da=f.layout_attr,g=f.nodelist||m,ga,Ga,ia,qc=a.h(),Sa=f.weighted,J=C,K=b;if(f.with_labels){var ua=f.labels;ga="object"===r(ua)?function(a){return O(ua,a.node,"")}:ka(ua)?ua:x(ua)?function(a){return a.data[ua]}:function(a){return a.node}}f.labels=ga;if(Sa){var Ha=f.weights;ia="object"===r(Ha)?function(a){return O(Ha,
a.node,1)}:ka(Ha)?Ha:x(Ha)?function(a){return O(a.data,Ha,1)}:aa(1)}if(f.with_edge_labels){var Ia=f.edge_labels;Ga=Sa&&!t(Ia)?ia:"object"===r(Ia)?function(a){return O(ua,a.node,"")}:ka(Ia)?Ia:x(Ia)?function(a){return a.data[Ia]}:function(a){return a.edge};f.edge_labels=Ga}if(Sa&&f.weighted_stroke){var Sa=Fa(a.f(l),function(a,b){b=ia({data:b[2]});return a>b?a:b},0),Oc=e.scale.linear().range([1,f.edge_style["stroke-width"]]).domain([0,Sa]);f.edge_style["stroke-width"]=function(a){return Oc(ia.call(this,
a))}}k.select("svg.jsnx").remove();k.attr("width",D+"px").attr("height",U+"px").style("opacity",1E-6).transition().duration(1E3).style("opacity",1);var Pc={size:l,nodes:l,links:l,start:l};Q(Da,function(a){if(!(a in Pc))s[a](Da[a])});s.nodes([]).links([]).size([D,U]);var Ta=1,ea=1;if(f.pan_zoom.enabled){var rc=f.pan_zoom.scale,Ja=f.edge_style["stroke-width"];ka(Ja)?f.edge_style["stroke-width"]=function(){var a=Ja.apply(this,arguments);return ea*(+a||parseInt(a,10))}:(Ja=+Ja||parseInt(Ja,10),f.edge_style["stroke-width"]=
function(){return ea*Ja});var jb=n,sc=1,tc=Ta;k.call(e.behavior.zoom().on("zoom",function(){var a=e.event.sourceEvent.shiftKey;(a=rc&&a||!(rc||a))&&!jb?(sc=e.event.scale,tc=Ta,jb=l):!a&&jb&&(jb=n);Ta=a?tc*(e.event.scale/sc):Ta;ea=!a?Ta/e.event.scale:ea;a=e.event.translate;q.attr("transform","translate("+a[0]+","+a[1]+")scale("+e.event.scale+")");q.selectAll("g.edge > .line").style("stroke-width",f.edge_style["stroke-width"]);d()}))}var Gb=da;if(qc){k.append("defs").append("marker").attr("id","Triangle").attr("markerUnits",
"strokeWidth").attr("refX","7").attr("refY","5").attr("viewBox","0 0 10 10").attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z");f.edge_attr["marker-end"]="url(#Triangle)";f.edge_style.fill="none";var kb=f.layout_attr.linkDistance,Ua=f.edge_offset;ka(kb)||(kb=function(){return f.layout_attr.linkDistance});fa(Ua)&&(Ua=function(){return f.edge_offset});ja(Ua)&&(Ua=function(){return[f.edge_offset,f.edge_offset]});Gb=function(){K.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,k=V.xa(c,d,f,g),f=Math.sqrt(Math.pow(f-c,2)+Math.pow(g-d,2)),g=Ua(a),g=[g[0]*ea,g[1]*ea];b.attr("transform",["translate(",c,",",d,")rotate(",k,")"].join(""));if(c=a.G.C(a.target.node,a.source.node)){var d=kb(a)/3,k=-d/(f/2),q=k*f;b.select(".line").attr("d",["M",g[0],k*g[0],"Q",f/2,-d,f-g[1],-k*(f-g[1])+q].join(" "))}else b.select(".line").attr("d",["M",g[0],"0 L",f-g[1],0].join(" "));g=1/ea;b.select("text").attr("x",f*g/2).attr("y",c?g*(-kb(a)/4):
0).attr("transform","scale("+ea+")")}})}}else Gb=function(){K.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,k=a.target.y;a=V.xa(c,d,g,k);g=Math.sqrt(Math.pow(g-c,2)+Math.pow(k-d,2));k=g/2;b.attr("transform",["translate(",c,",",d,")rotate(",a,")"].join(""));b.select(".line").attr("d",["M 0 0 L",g,"0"].join(" "));f.with_edge_labels&&b.select("text").attr("x",k*(1/ea)).attr("y",0).attr("transform","scale("+ea+")"+(90<a&&279>a?"rotate(180,"+k*(1/
ea)+",0)":""))}})};s.on("tick",d);k=a.w();D=a.f();g&&(c=n,k=a.K(g),D=a.f(g));J=zc(a,k,s,C,f.node_shape,ga);K=Ac(a,D,s,b,Ga);Bc(J,{attr:f.node_attr,style:f.node_style,ka:f.label_style,ja:f.label_attr},f.with_labels);Cc(K,{attr:f.edge_attr,style:f.edge_style,ka:f.edge_label_style,ja:f.edge_label_attr},f.with_edge_labels,m,qc);if(c){Dc(a,n);var na=a.constructor.prototype,lb=f.node_shape,mb={attr:f.node_attr,style:f.node_style,ja:f.label_attr,ka:f.label_style},uc={attr:f.edge_attr,style:f.edge_style,
ja:f.edge_label_attr,ka:f.edge_label_style},nb=f.labels,vc=f.edge_labels,ob=f.with_labels,wc=f.with_edge_labels,Qc=a.h();a.add_node=a.Z=function(a){var b=!this.a(a);na.add_node.apply(this,arguments);b&&(J=zc(this,[a],s,J,lb,nb));Bc(J,mb,ob,[a]);s.start()};a.add_nodes_from=a.m=function(a){var b=sa(eb(a),function(a){return!this.a(w(a)?a[0]:a)},this);na.add_nodes_from.apply(this,arguments);0<b.length&&(J=zc(this,b,s,J,lb,nb));Bc(J,mb,ob,a);s.start()};a.add_edge=a.v=function(b,c){var d=!this.C(b,c),e=
[];d&&(e=sa(b==c?[b]:[b,c],function(a){return!this.a(a)},this));na.add_edge.apply(a,arguments);0<e.length&&(J=zc(this,e,s,J,lb,nb),Bc(J,mb,ob,e));d&&(K=Ac(this,[[b,c]],s,K,vc));Cc(K,uc,wc,[[b,c]],Qc);s.start()};a.add_edges_from=a.e=function(b){var c=[],d=[],e={},f={},g=this.h();Q(b,function(a){var b=a[0];a=a[1];if(!this.C(b,a)&&!([b,a]in e)&&(g||!([a,b]in e)))c.push([b,a]),e[[b,a]]=l,!this.a(b)&&!(b in f)&&(d.push(b),f[b]=l),!this.a(a)&&!(a in f)&&(d.push(a),f[a]=l)},this);na.add_edges_from.apply(a,
arguments);0<d.length&&(J=zc(this,d,s,J,lb,nb),Bc(J,mb,ob,d));0<c.length&&(K=Ac(this,c,s,K,vc));Cc(K,uc,wc,c,g);s.start()};a.remove_node=a.sa=function(b){try{if(this.a(b)){J=Ec(this,[b],s,J);var c=this.f([b]);this.h()&&(c=Ka(c,this.U([b])));K=Fc(this,c,s,K);s.resume()}}catch(d){}na.remove_node.apply(a,arguments)};a.remove_nodes_from=a.va=function(b){try{J=Ec(this,b,s,J);var c=this.f(b);this.h()&&(c=Ka(c,this.U(b)));K=Fc(this,c,s,K);s.resume()}catch(d){}na.remove_nodes_from.apply(a,arguments)};a.remove_edge=
a.X=function(b,c){try{K=Fc(this,[[b,c]],s,K),s.resume()}catch(d){}na.remove_edge.apply(a,arguments)};a.remove_edges_from=a.M=function(b){try{K=Fc(this,b,s,K),s.resume()}catch(c){}na.remove_edges_from.apply(a,arguments)};a.clear=a.clear=function(){J=J.data([],Gc);J.exit().remove();K=K.data([],Hc);K.exit().remove();s.nodes([]).links([]).resume();na.clear.apply(a,arguments)};a.bound=l}else a.bound?Dc(a):Ic(a);s.start();return s});
function zc(a,b,c,d,e,f){var g=c.nodes();Q(b,function(b){var c=a.node[b];b={node:b,data:c,G:a};g.push(b);c.__d3datum__=b});d=d.data(g,Gc);b=d.enter().append("g").classed("node",l).call(c.drag);b.append(e).classed("node-shape",l);f&&b.append("text").text(f);return d}
function Ac(a,b,c,d,e){var f=c.links();Q(b,function(b){var c=b[0],d=b[1];b=b[2]||a.ga(c,d);c={edge:[c,d],redge:[d,c],source:a.node[c].__d3datum__,target:a.node[d].__d3datum__,data:b,G:a};f.push(c);b.__d3datum__=c});d=d.data(f,Hc);b=d.enter().append("g").classed("edge",l);b.append("path").classed("line",l);e&&b.append("text").text(e);return d}
function Bc(a,b,c,d){if(d!=m){var e={};Q(d,function(a){e[w(a)?a[0]:a]=l});a=a.filter(function(a){return a.node in e})}var f=a.selectAll(".node-shape");I(b.attr,function(a,b){f.attr(b,a)});I(b.style,function(a,b){f.style(b,a)});if(c){var g=a.selectAll("text");I(b.ja,function(a,b){g.attr(b,a)});I(b.ka,function(a,b){g.style(b,a)})}}
function Cc(a,b,c,d,e){if(d!=m){var f={};Q(d,function(a){f[[a[0],a[1]]]=l});a=a.filter(function(a){return a.edge in f||e||a.redge in f})}var g=a.selectAll(".line");I(b.attr,function(a,b){g.attr(b,a)});I(b.style,function(a,b){g.style(b,a)});if(c){var k=a.selectAll("text");I(b.ja,function(a,b){k.attr(b,a)});I(b.ka,function(a,b){k.style(b,a)})}}function Gc(a){return a.node}function Hc(a){return a.edge}
function Ec(a,b,c,d){var e=c.nodes();Q(a.K(b),function(b){va(e,a.node[b].__d3datum__)});d=d.data(e,Gc);d.exit().remove();return d}function Fc(a,b,c,d){var e=c.links();Q(b,function(b){va(e,O(a.ga(b[0],b[1],{}),"__d3datum__",m))});d=d.data(e,Hc);d.exit().remove();return d}y("jsnx.is_bound",function(a){return a.bound});function Dc(a,b){if(a.bound){var c=a.constructor.prototype;ra(xc,function(b){a[b]=c[b]});delete a.bound;(!t(b)||b)&&Ic(a)}}y("jsnx.unbind",Dc);
function Ic(a){Q(a.w(l),function(a){Va(a[1])});Q(a.f(l),function(a){Va(a[2])})}
var yc={layout_attr:{charge:-120,linkDistance:40},node_shape:"circle",node_attr:{r:10},node_style:{stroke:"#333",fill:"#999",cursor:"pointer"},edge_attr:{},edge_style:{stroke:"#000","stroke-width":2},label_attr:{},label_style:{"text-anchor":"middle","dominant-baseline":"central",cursor:"pointer","-webkit-user-select":"none",fill:"#000"},edge_label_attr:{},edge_label_style:{"font-size":"0.8em","dominant-baseline":"central","text-anchor":"middle","-webkit-user-select":"none"},with_labels:n,with_edge_labels:n,
edge_offset:10,weighted:n,weights:"weight",weighted_stroke:l,pan_zoom:{enabled:l,scale:l}};function Jc(a,b){var c=Kc(a,b);c.name("complete_graph("+a+")");1<a&&c.e(c.h()?fb(cb(a)):db(cb(a)));return c}y("jsnx.complete_graph",Jc);y("jsnx.cycle_graph",function(a,b){var c=Lc(a,b);c.name("cycle_graph("+a+")");1<a&&c.v(a-1,0);return c});function Kc(a,b){a instanceof W&&(b=a,a=m);a!=m||(a=0);var c;b!=m?(c=b,c.clear()):c=new W;c.m(cb(a));c.name("empty_graph("+a+")");return c}y("jsnx.empty_graph",Kc);y("jsnx.null_graph",function(a){a=Kc(0,a);a.name("null_graph()");return a});
function Lc(a,b){var c=Kc(a,b);c.name("path_graph("+a+")");c.e(G(cb(a-1),function(a){return[a,a+1]}));return c}y("jsnx.path_graph",Lc);y("jsnx.trivial_graph",function(a){a=Kc(1,a);a.name("null_graph()");return a});y("jsnx.fast_gnp_random_graph",function(a,b,c){c!=m||(c=n);var d=Kc(a);d.name("fast_gnp_random_graph("+a+","+b+")");if(0>=b||1<=b)return Mc(a,b,c);var e=1,f=-1;b=Math.log(1-b);if(c)for(d=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.v(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.v(e,f)}return d});
function Mc(a,b,c){var d;d=c?Y():W();d.m(cb(a));d.name("gnp_random_graph("+a+","+b+")");if(0>=b)return d;if(1<=b)return Jc(a,d);a=d.h()?fb(cb(a)):db(cb(a));F(a,function(a){Math.random()<b&&d.v(a[0],a[1])});return d}y("jsnx.gnp_random_graph",Mc);y("jsnx.binomial_graph",Mc);y("jsnx.erdos_renyi_graph",Mc);y("jsnx.havel_hakimi_graph",function(a,b){lc(a)||h(new T("Invalid degree sequence"));b!=m&&(b.h()&&h(new T("Directed Graph not supported")),b.o()&&h(new T("Havel-Hakimi requires simple graph")));var c=a.length,d=Kc(c,b);if(0===c||0===Math.max.apply(m,a))return d;for(c=H(G(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.v(e[1],
c[g][1]),c[g][0]-=1}d.name("havel_hakimi_graph "+d.Q()+" nodes "+d.size()+" edges");return d});function Nc(a,b,c){var d=b;ka(b)&&(d={},F(a.w(),function(a){d[a]=b(a)}));var e;if(!t(c)||c){var f=d;e=new a.constructor;e.name("("+a.name()+")");a.o()?e.e(G(a.f(l,l),function(a){return[O(f,a[0],a[0]),O(f,a[1],a[1]),a[2],Wa(a[3])]})):e.e(G(a.f(l),function(a){return[O(f,a[0],a[0]),O(f,a[1],a[1]),Wa(a[2])]}));e.m(G(a,function(a){return O(f,a,a)}));c={};for(var g in a.node)c[O(f,g,g)]=Wa(a.node[g]);P(e.node,c);P(e.graph,Wa(a.graph))}else{var k=d;g=new S(M(k));if(0<vb(g,k).c()){g=Y;var q=[];I(k,function(a,
b){q.push([b,a])});g=g(q);g.M(g.oa());try{e=bc.jb.Bb(g)}catch(C){C instanceof Db&&h(new Db("The node label sets are overlapping and no ordering can resolve the mapping. Use copy=True."))}e.reverse()}else e=g;var s=a.o(),D=a.h(),U;F(e,function(b){var c;b in k&&(c=k[b],a.a(b)||h(new T("Node "+b+" is not in the graph.")),a.Z(c,a.node[b]),s?(U=ta(a.I(b,l,l),function(a){return[c,a[1],a[2],a[3]]}),D&&(U=wa(U,ta(a.ia(b,l,l),function(a){return[a[0],c,a[2],a[3]]})))):(U=ta(a.I(b,l),function(a){return[c,a[1],
a[2]]}),D&&(U=wa(U,ta(a.ia(b,l),function(a){return[a[0],c,a[2]]})))),a.sa(b),a.e(U))});e=a}return e}y("jsnx.relabel_nodes",Nc);
y("jsnx.convert_node_labels_to_integers",function(a,b,c,d){3===arguments.length&&ha(c)?(d=c,c=m):2===arguments.length&&(ha(b)?(d=b,b=m):x(b)&&(c=b,b=m));b!=m||(b=0);c!=m||(c="default");d!=m||(d=l);var e={},f,g,k,q;if("default"===c){f=a.nodes();g=0;k=b;for(q=f.length;g<q;g++,k++)e[f[g]]=k}else if("sorted"===c){f=a.nodes();f.sort();g=0;k=b;for(q=f.length;g<q;g++,k++)e[f[g]]=k}else if("increasing degree"===c){f=H(a.B());f.sort(function(a,b){return a[1]-b[1]});g=0;k=b;for(q=f.length;g<q;g++,k++)e[f[g][0]]=
k}else if("decreasing degree"===c){f=H(a.B());f.sort(function(a,b){return b[1]-a[1]});g=0;k=b;for(q=f.length;g<q;g++,k++)e[f[g][0]]=k}else h(new T("Unkown node ordering: "+c));g=Nc(a,e);g.name("("+a.name()+")_with_int_labels");d||(g.node_labels=e);return g});}());
=======
(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,m=null,n=!1;function da(a){return function(){return a}}var q,ea=this;function fa(){}
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 ga(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 ha(a){return"boolean"==typeof a}function ia(a){return"number"==typeof a}function ka(a){return"function"==r(a)}function la(a){var b=typeof a;return"object"==b&&a!=m||"function"==b}var ma="closure_uid_"+(1E9*Math.random()>>>0),na=0;
function oa(a,b,c){return a.call.apply(a.bind,arguments)}function pa(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 qa(a,b,c){qa=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?oa:pa;return qa.apply(m,arguments)}
function v(a,b){var c=a.split("."),d=ea;!(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 ra(a,b){function c(){}c.prototype=b.prototype;a.Wa=b.prototype;a.prototype=new c;a.prototype.constructor=a};var w=Array.prototype,sa=w.indexOf?function(a,b,c){return w.indexOf.call(a,b,c)}:function(a,b,c){c=c==m?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=w.forEach?function(a,b,c){w.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)},ta=w.filter?function(a,b,c){return w.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=u(a)?a.split(""):
a,l=0;l<d;l++)if(l in g){var p=g[l];b.call(c,p,l,a)&&(e[f++]=p)}return e},ua=w.map?function(a,b,c){return w.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 va(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}
function ya(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?m:u(a)?a.charAt(c):a[c]}function za(a,b){var c=sa(a,b);0<=c&&w.splice.call(a,c,1)}function Aa(a){return w.concat.apply(w,arguments)}function Ba(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 Ea(a,b,c,d){w.splice.apply(a,Fa(arguments,1))}
function Fa(a,b,c){return 2>=arguments.length?w.slice.call(a,b):w.slice.call(a,b,c)}function Ga(a,b,c){if(!t(a)||!t(b)||a.length!=b.length)return n;var d=a.length;c=c||La;for(var e=0;e<d;e++)if(!c(a[e],b[e]))return n;return k}function Ma(a,b){return a>b?1:a<b?-1:0}function La(a,b){return a===b}function Na(a){for(var b=[],c=0;c<a;c++)b[c]=0;return b}
function Oa(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)}};var z="StopIteration"in ea?ea.StopIteration:Error("StopIteration");function A(){}A.prototype.next=function(){h(z)};A.prototype.J=function(){return this};function Ra(a){if(a instanceof A)return a;if("function"==typeof a.J)return a.J(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=Ra(a);try{for(;;)b.call(c,a.next(),aa,a)}catch(e){e!==z&&h(e)}}}function Sa(a,b,c){var d=Ra(a);a=new A;a.next=function(){for(;;){var a=d.next();return b.call(c,a,aa,d)}};return a}function Ta(a,b,c){var d=c;B(a,function(a){d=b.call(aa,d,a)});return d}function Ua(a){var b=arguments,c=b.length,d=0,e=new A;e.next=function(){try{return d>=c&&h(z),Ra(b[d]).next()}catch(a){return(a!==z||d>=c)&&h(a),d++,this.next()}};return e}
function Va(a){if(t(a))return Ba(a);a=Ra(a);var b=[];B(a,function(a){b.push(a)});return b}function Wa(a,b){try{return Ra(a).next()}catch(c){return c!=z&&h(c),b}};function C(a,b,c){for(var d in a)b.call(c,a[d],d,a)}function Xa(a,b,c){var d={},e;for(e in a)d[e]=b.call(c,a[e],e,a);return d}function E(a){var b=0,c;for(c in a)b++;return b}function Ya(a){for(var b in a)return b}function Za(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function F(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function $a(a){for(var b in a)return n;return k}function ab(a){for(var b in a)delete a[b]}function G(a,b){b in a&&delete a[b]}function H(a,b,c){return b in a?a[b]:c}
function cb(a){var b={},c;for(c in a)b[c]=a[c];return b}var db="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function I(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<db.length;f++)c=db[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}}
function eb(a){var b=arguments.length;if(1==b&&ga(arguments[0]))return eb.apply(m,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};var J={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)},Ca: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)},ea:function(a){return J.Ca(a,360)},oa:function(a){return a*Math.PI/180},Ha:function(a){return 180*a/Math.PI},Ja:function(a,b){return b*Math.cos(J.oa(a))},Ka:function(a,b){return b*Math.sin(J.oa(a))},ga:function(a,
b,c,d){return J.ea(J.Ha(Math.atan2(d-b,c-a)))},Ia:function(a,b){var c=J.ea(b)-J.ea(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=[],l=0;l<e+1;l++)g[l]=[],g[l][0]=0;for(var p=0;p<f+1;p++)g[0][p]=0;for(l=1;l<=e;l++)for(p=1;p<=e;p++)c(a[l-1],b[p-1])?g[l][p]=g[l-1][p-1]+1:g[l][p]=Math.max(g[l-1][p],g[l][p-1]);for(var D=[],l=e,p=f;0<l&&0<p;)c(a[l-1],b[p-
1])?(D.unshift(d(l-1,p-1)),l--,p--):g[l-1][p]>g[l][p-1]?l--:p--;return D},q:function(a){return va(arguments,function(a,c){return a+c})},va:function(a){return J.q.apply(m,arguments)/arguments.length},Va:function(a){var b=arguments.length;if(2>b)return 0;var c=J.va.apply(m,arguments),b=J.q.apply(m,ua(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 fb(a){return Ta(K(a),function(a,c){a[c[0]]=c[1];return a},{})}function gb(a){return a instanceof A||ka(a.J)}function hb(a){if(a instanceof M)return a.M();if(u(a)||t(a))return a.length;if(ib(a))return E(a);h(new TypeError)}function N(a,b,c,d){ha(c)&&(d=c,c=m);if(d){var e=b;b=function(a){e.apply(this,a)}}a instanceof M?B(K(a),b,c):gb(a)?B(a,b,c):t(a)||u(a)?y(a,b,c):la(a)&&N(F(a),b,c)}v("jsnx.forEach",N);
function O(a,b,c){if(a instanceof M)return O(K(a),b,c);if(t(a))return ua(a,b,c);if(gb(a))return Sa(a,b,c);if(la(a))return Xa(a,b,c);h(new TypeError)}function jb(a){var b=arguments,c=b[0];if(t(c))return Oa.apply(m,b);if(gb(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(la(c))return Oa.apply(m,ua(b,F));h(new TypeError)}function kb(a,b){a=ka(b)?P(O(a,function(){return b.apply(m,arguments)})):P(a);return Math.max.apply(m,a)}
function Q(a,b,c){if(0===arguments.length)return Ra([]);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 lb(a){var b=P(a),c=b.length;if(2>c)return new A;var d=P(Q(2));a=new A;a.next=function(){var a=ua(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 ua(d,function(a){return b[a]})};return a};return a}
function mb(a){var b=P(a),c=b.length,d=ia(2)?2:c;if(d>c)return new A;var e=P(Q(c)),f=P(Q(c,c-d,-1));a=new A;var g=new A,l,p=k;a.next=function(){this.next=l.next;return ua(e.slice(0,d),function(a){return b[a]})};g.next=function(){return p};l=R(g,function(a){a||h(z);p=n;return Q(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],l=e[a];e[a]=e[e.length-g];e[e.length-g]=l;p=k;return K([ua(e.slice(0,d),function(a){return b[a]})])}},
function(a){return a});return a}function nb(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]=S(d[c]):"object"===r(a[c])&&"object"===r(d)&&nb(a[c],d[c]);for(var f=0;f<db.length;f++)c=db[f],Object.prototype.hasOwnProperty.call(d,c)&&(!s(a[c])||"object"!==r(a[c])?a[c]=S(d[c]):"object"===r(a[c])&&"object"===r(d)&&nb(a[c],d[c]))}}
function P(a){if(a instanceof M)return P(K(a));if(t(a))return Ba(a);if(gb(a))return Va(a);if(la(a))return F(a);h(new TypeError)}v("jsnx.toArray",P);function ob(a){var b=[];C(a,function(a,d){b.push([d,a])});return b}function T(a){var b=new A,c=Ra(F(a));b.next=function(){var b=c.next();return[b,a[b]]};return b}function K(a){if(a instanceof M)return K(a.adj);"object"===r(a)&&(!t(a)&&!gb(a))&&(a=F(a));return Ra(a)}
function R(a,b){var c=new A,d=Fa(arguments,1);if(0===d.length)return a;try{a=Ra(a)}catch(e){return c.next=function(){"Not implemented"===e.message&&h(new TypeError)},c}var f=m;c.next=function(){var b,e;try{for(;!s(b);)b=f.next()}catch(p){for(;!s(e)||!s(b);)e=a.next(),b=d[0](e);if(gb(b))return f=R.apply(m,Aa([b],Fa(d,1))),c.next();f=m}return b};return c}v("jsnx.sentinelIterator",function(a,b){var c=new A;c.next=function(){return Wa(a,b)};return c});
function ib(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 S(a,b){b=b||[];var c=r(a);if("object"==c&&ib(a)||"array"==c){var d=ya(b,function(b){return a===b[0]});if(d!==m)return d[1];if(a.$)return d=[a,a.$()],b.push(d),d[1];c="array"==c?[]:{};d=[a,c];b.push(d);for(var e in a)c[e]=S(a[e],b);return c}return a}function qb(a){function b(){}var c={},d;b.prototype=a.constructor.prototype;for(d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);c=S(c);a=new b;for(d in c)a[d]=c[d];return a}var sb=function rb(b,c){return 0===c?b:rb(c,b%c)};var tb,ub=m,vb="add_node add_nodes_from add_edge add_edges_from remove_node remove_nodes_from remove_edge remove_edges_from clear".split(" ");
v("jsnx.draw",function(a,b,c){function d(){wa.f.attr("transform",function(a){return["translate(",a.x,",",a.y,")scale(",ja,")"].join("")});pb()}ha(b)&&(c=b,b=m);b=b||ub||{};var e=b.d3||window.d3,f={};nb(f,wb,b);ub=b;e||h(Error("D3 requried for draw()"));f.element==m&&tb==m&&h(Error("Output element required for draw()"));tb=H(f,"element",tb);e.select(tb).select("svg.jsnx").remove();var g=e.select(tb),l=g.append("svg").classed("jsnx",k).attr("pointer-events","all"),p=l.append("g");b=p.append("g").classed("edges",
k).selectAll("g.edge");var D=p.append("g").classed("nodes",k).selectAll("g.node"),x=e.layout.force(),L=f.width||parseInt(g.style("width"),10),V=f.height||parseInt(g.style("height"),10),Ha=f.layout_attr,g=f.nodelist||m,ba,ca,W,Ca=a.c(),xa=f.weighted,wa={f:D,g:b};if(f.with_labels){var Da=f.labels;ba="object"===r(Da)?function(a){return H(Da,a.node,"")}:ka(Da)?Da:u(Da)?function(a){return a.data[Da]}:function(a){return a.node}}f.labels=ba;if(xa){var Ia=f.weights;W="object"===r(Ia)?function(a){return H(Ia,
a.node,1)}:ka(Ia)?Ia:u(Ia)?function(a){return H(a.data,Ia,1)}:da(1)}if(f.with_edge_labels){var Ja=f.edge_labels;ca=xa&&!s(Ja)?W:"object"===r(Ja)?function(a){return H(Da,a.node,"")}:ka(Ja)?Ja:u(Ja)?function(a){return a.data[Ja]}:function(a){return a.edge};f.edge_labels=ca}if(xa&&f.weighted_stroke){var xa=Ta(a.e(m,k),function(a,b){b=W({data:b[2]});return a>b?a:b},0),Pc=e.scale.linear().range([1,f.edge_style["stroke-width"]]).domain([0,xa]);f.edge_style["stroke-width"]=function(a){return Pc(W.call(this,
a))}}l.select("svg.jsnx").remove();l.attr("width",L+"px").attr("height",V+"px").style("opacity",1E-6).transition().duration(1E3).style("opacity",1);var Qc={size:k,nodes:k,links:k,start:k};N(Ha,function(a){if(!(a in Qc))x[a](Ha[a])});x.nodes([]).links([]).size([L,V]);var Pa=1,ja=1;if(f.pan_zoom.enabled){var Tb=f.pan_zoom.scale,Ka=f.edge_style["stroke-width"];ka(Ka)?f.edge_style["stroke-width"]=function(){var a=Ka.apply(this,arguments);return ja*(+a||parseInt(a,10))}:(Ka=+Ka||parseInt(Ka,10),f.edge_style["stroke-width"]=
function(){return ja*Ka});(function(){var a=n,b=1,c=Pa;l.call(e.behavior.zoom().on("zoom",function(){var g=e.event.sourceEvent.shiftKey;(g=Tb&&g||!(Tb||g))&&!a?(b=e.event.scale,c=Pa,a=k):!g&&a&&(a=n);Pa=g?c*(e.event.scale/b):Pa;ja=!g?Pa/e.event.scale:ja;g=e.event.translate;p.attr("transform","translate("+g[0]+","+g[1]+")scale("+e.event.scale+")");p.selectAll("g.edge > .line").style("stroke-width",f.edge_style["stroke-width"]);d()}))})()}var pb=fa;if(Ca){l.append("defs").append("marker").attr("id",
"Triangle").attr("markerUnits","strokeWidth").attr("refX","7").attr("refY","5").attr("viewBox","0 0 10 10").attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z");f.edge_attr["marker-end"]="url(#Triangle)";f.edge_style.fill="none";var bb=f.layout_attr.linkDistance,Qa=f.edge_offset;ka(bb)||(bb=function(){return f.layout_attr.linkDistance});ga(Qa)&&(Qa=function(){return f.edge_offset});ia(Qa)&&(Qa=function(){return[f.edge_offset,f.edge_offset]});pb=function(){wa.g.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,l=J.ga(c,d,f,g),f=Math.sqrt(Math.pow(f-c,2)+Math.pow(g-d,2)),g=Qa(a),g=[g[0]*ja,g[1]*ja];b.attr("transform",["translate(",c,",",d,")rotate(",l,")"].join(""));if(c=a.G.H(a.target.node,a.source.node)){var d=bb(a)/3,l=-d/(f/2),p=l*f;b.select(".line").attr("d",["M",g[0],l*g[0],"Q",f/2,-d,f-g[1],-l*(f-g[1])+p].join(" "))}else b.select(".line").attr("d",["M",g[0],"0 L",f-g[1],0].join(" "));g=1/ja;b.select("text").attr("x",
f*g/2).attr("y",c?g*(-bb(a)/4):0).attr("transform","scale("+ja+")")}})}}else pb=function(){wa.g.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,l=a.target.y;a=J.ga(c,d,g,l);g=Math.sqrt(Math.pow(g-c,2)+Math.pow(l-d,2));l=g/2;b.attr("transform",["translate(",c,",",d,")rotate(",a,")"].join(""));b.select(".line").attr("d",["M 0 0 L",g,"0"].join(" "));f.with_edge_labels&&b.select("text").attr("x",l*(1/ja)).attr("y",0).attr("transform","scale("+ja+")"+
(90<a&&279>a?"rotate(180,"+l*(1/ja)+",0)":""))}})};x.on("tick",d);L=a.v();V=a.e();g&&(c=n,L=a.d(g),V=a.e(g));wa.f=xb(a,L,x,D,f.node_shape,ba);wa.g=yb(a,V,x,b,ca);zb(wa.f,{attr:f.node_attr,style:f.node_style,U:f.label_style,T:f.label_attr},f.with_labels);Ab(wa.g,{attr:f.edge_attr,style:f.edge_style,U:f.edge_label_style,T:f.edge_label_attr},f.with_edge_labels,m,Ca);c?Bb(a,x,f,wa):a.bound?Cb(a):Db(a);x.start();return x});
function xb(a,b,c,d,e,f){var g=c.nodes();N(b,function(b){var c=a.node[b];b={node:b,data:c,G:a};g.push(b);c.__d3datum__=b});d=d.data(g,Eb);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 yb(a,b,c,d,e){var f=c.links();N(b,function(b){var c=b[0],d=b[1];b=b[2]||a.P(c,d);c={edge:[c,d],redge:[d,c],source:a.node[c].__d3datum__,target:a.node[d].__d3datum__,data:b,G:a};f.push(c);b.__d3datum__=c});d=d.data(f,Fb);b=d.enter().append("g").classed("edge",k);b.append("path").classed("line",k);e&&b.append("text").text(e);return d}
function zb(a,b,c,d){if(d!=m){var e={};N(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");C(b.attr,function(a,b){f.attr(b,a)});C(b.style,function(a,b){f.style(b,a)});if(c){var g=a.selectAll("text");C(b.T,function(a,b){g.attr(b,a)});C(b.U,function(a,b){g.style(b,a)})}}
function Ab(a,b,c,d,e){if(d!=m){var f={};N(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");C(b.attr,function(a,b){g.attr(b,a)});C(b.style,function(a,b){g.style(b,a)});if(c){var l=a.selectAll("text");C(b.T,function(a,b){l.attr(b,a)});C(b.U,function(a,b){l.style(b,a)})}}function Eb(a){return a.node}function Fb(a){return a.edge}
function Gb(a,b,c,d){var e=c.nodes();N(a.d(b),function(b){za(e,a.node[b].__d3datum__)});d=d.data(e,Eb);d.exit().remove();return d}function Hb(a,b,c,d){var e=c.links();N(b,function(b){za(e,H(a.P(b[0],b[1],{}),"__d3datum__",m))});d=d.data(e,Fb);d.exit().remove();return d}
function Bb(a,b,c,d){Cb(a,n);var e=a.constructor.prototype,f=c.node_shape,g={attr:c.node_attr,style:c.node_style,T:c.label_attr,U:c.label_style},l={attr:c.edge_attr,style:c.edge_style,T:c.edge_label_attr,U:c.edge_label_style},p=c.labels,D=c.edge_labels,x=c.with_labels,L=c.with_edge_labels,V=a.c();a.add_node=a.D=function(a){var c=!this.l(a);e.add_node.apply(this,arguments);c&&(d.f=xb(this,[a],b,d.f,f,p));zb(d.f,g,x,[a]);b.start()};a.add_nodes_from=a.j=function(a){var c=ta(P(a),function(a){return!this.l(t(a)?
a[0]:a)},this);e.add_nodes_from.apply(this,arguments);0<c.length&&(d.f=xb(this,c,b,d.f,f,p));zb(d.f,g,x,a);b.start()};a.add_edge=a.a=function(c,ba){var ca=!this.H(c,ba),W=[];ca&&(W=ta(c==ba?[c]:[c,ba],function(a){return!this.l(a)},this));e.add_edge.apply(a,arguments);0<W.length&&(d.f=xb(this,W,b,d.f,f,p),zb(d.f,g,x,W));ca&&(d.g=yb(this,[[c,ba]],b,d.g,D));Ab(d.g,l,L,[[c,ba]],V);b.start()};a.add_edges_from=a.b=function(c){var V=[],ca=[],W={},Ca={},xa=this.c();N(c,function(a){var b=a[0];a=a[1];if(!this.H(b,
a)&&!([b,a]in W)&&(xa||!([a,b]in W)))V.push([b,a]),W[[b,a]]=k,!this.l(b)&&!(b in Ca)&&(ca.push(b),Ca[b]=k),!this.l(a)&&!(a in Ca)&&(ca.push(a),Ca[a]=k)},this);e.add_edges_from.apply(a,arguments);0<ca.length&&(d.f=xb(this,ca,b,d.f,f,p),zb(d.f,g,x,ca));0<V.length&&(d.g=yb(this,V,b,d.g,D));Ab(d.g,l,L,V,xa);b.start()};a.remove_node=a.N=function(c){try{if(this.l(c)){d.f=Gb(this,[c],b,d.f);var f=this.e([c]);this.c()&&(f=Ua(f,this.I([c])));d.g=Hb(this,f,b,d.g);b.resume()}}catch(g){}e.remove_node.apply(a,
arguments)};a.remove_nodes_from=a.X=function(c){try{d.f=Gb(this,c,b,d.f);var f=this.e(c);this.c()&&(f=Ua(f,this.I(c)));d.g=Hb(this,f,b,d.g);b.resume()}catch(g){}e.remove_nodes_from.apply(a,arguments)};a.remove_edge=a.u=function(c,f){try{d.g=Hb(this,[[c,f]],b,d.g),b.resume()}catch(g){}e.remove_edge.apply(a,arguments)};a.remove_edges_from=a.B=function(c){try{d.g=Hb(this,c,b,d.g),b.resume()}catch(f){}e.remove_edges_from.apply(a,arguments)};a.clear=a.clear=function(){d.f=d.f.data([],Eb);d.f.exit().remove();
d.g=d.g.data([],Fb);d.g.exit().remove();b.nodes([]).links([]).resume();e.clear.apply(a,arguments)};a.bound=k}v("jsnx.is_bound",function(a){return a.bound});function Cb(a,b){if(a.bound){var c=a.constructor.prototype;y(vb,function(b){a[b]=c[b]});delete a.bound;(!s(b)||b)&&Db(a)}}v("jsnx.unbind",Cb);function Db(a){N(a.v(k),function(a){G(a[1],"__d3datum__")});N(a.e(m,k),function(a){G(a[2],"__d3datum__")})}
var wb={layout_attr:{charge:-120,linkDistance:40},node_shape:"circle",node_attr:{r:10},node_style:{stroke:"#333",fill:"#999",cursor:"pointer"},edge_attr:{},edge_style:{stroke:"#000","stroke-width":2},label_attr:{},label_style:{"text-anchor":"middle","dominant-baseline":"central",cursor:"pointer","-webkit-user-select":"none",fill:"#000"},edge_label_attr:{},edge_label_style:{"font-size":"0.8em","dominant-baseline":"central","text-anchor":"middle","-webkit-user-select":"none"},with_labels:n,with_edge_labels:n,
edge_offset:10,weighted:n,weights:"weight",weighted_stroke:k,pan_zoom:{enabled:k,scale:k}};function Ib(a){if("function"==typeof a.F)return a.F();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 Za(a)};function Jb(a,b){this.k={};this.n=[];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.ca(a)}q=Jb.prototype;q.z=0;q.Z=0;q.h=function(){return this.z};q.F=function(){Kb(this);for(var a=[],b=0;b<this.n.length;b++)a.push(this.k[this.n[b]]);return a};q.S=function(){return 0==this.z};q.clear=function(){this.k={};this.Z=this.z=this.n.length=0};
q.remove=function(a){return Object.prototype.hasOwnProperty.call(this.k,a)?(delete this.k[a],this.z--,this.Z++,this.n.length>2*this.z&&Kb(this),k):n};function Kb(a){if(a.z!=a.n.length){for(var b=0,c=0;b<a.n.length;){var d=a.n[b];Object.prototype.hasOwnProperty.call(a.k,d)&&(a.n[c++]=d);b++}a.n.length=c}if(a.z!=a.n.length){for(var e={},c=b=0;b<a.n.length;)d=a.n[b],Object.prototype.hasOwnProperty.call(e,d)||(a.n[c++]=d,e[d]=1),b++;a.n.length=c}}
q.set=function(a,b){Object.prototype.hasOwnProperty.call(this.k,a)||(this.z++,this.n.push(a),this.Z++);this.k[a]=b};q.ca=function(a){var b;a instanceof Jb?(Kb(a),b=a.n.concat(),a=a.F()):(b=F(a),a=Za(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};q.$=function(){return new Jb(this)};
q.J=function(a){Kb(this);var b=0,c=this.n,d=this.k,e=this.Z,f=this,g=new A;g.next=function(){for(;;){e!=f.Z&&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 U(a){this.k=new Jb;a&&this.ca(a)}function Lb(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ma]||(a[ma]=++na)):b.substr(0,1)+a}q=U.prototype;q.h=function(){return this.k.h()};q.add=function(a){this.k.set(Lb(a),a)};q.ca=function(a){a=Ib(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};q.remove=function(a){return this.k.remove(Lb(a))};q.clear=function(){this.k.clear()};q.S=function(){return this.k.S()};
q.contains=function(a){a=Lb(a);return Object.prototype.hasOwnProperty.call(this.k.k,a)};function Mb(a,b){for(var c=new U,d=Ib(b),e=0;e<d.length;e++){var f=d[e];a.contains(f)&&c.add(f)}return c}function Nb(a,b){for(var c=a.$(),d=Ib(b),e=d.length,f=0;f<e;f++)c.remove(d[f]);return c}q.F=function(){return this.k.F()};q.$=function(){return new U(this)};q.J=function(){return this.k.J(n)};function Ob(a){if(a!=m)try{a.clear()}catch(b){h(Error("Input graph is not a jsnx graph type"))}else a=new M;return a}
function Pb(a,b,c){var d=m;if(a.hasOwnProperty("adj"))try{return d=Qb(a.adj,b,a.m()),"graph"in a&&"object"===r(a.graph)&&(d.graph=cb(a.graph)),"node"in a&&"object"===r(a.node)&&(d.node=Xa(a.node,function(a){return cb(a)})),d}catch(e){h(Error("Input is not a correct jsnx graph"))}if("object"===r(a))try{return Qb(a,b,c)}catch(f){try{return Rb(a,b)}catch(g){h(Error("Input is not known type."))}}if(t(a))try{return Sb(a,b)}catch(l){h(Error("Input is not valid edge list"))}return d}
v("jsnx.to_networkx_graph",Pb);v("jsnx.convert_to_undirected",function(a){return a.O()});v("jsnx.convert_to_undirected",function(a){return a.C()});v("jsnx.to_dict_of_lists",function(a,b){function c(a){return 0<=sa(b,a)}var d={};b!=m?b=P(b):(b=a,c=function(a){return b.l(a)});N(b,function(b){d[b]=ta(a.K(b),c)});return d});
function Rb(a,b){var c=Ob(b);c.j(a);if(c.m()&&!c.c()){var d={};C(a,function(a,b){y(a,function(a){a in d||c.a(b,a)});d[b]=1})}else{var e=[];C(a,function(a,b){y(a,function(a){e.push([b,a])})});c.b(e)}return c}
function Qb(a,b,c){var d=Ob(b),e,f;d.j(a);c?d.c()?(d.m()?(e=[],C(a,function(a,b){t(a)&&h(Error());C(a,function(a,c){C(a,function(a,d){e.push([b,c,d,a])})})})):(e=[],C(a,function(a,b){t(a)&&h(Error());C(a,function(a,c){C(a,function(a){e.push([b,c,a])})})})),d.b(e)):d.m()?(f=new U,C(a,function(a,b){t(a)&&h(Error());C(a,function(a,c){f.contains([b,c].toString())||(e=[],C(a,function(a,d){e.push([b,c,d,a])}),d.b(e),f.add([c,b].toString()))})})):(f=new U,C(a,function(a,b){t(a)&&h(Error());C(a,function(a,
c){f.contains([b,c].toString())||(e=[],C(a,function(a){e.push([b,c,a])}),d.b(e),f.add([c,b].toString()))})})):d.m()&&!d.c()?(f=new U,C(a,function(a,b){t(a)&&h(Error());C(a,function(a,c){f.contains([b,c].toString())||(d.a(b,c,a),f.add([c,b].toString()))})})):(e=[],C(a,function(a,b){t(a)&&h(Error());C(a,function(a,c){e.push([b,c,a])})}),d.b(e));return d}function Sb(a,b){var c=Ob(b);c.b(a);return c};function Ub(a){this.name="JSNetworkXException";this.message=a}Ub.prototype=Error();Ub.prototype.constructor=Ub;v("jsnx.JSNetworkXException",Ub);function X(a){Ub.call(this,a);this.name="JSNetworkXError"}ra(X,Ub);v("jsnx.JSNetworkXError",X);function Vb(a){Ub.call(this,a);this.name="JSNetworkXPointlessConcept"}ra(Vb,Ub);v("jsnx.JSNetworkXPointlessConcept",Vb);function Wb(a){Ub.call(this,a);this.name="JSNetworkXAlgorithmError"}ra(Wb,Ub);v("jsnx.JSNetworkXAlgorithmError",Wb);
function Xb(a){Wb.call(this,a);this.name="JSNetworkXUnfeasible"}ra(Xb,Wb);v("jsnx.JSNetworkXUnfeasible",Xb);function Yb(a){Xb.call(this,a);this.name="JSNetworkXNoPath"}ra(Yb,Xb);v("jsnx.JSNetworkXNoPath",Yb);function Zb(a){Wb.call(this,a);this.name="JSNetworkXUnbounded"}ra(Zb,Wb);v("jsnx.JSNetworkXUnbounded",Zb);function $b(a){var b=[];ac(new bc,a,b);return b.join("")}function bc(){this.ba=aa}
function ac(a,b,c){switch(typeof b){case "string":cc(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==m){c.push("null");break}if(ga(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],ac(a,a.ba?a.ba.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),cc(f,c),c.push(":"),
ac(a,a.ba?a.ba.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:h(Error("Unknown type: "+typeof b))}}var dc={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},ec=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function cc(a,b){b.push('"',a.replace(ec,function(a){if(a in dc)return dc[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return dc[a]=e+b.toString(16)}),'"')};function M(a,b){if(!(this instanceof M))return new M(a,b);this.graph={};this.node={};this.adj={};a!=m&&Pb(a,this);I(this.graph,b||{});this.edge=this.adj}v("jsnx.classes.Graph",M);v("jsnx.Graph",M);M.__name__="Graph";M.prototype.za=m;M.prototype.graph=M.prototype.za;M.prototype.ka=m;M.prototype.node=M.prototype.ka;M.prototype.ta=m;M.prototype.adj=M.prototype.ta;M.prototype.xa=m;M.prototype.edge=M.prototype.xa;
M.prototype.name=function(a){if(s(a))this.graph.name=a.toString();else return this.graph.name||""};M.prototype.name=M.prototype.name;M.prototype.toString=function(){return this.name()};M.prototype.toString=M.prototype.toString;M.prototype.i=function(a){a in this.adj||h({name:"KeyError",message:"Graph does not contain node "+a+"."});return this.adj[a]};M.prototype.get_node=M.prototype.i;
M.prototype.D=function(a,b){b!=m||(b={});"object"!==r(b)&&h(new X("The attr_dict argument must be an object."));a in this.adj?I(this.node[a],b||{}):(this.adj[a]={},this.node[a]=b||{})};M.prototype.add_node=M.prototype.D;M.prototype.j=function(a,b){var c,d,e,f,g;b!=m||(b={});N(a,function(a){c=!(a in this.adj);ga(a)?(d=a[0],e=a[1],d in this.adj?(g=this.node[d],I(g,b,e)):(this.adj[d]={},f=cb(b),I(f,e),this.node[d]=f)):c?(this.adj[a]={},this.node[a]=cb(b)):I(this.node[a],b)},this)};
M.prototype.add_nodes_from=M.prototype.j;M.prototype.N=function(a){var b=this.adj,c;a in this.node||h(new X("The node "+a+" is not in the graph"));c=F(b[a]);G(this.node,a);y(c,function(c){G(b[c],a)});G(b,a)};M.prototype.remove_node=M.prototype.N;M.prototype.X=function(a){var b=this.adj;N(a,function(a){try{G(this.node,a),C(b[a],function(d,f){G(b[f],a)}),G(b,a)}catch(d){}},this)};M.prototype.remove_nodes_from=M.prototype.X;M.prototype.v=function(a){return a?T(this.node):K(F(this.adj))};
M.prototype.nodes_iter=M.prototype.v;M.prototype.nodes=function(a){return Va(this.v(a))};M.prototype.nodes=M.prototype.nodes;M.prototype.M=function(){return E(this.adj)};M.prototype.number_of_nodes=M.prototype.M;M.prototype.A=function(){return E(this.adj)};M.prototype.order=M.prototype.A;M.prototype.l=function(a){return!ga(a)&&a in this.adj};M.prototype.has_node=M.prototype.l;
M.prototype.a=function(a,b,c){c=c||{};"object"!==r(c)&&h(new X("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=H(this.adj[a],b+"",{});I(d,c);this.adj[a][b]=d;this.adj[b][a]=d};M.prototype.add_edge=M.prototype.a;
M.prototype.b=function(a,b){b=b||{};"object"!==r(b)&&h(new X("The attr_dict argument must be an object."));N(a,function(a){var d=hb(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 X("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=H(this.adj[e],f,{});I(a,b,g);this.adj[e][f]=a;this.adj[f][e]=a},this)};M.prototype.add_edges_from=M.prototype.b;
M.prototype.sa=function(a,b,c){c=c||{};u(b)||(c=b,b="weight");this.b(O(a,function(a){var c={};c[b]=a[2];s(c[b])||h(new TypeError("Values must consist of three elements: "+$b(a)));return[a[0],a[1],c]}),c)};M.prototype.add_weighted_edges_from=M.prototype.sa;M.prototype.u=function(a,b){try{G(this.adj[a],b),a!=b&&G(this.adj[b],a)}catch(c){c instanceof TypeError&&h(new X("The edge "+a+"-"+b+" is not in the graph")),h(c)}};M.prototype.remove_edge=M.prototype.u;
M.prototype.B=function(a){N(a,function(a){var c=a[0];a=a[1];c in this.adj&&a in this.adj[c]&&(G(this.adj[c],a),c!=a&&G(this.adj[a],c))},this)};M.prototype.remove_edges_from=M.prototype.B;M.prototype.H=function(a,b){return a in this.adj&&b in this.adj[a]};M.prototype.has_edge=M.prototype.H;M.prototype.K=function(a){a in this.adj||h(new X("The node "+a+" is not in the graph."));return P(this.adj[a])};M.prototype.neighbors=M.prototype.K;
M.prototype.V=function(a){a in this.adj||h(new X("The node "+a+" is not in the graph."));return K(this.adj[a])};M.prototype.neighbors_iter=M.prototype.V;M.prototype.t=function(a,b){return Va(this.e(a,b))};M.prototype.edges=M.prototype.t;
M.prototype.e=function(a,b){ha(a)&&(b=a,a=m);var c={},d,e;d=a!=m?O(this.d(a),function(a){return[a,this.adj[a]]},this):T(this.adj);return b?R(d,function(a){e=a[0];var b=new A,d=T(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]]}):R(d,function(a){e=a[0];var b=new A,d=K(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]})};
M.prototype.edges_iter=M.prototype.e;M.prototype.P=function(a,b,c){s(c)||(c=m);return a in this.adj?H(this.adj[a],b.toString(),c):c};M.prototype.get_edge_data=M.prototype.P;M.prototype.ua=function(){return P(O(this.s(),function(a){return F(a[1])}))};M.prototype.adjacency_list=M.prototype.ua;M.prototype.s=function(){return T(this.adj)};M.prototype.adjacency_iter=M.prototype.s;M.prototype.o=function(a,b){return a!=m&&this.l(a)?this.p(a,b).next()[1]:fb(Va(this.p(a,b)))};M.prototype.degree=M.prototype.o;
M.prototype.p=function(a,b){var c;c=a!=m?O(this.d(a),function(a){return[a,this.adj[a]]},this):T(this.adj);return b?O(c,function(a){var c=a[0];a=a[1];var f=0,g;for(g in a)f+=+H(a[g],b,1);f+=+(c in a&&H(a[c],b,1));return[c,f]}):O(c,function(a){return[a[0],E(a[1])+ +(a[0]in a[1])]})};M.prototype.degree_iter=M.prototype.p;M.prototype.clear=function(){this.name("");ab(this.adj);ab(this.node);ab(this.graph)};M.prototype.clear=M.prototype.clear;M.prototype.copy=function(){return qb(this)};
M.prototype.copy=M.prototype.copy;M.prototype.m=da(n);M.prototype.is_multigraph=M.prototype.m;M.prototype.c=da(n);M.prototype.is_directed=M.prototype.c;M.prototype.C=function(){var a=new Y;a.name(this.name());a.j(this);a.b(function(){var a;return R(this.s(),function(c){a=c[0];return T(c[1])},function(c){return[a,c[0],S(c[1])]})}.call(this));a.graph=S(this.graph);a.node=S(this.node);return a};M.prototype.to_directed=M.prototype.C;M.prototype.O=function(){return qb(this)};
M.prototype.to_undirected=M.prototype.O;M.prototype.w=function(a){a=this.d(a);var b=new this.constructor,c=b.adj,d=this.adj;N(a,function(a){var b={};c[a]=b;C(d[a],function(d,l){l in c&&(b[l]=d,c[l][a]=d)})});N(b,function(a){b.node[a]=this.node[a]},this);b.graph=this.graph;return b};M.prototype.subgraph=M.prototype.w;M.prototype.Ea=function(){return ua(ta(ob(this.adj),function(a){return a[0]in a[1]}),function(a){return a[0]})};M.prototype.nodes_with_selfloops=M.prototype.Ea;
M.prototype.Y=function(a){return a?ua(ta(ob(this.adj),function(a){return a[0]in a[1]}),function(a){var c=a[0];return[c,c,a[1][c]]}):ua(ta(ob(this.adj),function(a){return a[0]in a[1]}),function(a){return[a[0],a[0]]})};M.prototype.selfloop_edges=M.prototype.Y;M.prototype.Fa=function(){return this.Y().length};M.prototype.number_of_selfloops=M.prototype.Fa;M.prototype.size=function(a){var b=J.q.apply(m,Za(this.o(m,a)))/2;return a!=m?b:Math.floor(b)};M.prototype.size=M.prototype.size;
M.prototype.L=function(a,b){return a==m?Math.floor(this.size()):b in this.adj[a]?1:0};M.prototype.number_of_edges=M.prototype.L;M.prototype.ra=function(a,b){var c=P(a),d=c[0],c=O(Fa(c,1),function(a){return[d,a]});this.b(c,b)};M.prototype.add_star=M.prototype.ra;M.prototype.qa=function(a,b){var c=P(a),c=Oa(Fa(c,0,c.length-1),Fa(c,1));this.b(c,b)};M.prototype.add_path=M.prototype.qa;M.prototype.pa=function(a,b){var c=P(a),c=Oa(c,Aa(Fa(c,1),[c[0]]));this.b(c,b)};M.prototype.add_cycle=M.prototype.pa;
M.prototype.d=function(a){return a!=m?this.l(a)?K([a.toString()]):function(a,c){var d=new A,e=R(a,function(a){if(a in c)return a.toString()});d.next=function(){try{return e.next()}catch(a){a instanceof TypeError&&h(new X("nbunch is not a node or a sequence of nodes")),h(a)}};return d}(a,this.adj):K(this.adj)};M.prototype.nbunch_iter=M.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!=m&&Pb(a,this);I(this.graph,b||{});this.edge=this.adj}v("jsnx.classes.DiGraph",Y);v("jsnx.DiGraph",Y);ra(Y,M);Y.__name__="DiGraph";Y.prototype.D=function(a,b){b!=m||(b={});"object"!==r(b)&&h(new X("The attr_dict argument must be an object."));a in this.succ?I(this.node[a],b):(this.succ[a]={},this.pred[a]={},this.node[a]=b)};Y.prototype.add_node=Y.prototype.D;
Y.prototype.j=function(a,b){var c,d,e,f,g;b!=m||(b={});N(K(a),function(a){c=!(a in this.succ);ga(a)?(d=a[0],e=a[1],d in this.succ?(g=this.node[d],I(g,b,e)):(this.succ[d]={},this.pred[d]={},f=cb(b),I(f,e),this.node[d]=f)):c?(this.succ[a]={},this.pred[a]={},this.node[a]=cb(b)):I(this.node[a],b)},this)};Y.prototype.add_nodes_from=Y.prototype.j;
Y.prototype.N=function(a){a in this.node||h(new X("The node "+a+" is not in the graph"));var b=this.succ[a];G(this.node,a);C(b,function(b,d){G(this.pred[d],a)},this);G(this.succ,a);C(this.pred[a],function(b,d){G(this.succ[d],a)},this);G(this.pred,a)};Y.prototype.remove_node=Y.prototype.N;
Y.prototype.X=function(a){var b;N(a,function(a){a in this.succ&&(b=this.succ[a],G(this.node,a),C(b,function(b,e){G(this.pred[e],a)},this),G(this.succ,a),C(this.pred[a],function(b,e){G(this.succ[e],a)},this),G(this.pred,a))},this)};Y.prototype.remove_nodes_from=Y.prototype.X;
Y.prototype.a=function(a,b,c){c=c||{};"object"!==r(c)&&h(new X("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=H(this.adj[a],""+b,{});I(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 X("The attr_dict argument must be an object."));N(a,function(a){var d=hb(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 X("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=H(this.adj[e],f,{});I(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{G(this.succ[a],b),G(this.pred[b],a)}catch(c){c instanceof TypeError&&h(new X("The edge "+a+"-"+b+" is not in the graph")),h(c)}};Y.prototype.remove_edge=Y.prototype.u;Y.prototype.B=function(a){N(a,function(a){var c=a[0];a=a[1];c in this.succ&&a in this.succ[c]&&(G(this.succ[c],a),G(this.pred[a],c))},this)};Y.prototype.remove_edges_from=Y.prototype.B;Y.prototype.Ba=function(a,b){return a in this.succ&&b in this.succ[a]};
Y.prototype.has_successor=Y.prototype.Ba;Y.prototype.Aa=function(a,b){return a in this.pred&&b in this.pred[a]};Y.prototype.has_predecessor=Y.prototype.Aa;Y.prototype.fa=function(a){a in this.succ||h(new X("The node "+a+" is not in the digraph."));return K(this.succ[a])};Y.prototype.successors_iter=Y.prototype.fa;Y.prototype.ma=function(a){a in this.pred||h(new X("The node "+a+" is not in the digraph."));return K(this.pred[a])};Y.prototype.predecessors_iter=Y.prototype.ma;
Y.prototype.na=function(a){a in this.succ||h(new X("The node "+a+" is not in the digraph."));return P(this.succ[a])};Y.prototype.successors=Y.prototype.na;Y.prototype.Ga=function(a){a in this.succ||h(new X("The node "+a+" is not in the digraph."));return P(this.pred[a])};Y.prototype.predecessors=Y.prototype.Ga;Y.prototype.K=Y.prototype.na;Y.prototype.neighbors=Y.prototype.K;Y.prototype.V=Y.prototype.fa;Y.prototype.neighbors_iter=Y.prototype.V;
Y.prototype.e=function(a,b){ha(a)&&(b=a,a=m);var c,d,e;c=a!=m?O(this.d(a),function(a){return[a,this.adj[a]]},this):ob(this.adj);return b?R(c,function(a){d=a[0];e=a[1];return T(e)},function(a){return[d,a[0],a[1]]}):R(c,function(a){d=a[0];e=a[1];return T(e)},function(a){return[d,a[0]]})};Y.prototype.edges_iter=Y.prototype.e;Y.prototype.aa=Y.prototype.e;Y.prototype.out_edges_iter=Y.prototype.aa;Y.prototype.da=M.prototype.t;Y.prototype.out_edges=Y.prototype.da;
Y.prototype.I=function(a,b){ha(a)&&(b=a,a=m);var c,d;c=a!=m?O(this.d(a),function(a){return[a,this.pred[a]]},this):ob(this.pred);return b?R(c,function(a){d=a[0];return T(a[1])},function(a){return[a[0],d,a[1]]}):R(c,function(a){d=a[0];return T(a[1])},function(a){return[a[0],d]})};Y.prototype.in_edges_iter=Y.prototype.I;Y.prototype.R=function(a,b){return P(this.I(a,b))};Y.prototype.in_edges=Y.prototype.R;
Y.prototype.p=function(a,b){var c;c=a!=m?jb(O(this.d(a),function(a){return[a,this.succ[a]]},this),O(this.d(a),function(a){return[a,this.pred[a]]},this)):jb(T(this.succ),T(this.pred));return u(b)?O(c,function(a){var c=a[0][1],f=a[1][1],g=0,l;for(l in c)g+=+H(c[l],b,1);for(l in f)g+=+H(f[l],b,1);return[a[0][0],g]}):O(c,function(a){return[a[0][0],hb(a[0][1])+hb(a[1][1])]})};Y.prototype.degree_iter=Y.prototype.p;
Y.prototype.Q=function(a,b){var c;c=a!=m?O(this.d(a),function(a){return[a,this.pred[a]]},this):T(this.pred);return b!=m?O(c,function(a){var c=0,f=a[1],g;for(g in f)c+=+H(f[g],b,1);return[a[0],c]}):O(c,function(a){return[a[0],E(a[1])]})};Y.prototype.in_degree_iter=Y.prototype.Q;
Y.prototype.W=function(a,b){var c;c=a!=m?O(this.d(a),function(a){return[a,this.succ[a]]},this):T(this.succ);return b!=m?O(c,function(a){var c=0,f=a[1],g;for(g in f)c+=+H(f[g],b,1);return[a[0],c]}):O(c,function(a){return[a[0],E(a[1])]})};Y.prototype.out_degree_iter=Y.prototype.W;Y.prototype.ia=function(a,b){return a!=m&&this.l(a)?this.Q(a,b).next()[1]:fb(this.Q(a,b))};Y.prototype.in_degree=Y.prototype.ia;Y.prototype.la=function(a,b){return a!=m&&this.l(a)?this.W(a,b).next()[1]:fb(this.W(a,b))};
Y.prototype.out_degree=Y.prototype.la;Y.prototype.clear=function(){ab(this.succ);ab(this.pred);ab(this.node);ab(this.graph)};Y.prototype.clear=Y.prototype.clear;Y.prototype.m=da(n);Y.prototype.is_multigraph=Y.prototype.m;Y.prototype.c=da(k);Y.prototype.is_directed=Y.prototype.c;Y.prototype.C=function(){return qb(this)};Y.prototype.to_directed=Y.prototype.C;
Y.prototype.O=function(a){var b=new M;b.name(this.name());b.j(this);var c=this.pred,d;a?b.b(R(this.s(),function(a){d=a[0];return T(a[1])},function(a){if(a[0]in c[d])return[d,a[0],S(a[1])]})):b.b(R(this.s(),function(a){d=a[0];return T(a[1])},function(a){return[d,a[0],S(a[1])]}));b.graph=S(this.graph);b.node=S(this.node);return b};Y.prototype.to_undirected=Y.prototype.O;
Y.prototype.reverse=function(a){(a=!s(a)||a)?(a=new this.constructor(m,{name:"Reverse of ("+this.name()+")"}),a.j(this),a.b(O(this.e(m,k),function(a){return[a[1],a[0],S(a[2])]})),a.graph=S(this.graph),a.node=S(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.w=function(a){a=this.d(a);var b=new this.constructor,c=b.succ,d=b.pred,e=this.succ;N(a,function(a){c[a]={};d[a]={}});N(c,function(a){var b=c[a];C(e[a],function(e,p){p in c&&(b[p]=e,d[p][a]=e)})});N(b,function(a){b.node[a]=this.node[a]},this);b.graph=this.graph;return b};Y.prototype.subgraph=Y.prototype.w;function fc(a,b){var c=Q(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 R(f,function(a){d=a;return Q(b)},function(){try{var a=c.next();e.push(a);return[d,a]}catch(b){b!==z&&h(b)}})}function gc(a,b,c){c=hc(b,c);c.b(fc(b,a));return c}v("jsnx.generators.classic.full_rary_tree",gc);v("jsnx.full_rary_tree",gc);function ic(a,b,c){b=1===a?2:Math.floor((1-Math.pow(a,b+1))/(1-a));c=hc(b,c);c.b(fc(b,a));return c}
v("jsnx.generators.classic.balanced_tree",ic);v("jsnx.balanced_tree",ic);function jc(a,b){var c=hc(a,b);c.name("complete_graph("+a+")");1<a&&c.b(c.c()?mb(Q(a)):lb(Q(a)));return c}v("jsnx.generators.classic.complete_graph",jc);v("jsnx.complete_graph",jc);function kc(a,b){var c=lc(a,b);c.name("cycle_graph("+a+")");1<a&&c.a(a-1,0);return c}v("jsnx.generators.classic.cycle_graph",kc);v("jsnx.cycle_graph",kc);
function hc(a,b){a instanceof M&&(b=a,a=m);a!=m||(a=0);var c;b!=m?(c=b,c.clear()):c=new M;c.j(Q(a));c.name("empty_graph("+a+")");return c}v("jsnx.generators.classic.empty_graph",hc);v("jsnx.empty_graph",hc);
function mc(a,b,c,d){var e=hc(0,d);e.name("grid_2d_graph");d=Va(Q(a));var f=Va(Q(b));y(d,function(a){y(f,function(b){e.D([a,b].toString())})});B(Q(1,a),function(a){y(f,function(b){e.a([a,b].toString(),[a-1,b].toString())})});y(d,function(a){B(Q(1,b),function(b){e.a([a,b].toString(),[a,b-1].toString())})});e.c()&&(B(Q(0,a-1),function(a){y(f,function(b){e.a([a,b].toString(),[a+1,b].toString())})}),y(d,function(a){B(Q(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}v("jsnx.generators.classic.grid_2d_graph",mc);v("jsnx.grid_2d_graph",mc);function nc(a){a=hc(0,a);a.name("null_graph()");return a}v("jsnx.generators.classic.null_graph",nc);v("jsnx.null_graph",nc);
function lc(a,b){var c=hc(a,b);c.name("path_graph("+a+")");c.b(Sa(Q(a-1),function(a){return[a,a+1]}));return c}v("jsnx.generators.classic.path_graph",lc);v("jsnx.path_graph",lc);function oc(a){a=hc(1,a);a.name("null_graph()");return a}v("jsnx.generators.classic.trivial_graph",oc);v("jsnx.trivial_graph",oc);v("jsnx.fast_gnp_random_graph",function(a,b,c){c!=m||(c=n);var d=hc(a);d.name("fast_gnp_random_graph("+a+","+b+")");if(0>=b||1<=b)return pc(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});
function pc(a,b,c){var d;d=c?new Y:new M;d.j(Q(a));d.name("gnp_random_graph("+a+","+b+")");if(0>=b)return d;if(1<=b)return jc(a,d);a=d.c()?mb(Q(a)):lb(Q(a));B(a,function(a){Math.random()<b&&d.a(a[0],a[1])});return d}v("jsnx.gnp_random_graph",pc);v("jsnx.binomial_graph",pc);v("jsnx.erdos_renyi_graph",pc);v("jsnx.havel_hakimi_graph",function(a,b){qc(a)||h(new X("Invalid degree sequence"));b!=m&&(b.c()&&h(new X("Directed Graph not supported")),b.m()&&h(new X("Havel-Hakimi requires simple graph")));var c=a.length,d=hc(c,b);if(0===c||0===Math.max.apply(m,a))return d;for(c=Va(O(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.A()+" nodes "+d.size()+" edges");return d});function rc(){var a=new M;a.j(Q(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){N(c.split(" "),function(c,e){"1"===c&&a.a(b,e)});b+=1});return a}v("jsnx.generators.social.karate_club_graph",rc);v("jsnx.karate_club_graph",rc);
function sc(){var a=new M;a.j("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(";"),{wa:0});a.j("E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13 E14".split(" "),{wa: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}v("jsnx.generators.social.davis_southern_women_graph",sc);v("jsnx.davis_southern_women_graph",sc);
function tc(){var a=new M;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}v("jsnx.generators.social.florentine_families_graph",tc);v("jsnx.florentine_families_graph",tc);function uc(a,b){a.c()&&h(new X("triangles() is not defined for directed graphs."));if(b!=m&&a.l(b))return Math.floor(vc(a,b).next()[2]/2);var c={};B(vc(a,b),function(a){c[a[0]]=Math.floor(a[2]/2)});return c}v("jsnx.triangles",uc);
function vc(a,b){a.m()&&h(new X("Not defined for multigraphs."));var c;c=b!=m?R(a.d(b),function(b){return[b,a.i(b)]}):T(a.adj);return Sa(c,function(b){var c=new U(F(b[1])),f=0;c.remove(b[0]);B(c,function(b){var d=new U(F(a.i(b)));d.remove(b);f+=Mb(c,d).h()});return[b[0],c.h(),f]})}
function wc(a,b,c){a.m()&&h(new X("Not defined for multigraphs."));u(c)||(c="weight");var d;d=0===a.t().length?1:kb(a.t(k),function(a){return H(a[2],c,1)});b=b!=m?R(a.d(b),function(b){return[b,a.i(b)]}):T(a.adj);return Sa(b,function(b){var f=b[0],g=new U(F(b[1]));g.remove(f);var l=0,p=new U;B(g,function(b){var e=H(a.i(f)[b],c,1)/d;p.add(b);var L=Nb(new U(F(a.i(b))),p);B(Mb(g,L),function(g){var p=H(a.i(b)[g],c,1)/d;g=H(a.i(f)[g],c,1)/d;l+=Math.pow(e*p*g,1/3)})});return[f,g.h(),2*l]})}
v("jsnx.average_clustering",function(a,b,c,d){2===arguments.length?u(b)?(c=b,b=m):ha(b)&&(d=b,b=m):3===arguments.length&&ha(c)&&(d=c,c=m);d!=m||(d=k);var e=Za(xc(a,b,c));d||(e=ta(e,function(a){return 0<a}));return J.q.apply(J,e)/e.length});function xc(a,b,c){a.c()&&h(new X("Clustering algorithms are not defined for directed graphs."));c=c!=m?wc(a,b,c):vc(a,b);var d={};B(c,function(a){d[a[0]]=0===a[2]?0:a[2]/(a[1]*(a[1]-1))});return b!=m&&a.l(b)?Za(d)[0]:d}v("jsnx.clustering",xc);
v("jsnx.transitivity",function(a){var b=0,c=0;B(vc(a),function(a){c+=a[1]*(a[1]-1);b+=a[2]});return 0===b?0:b/c});v("jsnx.square_clustering",function(a,b){var c=b==m?K(a):a.d(b),d={};B(c,function(b){var c=d[b]=0;B(lb(F(a.i(b))),function(g){var l=g[0];g=g[1];var p=Mb(new U(F(a.i(l))),F(a.i(g)));p.remove(b);p=p.h();d[b]+=p;var D=p+1,x=a.i(l);g in x&&(D+=1);c+=(E(a.i(l))-D)*(E(a.i(g))-D)+p});0<c&&(d[b]/=c)});return b!=m&&a.l(b)?Za(d)[0]:d});function yc(a){var b=-1,c={},d=new U;B(a.s(),function(a){var e=new U(F(a[1]));e.remove(a[0]);var f=e.h();f>b?(c[a[0]]=d=e,b=f):c[a[0]]=e});var e=new U(F(c)),f=Nb(e,d),g=new U,l=[],p=[];a=new A;a.next=function(){0===f.h()&&0===l.length&&h(z);var a,x;if(0<f.h())a=Ra(f).next(),f.remove(a);else{var L=l.pop();e=L[0];g=L[1];f=L[2];p.pop();return this.next()}p.push(a);e.remove(a);g.add(a);var V=c[a],L=Mb(e,V),V=Mb(g,V);if(0===L.h()&&(0===V.h()&&(x=Ba(p)),p.pop(),x))return x;if(0===V.h()&&1===L.h())return x=
Aa(p,L.F()),p.pop(),x;var Ha=L.h(),ba=-1,ca,W;for(x=Ra(V);(a=Wa(x,m))!==m&&!(a=Mb(L,c[a]),W=a.h(),W>ba&&(ca=a,ba=W,ba===Ha)););if(ba===Ha)return p.pop(),this.next();b=-1;for(x=Ra(L);(a=Wa(x,m))!==m&&!(a=Mb(L,c[a]),W=a.h(),W>b&&(d=a,b=W,b===Ha-1)););ba>b&&(d=ca);l.push([e,g,f]);e=L;g=V;f=Nb(e,d);return this.next()};return a}v("jsnx.find_cliques",yc);
v("jsnx.find_cliques_recursive",function(a){var b={};B(a.s(),function(a){var c=new U(F(a[1]));c.remove(a[0]);b[a[0]]=c});if($a(b))return[];a=new U(F(b));var c=new U,d=[];zc(b,a,c,[],d);return d});
function zc(a,b,c,d,e){var f=-1,g=b.h(),l,p,D,x;for(p=Ra(c);(D=Wa(p,m))!==m;)if(D=Mb(b,a[D]),x=D.h(),x>f&&(l=D,f=x,x===g))return;B(b,function(c){c=Mb(b,a[c]);var d=c.h();d>f&&(l=c,f=d)});g=Nb(b,l);B(g,function(f){b.remove(f);d.push(f);var g=a[f];f=Mb(b,g);g=Mb(c,g);f.S()&&g.S()?e.push(Ba(d)):g.S()&&1===f.h()?e.push(Aa(d,f.F())):zc(a,f,g,d,e);c.add(d.pop())})}v("jsnx.graph_clique_number",function(a,b){b!=m||(b=yc(a));var c=0;N(b,function(a){c=a.length>c?a.length:c});return c});
v("jsnx.graph_number_of_cliques",function(a,b){b!=m||(b=yc(a));return P(b).length});function Ac(a,b,c){c=c!=m?Va(c):Va(yc(a));b!=m||(b=a.nodes());var d;if(ga(b))d={},y(b,function(a){d[a]=ta(c,function(b){return 0<=sa(b,a)||0<=sa(b,a+"")}).length});else{var e=b;d=ta(c,function(a){return 0<=sa(a,e)||0<=sa(a,e+"")}).length}return d}v("jsnx.number_of_cliques",Ac);function Bc(a,b){if(a.A()!=b.A())return n;var c,d=a.o(),e=uc(a),f=Ac(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.o(),e=uc(b),f=Ac(b),l=[];for(c in d)l.push([d[c],e[c],f[c]]);l.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!Ga(g,l,function(a,b){return Ga(a,b)})?n:k}v("jsnx.algorithms.isomorphism.could_be_isomorphic",Bc);v("jsnx.could_be_isomorphic",Bc);
function Cc(a,b){if(a.A()!=b.A())return n;var c,d=a.o(),e=uc(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.o(),e=uc(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!Ga(f,g,function(a,b){return Ga(a,b)})?n:k}v("jsnx.algorithms.isomorphism.fast_could_be_isomorphic",Cc);v("jsnx.fast_could_be_isomorphic",Cc);
function Dc(a,b){if(a.A()!=b.A())return n;var c=Za(a.o());c.sort();var d=Za(b.o());d.sort();return!Ga(c,d)?n:k}v("jsnx.algorithms.isomorphism.faster_could_be_isomorphic",Dc);v("jsnx.faster_could_be_isomorphic",Dc);function Ec(){}Ec.ha=function(){return Ec.ja?Ec.ja:Ec.ja=new Ec};Ec.prototype.Da=0;Ec.ha();function Fc(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}v("jsnx.utils.is_list_of_ints",Fc);v("jsnx.utils.cumulative_sum",function(a){var b=0;return Sa(a,function(a){return b+=a})});v("jsnx.utils.generate_unique_node",function(){return":"+(Ec.ha().Da++).toString(36)});function qc(a,b){if("eg"===b)return Gc(a);if(b==m||"hh"===b)return Hc(a);h(new Ub("`opt_method` must be 'eg' or 'hh'"))}v("jsnx.is_valid_degree_sequence",qc);function Hc(a){if(0===a.length)return k;if(!Fc(a)||0>Math.min.apply(m,a)||0!==J.q.apply(m,a)%2)return n;for(a=Ba(a);0<a.length;){w.sort.call(a,Ma);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}v("jsnx.is_valid_degree_sequence_havel_hakimi",Hc);
function Gc(a){if(0===a.length)return k;if(!Fc(a)||0>Math.min.apply(m,a)||0!==J.q.apply(m,a)%2)return n;var b=a.length,c=Ba(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=J.q.apply(m,c.slice(0,d[e])),g=d[e]*(d[e]-1)+J.q.apply(m,Va(Sa(Q(d[e],b),function(a){return Math.min(d[e],c[a])}))),f>g)return n;return k}v("jsnx.is_valid_degree_sequence_erdos_gallai",Gc);function Ic(a){try{return Jc(a),k}catch(b){if(b instanceof Xb)return n;h(b)}}v("jsnx.algorithms.dag.is_directed_acyclic_graph",Ic);v("jsnx.is_directed_acyclic_graph",Ic);
function Jc(a,b){a.c()||h(new X("Topological sort not defined on undirected graphs."));var c={},d=[],e={};b!=m||(b=a.v());N(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 l=[];C(a.i(g),function(a,b){b in e||(b in c&&h(new Xb("Graph contains a cycle")),l.push(b))});0<l.length?b.push.apply(b,l):(e[g]=k,Ea(d,aa,0,g.toString()))}}});return d}v("jsnx.algorithms.dag.topological_sort",Jc);v("jsnx.topological_sort",Jc);
function Kc(a,b){function c(a,b,d,e){b.add(e);C(a.i(e),function(e,p){if(b.contains(p))b.contains(p)&&!(0<=sa(d,p))&&h(new Xb("Graph contains a cycle"));else if(!c(a,b,d,p))return n});Ea(d,aa,0,e.toString());return k}a.c()||h(new X("Topological sort not defined on undirected graphs."));var d=new U,e=[];b!=m||(b=a.v());N(b,function(b){!(0<=sa(e,b))&&!c(a,d,e,b)&&h(new Xb("Graph contains a cycle"))});return e}v("jsnx.algorithms.dag.topological_sort_recursive",Kc);
v("jsnx.topological_sort_recursive",Kc);var Mc=function Lc(b){b.c()||h(new X("is_aperiodic not defined for undirected graphs."));var c=b.v().next(),d={};d[c]=0;for(var c=[c],e=0,f=1;0<c.length;){var g=[];y(c,function(c){C(b.i(c),function(b,D){D in d?e=sb(e,d[c]-d[D]+1):(g.push(D),d[D]=f)})});c=g;f+=1}return hb(d)===hb(b)?1===e:1===e&&Lc(b.w(Nb(new U(b.nodes()),F(d))))};v("jsnx.algorithms.dag.is_aperiodic",Mc);v("jsnx.is_aperiodic",Mc);function Nc(a,b,c){var d={},e=0,f={};for(f[b]=1;0<E(f);){b=f;f={};C(b,function(b,c){c in d||(d[c]=e,I(f,a.i(c)))});if(ia(c)&&c<=e)break;e+=1}return d}v("jsnx.algorithms.shortest_paths.unweighted.single_source_shortest_path_length",Nc);v("jsnx.single_source_shortest_path_length",Nc);function Oc(a,b){var c={};N(a,function(d){c[d]=Nc(a,d,b)});return c}v("jsnx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path_length",Oc);v("jsnx.all_pairs_shortest_path_length",Oc);
function Rc(a,b,c){b=b.toString();c=c.toString();c=Sc(a,b,c);a=c[0];b=c[1];c=c[2];for(var d=[];c!=m;)d.push(c),c=b[c];for(c=a[d[0]];c!=m;)d.unshift(c),c=a[c];return d}v("jsnx.algorithms.shortest_paths.unweighted.bidirectional_shortest_path",Rc);v("jsnx.bidirectional_shortest_path",Rc);
function Sc(a,b,c){(!s(b)||!s(c))&&h(new Ub("Bidirectional shortest path called without source or target"));var d={},e={};if(c===b)return d[c]=m,e[b]=m,[d,e,b];var f,g;a.c()?(f=a.ma,g=a.fa):g=f=a.V;d[b]=m;e[c]=m;for(var l=[b],p=[c],D,x;0<l.length&&0<p.length&&!x;)l.length<=p.length?(D=l,l=[],y(D,function(b){x||B(g.call(a,b),function(a){x||(a in d||(l.push(a),d[a]=b),a in e&&(x=[d,e,a]))})})):(D=p,p=[],y(D,function(b){x||B(f.call(a,b),function(a){x||(a in e||(e[a]=b,p.push(a)),a in d&&(x=[d,e,a]))})}));
if(x)return x;h(new Yb("No path between "+b+" and "+c+"."))}function Tc(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<E(e)&&!(b=e,e={},C(b,function(b,c){C(a.i(c),function(a,b){b in f||(f[b]=f[c].concat([b]),e[b]=1)})}),d+=1,s(c)&&c<=d););return f}v("jsnx.algorithms.shortest_paths.unweighted.single_source_shortest_path",Tc);v("jsnx.single_source_shortest_path",Tc);function Uc(a,b){var c={};N(a,function(d){c[d]=Tc(a,d,b)});return c}
v("jsnx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path",Uc);v("jsnx.all_pairs_shortest_path",Uc);function Vc(a,b,c,d,e){b=b.toString();var f=0,g=[b],l={};l[b]=f;var p={};for(p[b]=[];0<g.length&&!(f+=1,b=g,g=[],y(b,function(b){C(a.i(b),function(a,c){c in l?l[c]===f&&p[c].push(b):(p[c]=[b],l[c]=f,g.push(c))})}),d!=m&&d<=f););return c!=m?(c=c.toString(),e?!(c in p)?[[],-1]:[p[c],l[c]]:!(c in p)?[]:p[c]):e?[p,l]:p}v("jsnx.algorithms.shortest_paths.unweighted.predecessor",Vc);
v("jsnx.predecessor",Vc);function Wc(a,b,c){var d=b;ka(b)&&(d={},B(a.v(),function(a){d[a]=b(a)}));return!s(c)||c?Xc(a,d):Yc(a,d)}v("jsnx.relabel_nodes",Wc);
function Yc(a,b){var c=new U(F(b)),d;if(0<Mb(c,b).h()){c=new Y(ob(b));c.B(c.Y());try{d=Jc(c)}catch(e){e instanceof Xb&&h(new Xb("The node label sets are overlapping and no ordering can resolve the mapping. Use copy=True."))}d.reverse()}else d=c;var f=a.m(),g=a.c(),l;B(d,function(c){var d;c in b&&(d=b[c],a.l(c)||h(new X("Node "+c+" is not in the graph.")),a.D(d,a.node[c]),f?(l=ua(a.t(c,k,k),function(a){return[d,a[1],a[2],a[3]]}),g&&(l=Aa(l,ua(a.R(c,k,k),function(a){return[a[0],d,a[2],a[3]]})))):(l=
ua(a.t(c,k),function(a){return[d,a[1],a[2]]}),g&&(l=Aa(l,ua(a.R(c,k),function(a){return[a[0],d,a[2]]})))),a.N(c),a.b(l))});return a}
function Xc(a,b){var c=new a.constructor;c.name("("+a.name()+")");a.m()?c.b(Sa(a.e(m,k,k),function(a){return[H(b,a[0],a[0]),H(b,a[1],a[1]),a[2],cb(a[3])]})):c.b(Sa(a.e(m,k),function(a){return[H(b,a[0],a[0]),H(b,a[1],a[1]),cb(a[2])]}));c.j(Sa(K(a),function(a){return H(b,a,a)}));var d={},e;for(e in a.node)d[H(b,e,e)]=cb(a.node[e]);I(c.node,d);I(c.graph,cb(a.graph));return c}
v("jsnx.convert_node_labels_to_integers",function(a,b,c,d){3===arguments.length&&ha(c)?(d=c,c=m):2===arguments.length&&(ha(b)?(d=b,b=m):u(b)&&(c=b,b=m));b!=m||(b=0);c!=m||(c="default");d!=m||(d=k);var e={},f,g,l,p;if("default"===c){f=a.nodes();g=0;l=b;for(p=f.length;g<p;g++,l++)e[f[g]]=l}else if("sorted"===c){f=a.nodes();f.sort();g=0;l=b;for(p=f.length;g<p;g++,l++)e[f[g]]=l}else if("increasing degree"===c){f=Va(a.p());f.sort(function(a,b){return a[1]-b[1]});g=0;l=b;for(p=f.length;g<p;g++,l++)e[f[g][0]]=
l}else if("decreasing degree"===c){f=Va(a.p());f.sort(function(a,b){return b[1]-a[1]});g=0;l=b;for(p=f.length;g<p;g++,l++)e[f[g][0]]=l}else h(new X("Unkown node ordering: "+c));g=Wc(a,e);g.name("("+a.name()+")_with_int_labels");d||(g.node_labels=e);return g});function Z(a,b){if(!(this instanceof Z))return new Z(a,b);M.call(this,a,b)}ra(Z,M);v("jsnx.classes.MultiGraph",Z);v("jsnx.MultiGraph",Z);Z.__name__="MultiGraph";
Z.prototype.a=function(a,b,c,d){var e,f;c!=m&&(!u(c)&&!ia(c))&&(d=c,c=m);d=d||{};"object"!==r(d)&&h(new X("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==m)for(c=E(f);c in f;)c+=1;e=H(f,""+c,{});I(e,d);f[c]=e}else c!=m||(c=0),e={},I(e,d),f=eb(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 X("The attr_dict argument must be an object."));N(a,function(a){var d=hb(a),e,f,g=m,l={};4===d?(e=a[0],f=a[1],g=a[2],l=a[3]):3===d?(e=a[0],f=a[1],l=a[2]):2===d?(e=a[0],f=a[1]):h(new X("Edge tuple "+$b(a)+" must be a 2-tuple, 3-tuple or 4-tuple."));a=e in this.adj?H(this.adj[e],f,{}):{};if(g==m)for(g=E(a);g in a;)g+=1;a=H(a,g,{});I(a,b,l);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 X("The edge "+a+"-"+b+" is not in the graph"));var d=this.adj[a][b];c!=m?(c in d||h(new X("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),G(d,c)):G(d,Ya(d));0===E(d)&&(G(this.adj[a],b),a!=b&&G(this.adj[b],a))};Z.prototype.remove_edge=Z.prototype.u;Z.prototype.B=function(a){N(a,function(a){try{this.u(a[0],a[1],a[2])}catch(c){c instanceof X||h(c)}},this)};Z.prototype.remove_edges_from=Z.prototype.B;
Z.prototype.H=function(a,b,c){return c!=m?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.H;Z.prototype.t=function(a,b,c){return Va(this.e(a,b,c))};Z.prototype.edges=Z.prototype.t;
Z.prototype.e=function(a,b,c){ha(a)&&(ha(b)&&(c=b),b=a,a=m);var d={},e,f;a=a!=m?O(this.d(a),function(a){return[a,this.adj[a]]},this):T(this.adj);return b?R(a,function(a){e=a[0];var b=new A,c=T(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 T(a[1])},function(a){return c?[e,f,a[0],a[1]]:[e,f,a[1]]}):R(a,function(a){e=a[0];var b=new A,c=T(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 T(a[1])},function(a){return c?[e,f,a[0]]:[e,f]})};Z.prototype.edges_iter=Z.prototype.e;Z.prototype.P=function(a,b,c,d){s(d)||(d=m);return a in this.adj&&b in this.adj[a]?c!=m?H(this.adj[a][b],""+c,d):this.adj[a][b]:d};Z.prototype.get_edge_data=Z.prototype.P;
Z.prototype.p=function(a,b){var c;c=a!=m?O(this.d(a),function(a){return[a,this.adj[a]]},this):T(this.adj);return b!=m?Sa(c,function(a){var c=a[0];a=a[1];var f=0;C(a,function(a){C(a,function(a){f+=H(a,b,1)})});c in a&&C(a[c],function(a){f+=H(a,b,1)});return[c,f]}):Sa(c,function(a){var b=a[0];a=a[1];var c=0;C(a,function(a){c+=E(a)});return[b,c+ +(b in a&&E(a[b]))]})};Z.prototype.degree_iter=Z.prototype.p;Z.prototype.m=da(k);Z.prototype.is_multigraph=Z.prototype.m;Z.prototype.c=da(n);
Z.prototype.is_directed=Z.prototype.c;Z.prototype.C=function(){var a=new $;a.j(this);a.b(function(){var a,c;return R(this.s(),function(c){a=c[0];return T(c[1])},function(a){c=a[0];return T(a[1])},function(d){return[a,c,d[0],S(d[1])]})}.call(this));a.graph=S(this.graph);a.node=S(this.node);return a};Z.prototype.to_directed=Z.prototype.C;
Z.prototype.Y=function(a,b){var c=[];a?b?C(this.adj,function(a,b){b in a&&C(a[b],function(a,d){c.push([b,b,d,a])})}):C(this.adj,function(a,b){b in a&&C(a[b],function(a){c.push([b,b,a])})}):b?C(this.adj,function(a,b){b in a&&C(a[b],function(a,d){c.push([b,b,d])})}):C(this.adj,function(a,b){b in a&&C(a[b],function(){c.push([b,b])})});return c};Z.prototype.selfloop_edges=Z.prototype.Y;Z.prototype.L=function(a,b){return a==m?this.size():a in this.adj&&b in this.adj[a]?E(this.adj[a][b]):0};
Z.prototype.number_of_edges=Z.prototype.L;Z.prototype.w=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;C(d[a],function(d,l){if(l in c){var p=cb(d);b[l]=p;c[l][a]=p}})});C(this.node,function(a,c){b.node[c]=a});b.graph=this.graph;return b};Z.prototype.subgraph=Z.prototype.w;function $(a,b){if(!(this instanceof $))return new $(a,b);Y.call(this,a,b)}ra($,Y);var Zc=$.prototype,$c=Z.prototype,ad;for(ad in $c)$c.hasOwnProperty(ad)&&"constructor"!==ad&&(Zc[ad]=$c[ad]);v("jsnx.classes.MultiDiGraph",$);v("jsnx.MultiDiGraph",$);$.__name__="MultiDiGraph";
$.prototype.a=function(a,b,c,d){var e,f;c!=m&&(!u(c)&&!ia(c))&&(d=c,c=m);d=d||{};"object"!==r(d)&&h(new X("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==m)for(c=E(f);c in f;)c+=1;e=H(f,c.toString(),{});I(e,d);f[c]=e}else c!=m||(c=0),e={},I(e,d),f=eb(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 X("The edge "+a+"-"+b+" is not in the graph"));var d=this.adj[a][b];c!=m?(c in d||h(new X("The edge "+a+"-"+b+" with key "+c+" is not in the graph")),G(d,c)):G(d,Ya(d));0===E(d)&&(G(this.succ[a],b),G(this.pred[b],a))};$.prototype.remove_edge=$.prototype.u;
$.prototype.e=function(a,b,c){ha(a)&&(ha(b)&&(c=b),b=a,a=m);var d,e;a=a!=m?O(this.d(a),function(a){return[a,this.adj[a]]},this):ob(this.adj);return b?R(a,function(a){d=a[0];return T(a[1])},function(a){e=a[0];return T(a[1])},function(a){return c?[d,e,a[0],a[1]]:[d,e,a[1]]}):R(a,function(a){d=a[0];return T(a[1])},function(a){e=a[0];return T(a[1])},function(a){return c?[d,e,a[0]]:[d,e]})};$.prototype.edges_iter=$.prototype.e;$.prototype.aa=$.prototype.e;$.prototype.out_edges_iter=$.prototype.aa;
$.prototype.da=function(a,b,c){return Va(this.aa(a,b,c))};$.prototype.out_edges=$.prototype.da;$.prototype.I=function(a,b,c){ha(a)&&(b=a,a=m);var d,e;a=a!=m?O(this.d(a),function(a){return[a,this.pred[a]]},this):ob(this.pred);return b?R(a,function(a){d=a[0];return T(a[1])},function(a){e=a[0];return T(a[1])},function(a){return c?[e,d,a[0],a[1]]:[e,d,a[1]]}):R(a,function(a){d=a[0];return T(a[1])},function(a){e=a[0];return T(a[1])},function(a){return c?[e,d,a[0]]:[e,d]})};$.prototype.in_edges_iter=$.prototype.I;
$.prototype.R=function(a,b,c){return Va(this.I(a,b,c))};$.prototype.in_edges=$.prototype.R;
$.prototype.p=function(a,b){var c;c=a!=m?jb(Sa(this.d(a),function(a){return[a,this.succ[a]]},this),Sa(this.d(a),function(a){return[a,this.pred[a]]},this)):jb(T(this.succ),T(this.pred));return b!=m?O(c,function(a){var c=a[0][1],f=0;C(a[1][1],function(a){C(a,function(a){f+=+H(a,b,1)})});C(c,function(a){C(a,function(a){f+=+H(a,b,1)})});return[a[0][0],f]}):O(c,function(a){var b=0,c=0;C(a[1][1],function(a){b+=hb(a)});C(a[0][1],function(a){c+=hb(a)});return[a[0][0],b+c]})};$.prototype.degree_iter=$.prototype.p;
$.prototype.Q=function(a,b){var c;c=a!=m?O(this.d(a),function(a){return[a,this.pred[a]]},this):T(this.pred);return b!=m?O(c,function(a){var c=0;C(a[1],function(a){C(a,function(a){c+=+H(a,b,1)})});return[a[0][0],c]}):O(c,function(a){var b=0;C(a[1],function(a){b+=E(a)});return[a[0],b]})};$.prototype.in_degree_iter=$.prototype.Q;
$.prototype.W=function(a,b){var c;c=a!=m?O(this.d(a),function(a){return[a,this.succ[a]]},this):T(this.succ);return b!=m?O(c,function(a){var c=0;C(a[1],function(a){C(a,function(a){c+=+H(a,b,1)})});return[a[0][0],c]}):O(c,function(a){var b=0;C(a[1],function(a){b+=E(a)});return[a[0],b]})};$.prototype.out_degree_iter=$.prototype.W;$.prototype.m=da(k);$.prototype.is_multigraph=$.prototype.m;$.prototype.c=da(k);$.prototype.is_directed=$.prototype.c;$.prototype.C=function(){return qb(this)};
$.prototype.to_directed=$.prototype.C;$.prototype.O=function(a){var b=new Z;b.name(this.name());b.j(this);var c,d;a?b.b(R(this.s(),function(a){c=a[0];return T(a[1])},function(a){d=a[0];return T(a[1])},qa(function(a){if(this.H(d,c,a[0]))return[c,d,a[0],S(a[1])]},this))):b.b(R(this.s(),function(a){c=a[0];return T(a[1])},function(a){d=a[0];return T(a[1])},function(a){return[c,d,a[0],S(a[1])]}));b.graph=S(this.graph);b.node=S(this.node);return b};$.prototype.to_undirected=$.prototype.O;
$.prototype.w=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]={}});N(c,function(a){var b=c[a];C(e[a],function(e,p){if(p in c){var D=cb(e);b[p]=D;d[p][a]=D}})});N(b,function(a){b.node[a]=this.node[a]},this);b.graph=this.graph;return b};$.prototype.subgraph=$.prototype.w;
$.prototype.reverse=function(a){(a=!s(a)||a)?(a=new this.constructor(m,{name:"Reverse of ("+this.name()+")"}),a.j(this),a.b(Sa(this.e(m,k,k),function(a){return[a[1],a[0],a[2],S(a[3])]})),a.graph=S(this.graph),a.node=S(this.node)):(a=this.succ,this.succ=this.pred,this.pred=a,this.adj=this.succ,a=this);return a};$.prototype.reverse=$.prototype.reverse;v("jsnx.nodes",function(a){return a.nodes()});v("jsnx.nodes_iter",function(a){return a.v()});v("jsnx.edges",function(a,b){return a.t(b)});v("jsnx.edges_iter",function(a,b){return a.e(b)});v("jsnx.degree",function(a,b,c){return a.o(b,c)});v("jsnx.neighbors",function(a,b){return a.K(b)});v("jsnx.number_of_nodes",function(a){return a.M()});v("jsnx.number_of_edges",function(a){return a.L()});v("jsnx.density",function(a){var b=a.M(),c=a.L();return 0===c?0:a.c()?c/(b*(b-1)):2*c/(b*(b-1))});
v("jsnx.degree_histogram",function(a){a=Za(a.o());var b=Math.max.apply(Math,a)+1,c=Na(b);y(a,function(a){c[a]+=1});return c});v("jsnx.is_directed",function(a){return a.c()});v("jsnx.freeze",function(a){function b(){h(new X("Frozen graph can't be modified"))}a.D=b;a.j=b;a.N=b;a.X=b;a.a=b;a.b=b;a.u=b;a.B=b;a.clear=b;a.ya=k;return a});v("jsnx.is_frozen",function(a){return!!a.ya});v("jsnx.subgraph",function(a,b){return a.w(b)});
v("jsnx.create_empty_copy",function(a,b){s(b)||(b=k);var c=new a.constructor;b&&c.j(a);return c});
v("jsnx.info",function(a,b){var c="";if(b!=m)a.l(b)||h(new X("node "+b+" not in graph")),c=c+("Node "+b+" has the following properties:\n")+("Degree: "+a.o(b)+"\n"),c+="Neighbors: "+a.K(b).join(" ");else{var c=c+("Name: "+a.name()+"\n"),c=c+("Type: "+a.constructor.__name__+"\n"),c=c+("Number of nodes: "+a.M()+"\n"),c=c+("Number of edges: "+a.L()+"\n"),d=a.M();if(0<d)if(a.c())c+="Average in degree: "+(J.q.apply(m,Za(a.ia()))/d).toFixed(4)+"\n",c+="Average out degree: "+(J.q.apply(m,Za(a.la()))/d).toFixed(4);
else var e=J.q.apply(m,Za(a.o())),c=c+("Average degree: "+(e/d).toFixed(4))}return c});v("jsnx.set_node_attributes",function(a,b,c){C(c,function(c,e){a.node[e][b]=c})});v("jsnx.get_node_attributes",function(a,b){var c={};C(a.ka,function(a,e){b in a&&(c[e]=a[b])});return c});v("jsnx.set_edge_attributes",function(a,b,c){C(c,function(b,c){c=c.split(",");a.i(c[0])[c[1]]=b})});v("jsnx.get_edge_attributes",function(a,b){var c={};C(a.t(m,k),function(a){b in a[2]&&(c[[a[0],a[1]]]=a[2][b])});return c});}));
>>>>>>> 46b771ec5236e5b7e9b019cd3234f2087d4cc5eb