@datagrok/eda 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -0
  3. package/dist/_d4c0.js +279 -0
  4. package/dist/_d4c0.js.map +1 -0
  5. package/dist/node_modules_datagrok-libraries_math_src_dbscan_wasm_clustering-worker_js.js +279 -0
  6. package/dist/node_modules_datagrok-libraries_math_src_dbscan_wasm_clustering-worker_js.js.map +1 -0
  7. package/dist/node_modules_datagrok-libraries_ml_src_MCL_mcl-sparse-matrix-mult-worker_js.js +59 -0
  8. package/dist/node_modules_datagrok-libraries_ml_src_MCL_mcl-sparse-matrix-mult-worker_js.js.map +1 -0
  9. package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_distance-matrix-worker_js.js +284 -0
  10. package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_distance-matrix-worker_js.js.map +1 -0
  11. package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_single-value-knn-worker_js.js +265 -0
  12. package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_single-value-knn-worker_js.js.map +1 -0
  13. package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-worker_js.js +287 -0
  14. package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-worker_js.js.map +1 -0
  15. package/dist/package-test.js +26140 -1
  16. package/dist/package-test.js.map +1 -1
  17. package/dist/package.js +30337 -1
  18. package/dist/package.js.map +1 -1
  19. package/dist/src_workers_softmax-worker_ts.js +154 -0
  20. package/dist/src_workers_softmax-worker_ts.js.map +1 -0
  21. package/dist/src_workers_tsne-worker_ts.js +244 -0
  22. package/dist/src_workers_tsne-worker_ts.js.map +1 -0
  23. package/dist/src_workers_umap-worker_ts.js +252 -0
  24. package/dist/src_workers_umap-worker_ts.js.map +1 -0
  25. package/dist/vendors-node_modules_datagrok-libraries_math_src_dbscan_wasm_dbscan_js.js +1253 -0
  26. package/dist/vendors-node_modules_datagrok-libraries_math_src_dbscan_wasm_dbscan_js.js.map +1 -0
  27. package/dist/vendors-node_modules_datagrok-libraries_math_src_hierarchical-clustering_wasm_clustering-worker_js.js +942 -0
  28. package/dist/vendors-node_modules_datagrok-libraries_math_src_hierarchical-clustering_wasm_clustering-worker_js.js.map +1 -0
  29. package/dist/vendors-node_modules_datagrok-libraries_math_src_webGPU_sparse-matrix_webGPU-sparse-matrix_js-07693f.js +1525 -0
  30. package/dist/vendors-node_modules_datagrok-libraries_math_src_webGPU_sparse-matrix_webGPU-sparse-matrix_js-07693f.js.map +1 -0
  31. package/dist/vendors-node_modules_datagrok-libraries_ml_src_MCL_mcl-worker_js-node_modules_datagrok-librar-e4203d.js +2244 -0
  32. package/dist/vendors-node_modules_datagrok-libraries_ml_src_MCL_mcl-worker_js-node_modules_datagrok-librar-e4203d.js.map +1 -0
  33. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-threshold-worker_js.js +286 -0
  34. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-threshold-worker_js.js.map +1 -0
  35. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-worker_js.js +280 -0
  36. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-worker_js.js.map +1 -0
  37. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-threshold-worker_js.js +282 -0
  38. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-threshold-worker_js.js.map +1 -0
  39. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_utils_js-node_modules_datagrok-72c7b2.js +1821 -0
  40. package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_utils_js-node_modules_datagrok-72c7b2.js.map +1 -0
  41. package/dist/vendors-node_modules_datagrok-libraries_ml_src_multi-column-dimensionality-reduction_mulit-co-3800a0.js +7776 -0
  42. package/dist/vendors-node_modules_datagrok-libraries_ml_src_multi-column-dimensionality-reduction_mulit-co-3800a0.js.map +1 -0
  43. package/dist/vendors-node_modules_keckelt_tsne_lib_index_js.js +379 -0
  44. package/dist/vendors-node_modules_keckelt_tsne_lib_index_js.js.map +1 -0
  45. package/dist/vendors-node_modules_ml-matrix_matrix_mjs.js +5946 -0
  46. package/dist/vendors-node_modules_ml-matrix_matrix_mjs.js.map +1 -0
  47. package/dist/vendors-node_modules_umap-js_dist_index_js.js +2284 -0
  48. package/dist/vendors-node_modules_umap-js_dist_index_js.js.map +1 -0
  49. package/dist/wasm_EDAForWebWorker_js-wasm_callWasmForWebWorker_js.js +779 -0
  50. package/dist/wasm_EDAForWebWorker_js-wasm_callWasmForWebWorker_js.js.map +1 -0
  51. package/dist/wasm_workers_errorWorker_js.js +267 -0
  52. package/dist/wasm_workers_errorWorker_js.js.map +1 -0
  53. package/dist/wasm_workers_fitLinearRegressionParamsWithDataNormalizingWorker_js.js +267 -0
  54. package/dist/wasm_workers_fitLinearRegressionParamsWithDataNormalizingWorker_js.js.map +1 -0
  55. package/dist/wasm_workers_fitLinearRegressionParamsWorker_js.js +267 -0
  56. package/dist/wasm_workers_fitLinearRegressionParamsWorker_js.js.map +1 -0
  57. package/dist/wasm_workers_fitSoftmaxWorker_js.js +267 -0
  58. package/dist/wasm_workers_fitSoftmaxWorker_js.js.map +1 -0
  59. package/dist/wasm_workers_generateDatasetWorker_js.js +267 -0
  60. package/dist/wasm_workers_generateDatasetWorker_js.js.map +1 -0
  61. package/dist/wasm_workers_normalizeDatasetWorker_js.js +267 -0
  62. package/dist/wasm_workers_normalizeDatasetWorker_js.js.map +1 -0
  63. package/dist/wasm_workers_partialLeastSquareRegressionWorker_js.js +267 -0
  64. package/dist/wasm_workers_partialLeastSquareRegressionWorker_js.js.map +1 -0
  65. package/dist/wasm_workers_predictByLSSVMWorker_js.js +267 -0
  66. package/dist/wasm_workers_predictByLSSVMWorker_js.js.map +1 -0
  67. package/dist/wasm_workers_principalComponentAnalysisNipalsWorker_js.js +267 -0
  68. package/dist/wasm_workers_principalComponentAnalysisNipalsWorker_js.js.map +1 -0
  69. package/dist/wasm_workers_principalComponentAnalysisWorkerUpd_js.js +271 -0
  70. package/dist/wasm_workers_principalComponentAnalysisWorkerUpd_js.js.map +1 -0
  71. package/dist/wasm_workers_trainAndAnalyzeLSSVMWorker_js.js +267 -0
  72. package/dist/wasm_workers_trainAndAnalyzeLSSVMWorker_js.js.map +1 -0
  73. package/dist/wasm_workers_trainLSSVMWorker_js.js +267 -0
  74. package/dist/wasm_workers_trainLSSVMWorker_js.js.map +1 -0
  75. package/dist/wasm_workers_xgboostWorker_js.js +279 -0
  76. package/dist/wasm_workers_xgboostWorker_js.js.map +1 -0
  77. package/package.json +5 -4
  78. package/src/package-api.ts +259 -0
  79. package/src/package.g.ts +522 -0
  80. package/src/package.ts +907 -678
  81. package/test-console-output-1.log +95 -80
  82. package/test-record-1.mp4 +0 -0
  83. package/tsconfig.json +2 -2
  84. package/webpack.config.js +5 -0
  85. package/dist/111.js +0 -2
  86. package/dist/111.js.map +0 -1
  87. package/dist/128.js +0 -2
  88. package/dist/128.js.map +0 -1
  89. package/dist/153.js +0 -2
  90. package/dist/153.js.map +0 -1
  91. package/dist/23.js +0 -2
  92. package/dist/23.js.map +0 -1
  93. package/dist/234.js +0 -2
  94. package/dist/234.js.map +0 -1
  95. package/dist/242.js +0 -2
  96. package/dist/242.js.map +0 -1
  97. package/dist/260.js +0 -2
  98. package/dist/260.js.map +0 -1
  99. package/dist/33.js +0 -2
  100. package/dist/33.js.map +0 -1
  101. package/dist/348.js +0 -2
  102. package/dist/348.js.map +0 -1
  103. package/dist/377.js +0 -2
  104. package/dist/377.js.map +0 -1
  105. package/dist/412.js +0 -2
  106. package/dist/412.js.map +0 -1
  107. package/dist/415.js +0 -2
  108. package/dist/415.js.map +0 -1
  109. package/dist/501.js +0 -2
  110. package/dist/501.js.map +0 -1
  111. package/dist/531.js +0 -2
  112. package/dist/531.js.map +0 -1
  113. package/dist/583.js +0 -2
  114. package/dist/583.js.map +0 -1
  115. package/dist/589.js +0 -2
  116. package/dist/589.js.map +0 -1
  117. package/dist/603.js +0 -2
  118. package/dist/603.js.map +0 -1
  119. package/dist/656.js +0 -2
  120. package/dist/656.js.map +0 -1
  121. package/dist/682.js +0 -2
  122. package/dist/682.js.map +0 -1
  123. package/dist/705.js +0 -2
  124. package/dist/705.js.map +0 -1
  125. package/dist/727.js +0 -2
  126. package/dist/727.js.map +0 -1
  127. package/dist/731.js +0 -2
  128. package/dist/731.js.map +0 -1
  129. package/dist/738.js +0 -3
  130. package/dist/738.js.LICENSE.txt +0 -51
  131. package/dist/738.js.map +0 -1
  132. package/dist/763.js +0 -2
  133. package/dist/763.js.map +0 -1
  134. package/dist/778.js +0 -2
  135. package/dist/778.js.map +0 -1
  136. package/dist/783.js +0 -2
  137. package/dist/783.js.map +0 -1
  138. package/dist/793.js +0 -2
  139. package/dist/793.js.map +0 -1
  140. package/dist/801.js +0 -2
  141. package/dist/801.js.map +0 -1
  142. package/dist/810.js +0 -2
  143. package/dist/810.js.map +0 -1
  144. package/dist/860.js +0 -2
  145. package/dist/860.js.map +0 -1
  146. package/dist/907.js +0 -2
  147. package/dist/907.js.map +0 -1
  148. package/dist/950.js +0 -2
  149. package/dist/950.js.map +0 -1
  150. package/dist/980.js +0 -2
  151. package/dist/980.js.map +0 -1
  152. package/dist/990.js +0 -2
  153. package/dist/990.js.map +0 -1
@@ -0,0 +1,2244 @@
1
+ var eda;
2
+ /******/ (() => { // webpackBootstrap
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ "./node_modules/@datagrok-libraries/ml/src/MCL/clustering-steps.js":
6
+ /*!*************************************************************************!*\
7
+ !*** ./node_modules/@datagrok-libraries/ml/src/MCL/clustering-steps.js ***!
8
+ \*************************************************************************/
9
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
+
11
+ "use strict";
12
+ __webpack_require__.r(__webpack_exports__);
13
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14
+ /* harmony export */ colwiseNormilize: () => (/* binding */ colwiseNormilize),
15
+ /* harmony export */ initMCLMatrix: () => (/* binding */ initMCLMatrix),
16
+ /* harmony export */ mclInflate: () => (/* binding */ mclInflate),
17
+ /* harmony export */ prune: () => (/* binding */ prune),
18
+ /* harmony export */ runMarkovClustering: () => (/* binding */ runMarkovClustering)
19
+ /* harmony export */ });
20
+ /* harmony import */ var _mcl_sparse_matrix_mult__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mcl-sparse-matrix-mult */ "./node_modules/@datagrok-libraries/ml/src/MCL/mcl-sparse-matrix-mult.js");
21
+
22
+ function prune(sparseMatrix, pruneValue) {
23
+ const is = [];
24
+ const js = [];
25
+ const ds = [];
26
+ for (let i = 0; i < sparseMatrix.i.length; i++) {
27
+ if (sparseMatrix.distance[i] > pruneValue) {
28
+ is.push(sparseMatrix.i[i]);
29
+ js.push(sparseMatrix.j[i]);
30
+ ds.push(sparseMatrix.distance[i]);
31
+ }
32
+ }
33
+ return { i: new Uint32Array(is), j: new Uint32Array(js), distance: new Float32Array(ds) };
34
+ }
35
+ function mclInflate(sparseMatrix, pow) {
36
+ const d = sparseMatrix.distance;
37
+ for (let i = 0; i < sparseMatrix.i.length; i++)
38
+ d[i] = Math.pow(d[i], pow);
39
+ return sparseMatrix;
40
+ }
41
+ function colwiseNormilize(sparseMatrix, nRows, pruneValue, doPrune) {
42
+ if (doPrune)
43
+ sparseMatrix = prune(sparseMatrix, pruneValue);
44
+ const colSums = new Float32Array(nRows);
45
+ const d = sparseMatrix.distance;
46
+ const js = sparseMatrix.j;
47
+ for (let i = 0; i < sparseMatrix.i.length; i++)
48
+ colSums[js[i]] += d[i];
49
+ for (let i = 0; i < sparseMatrix.i.length; i++) {
50
+ const sum = colSums[js[i]];
51
+ if (sum !== 0)
52
+ d[i] /= sum;
53
+ }
54
+ return sparseMatrix;
55
+ }
56
+ function initMCLMatrix(sparseMatrix, nRows, pruneValue) {
57
+ // here we get sparse matrix that is only a half of the matrix
58
+ // also, the matrix contains distances, need to convert those into similarities
59
+ // also, we need to add self loops
60
+ const is = new Uint32Array(sparseMatrix.i.length * 2 + nRows);
61
+ const js = new Uint32Array(sparseMatrix.j.length * 2 + nRows);
62
+ const ds = new Float32Array(sparseMatrix.distance.length * 2 + nRows);
63
+ for (let i = 0; i < nRows; i++) {
64
+ is[i] = i;
65
+ js[i] = i;
66
+ ds[i] = 1;
67
+ }
68
+ for (let i = 0; i < sparseMatrix.i.length; i++) {
69
+ const start = i * 2 + nRows;
70
+ is[start] = sparseMatrix.i[i];
71
+ js[start] = sparseMatrix.j[i];
72
+ ds[start] = 1 - sparseMatrix.distance[i];
73
+ is[start + 1] = sparseMatrix.j[i];
74
+ js[start + 1] = sparseMatrix.i[i];
75
+ ds[start + 1] = 1 - sparseMatrix.distance[i];
76
+ }
77
+ // normalize
78
+ colwiseNormilize({ i: is, j: js, distance: ds }, nRows, pruneValue, false);
79
+ return { i: is, j: js, distance: ds };
80
+ }
81
+ async function runMarkovClustering(sparseMatrix, nRows, inflate, maxIter, pruneValue) {
82
+ let matrix = initMCLMatrix(sparseMatrix, nRows, pruneValue);
83
+ for (let i = 0; i < maxIter; i++) {
84
+ matrix = await (0,_mcl_sparse_matrix_mult__WEBPACK_IMPORTED_MODULE_0__.multSparseMatrix)(matrix, nRows, pruneValue);
85
+ // console.time('inflate');
86
+ //@ts-ignore
87
+ matrix = colwiseNormilize(matrix, nRows, pruneValue, false);
88
+ matrix = mclInflate(matrix, inflate);
89
+ //@ts-ignore
90
+ matrix = colwiseNormilize(matrix, nRows, pruneValue, true);
91
+ console.log('MCL iteration', i);
92
+ }
93
+ return matrix;
94
+ }
95
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3RlcmluZy1zdGVwcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb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cjogbnVtYmVyLCBwcnVuZVZhbHVlOiBudW1iZXJcbikge1xuICBsZXQgbWF0cml4ID0gaW5pdE1DTE1hdHJpeChzcGFyc2VNYXRyaXgsIG5Sb3dzLCBwcnVuZVZhbHVlKTtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBtYXhJdGVyOyBpKyspIHtcbiAgICBtYXRyaXggPSBhd2FpdCBtdWx0U3BhcnNlTWF0cml4KG1hdHJpeCwgblJvd3MsIHBydW5lVmFsdWUpO1xuICAgIC8vIGNvbnNvbGUudGltZSgnaW5mbGF0ZScpO1xuICAgIC8vQHRzLWlnbm9yZVxuICAgIG1hdHJpeCA9IGNvbHdpc2VOb3JtaWxpemUobWF0cml4LCBuUm93cywgcHJ1bmVWYWx1ZSwgZmFsc2UpO1xuICAgIG1hdHJpeCA9IG1jbEluZmxhdGUobWF0cml4LCBpbmZsYXRlKTtcblxuICAgIC8vQHRzLWlnbm9yZVxuICAgIG1hdHJpeCA9IGNvbHdpc2VOb3JtaWxpemUobWF0cml4LCBuUm93cywgcHJ1bmVWYWx1ZSwgdHJ1ZSk7XG4gICAgY29uc29sZS5sb2coJ01DTCBpdGVyYXRpb24nLCBpKTtcbiAgfVxuXG4gIHJldHVybiBtYXRyaXg7XG59XG4iXX0=
96
+
97
+ /***/ }),
98
+
99
+ /***/ "./node_modules/@datagrok-libraries/ml/src/MCL/markov-cluster.js":
100
+ /*!***********************************************************************!*\
101
+ !*** ./node_modules/@datagrok-libraries/ml/src/MCL/markov-cluster.js ***!
102
+ \***********************************************************************/
103
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
104
+
105
+ "use strict";
106
+ __webpack_require__.r(__webpack_exports__);
107
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
108
+ /* harmony export */ MCLSparseReducer: () => (/* binding */ MCLSparseReducer),
109
+ /* harmony export */ defaultMCLOptions: () => (/* binding */ defaultMCLOptions)
110
+ /* harmony export */ });
111
+ /* harmony import */ var _clustering_steps__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clustering-steps */ "./node_modules/@datagrok-libraries/ml/src/MCL/clustering-steps.js");
112
+ /* harmony import */ var _webCola__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webCola */ "./node_modules/@datagrok-libraries/ml/src/MCL/webCola.js");
113
+
114
+
115
+ const defaultMCLOptions = {
116
+ expandFactor: 2,
117
+ maxIterations: 5,
118
+ inflateFactor: 2,
119
+ multFactor: 1,
120
+ pruneValue: 1e-17,
121
+ };
122
+ class MCLSparseReducer {
123
+ constructor(opts = {}) {
124
+ this._options = { ...defaultMCLOptions, ...opts };
125
+ }
126
+ async transform(sparseMatrix, nRows) {
127
+ // get the superClusters before the MCL
128
+ // this will be used for layouting
129
+ const superClusters = this.assignClusters(sparseMatrix, nRows);
130
+ this.correctClusters(superClusters.clusters);
131
+ // before beggining the mcl, we need to save the connections between original points,
132
+ // as MCL might mutate the matrix
133
+ const clusterConnectionMap = this.splitConnectionsIntoClusters(sparseMatrix, superClusters.clusters);
134
+ // perform the MCL
135
+ const mclMatrix = await (0,_clustering_steps__WEBPACK_IMPORTED_MODULE_0__.runMarkovClustering)(sparseMatrix, nRows, this._options.inflateFactor, this._options.maxIterations, this._options.pruneValue);
136
+ const { clusters } = this.assignClusters(mclMatrix, nRows);
137
+ this.correctClusters(clusters);
138
+ const embeddings = this.layout(superClusters.clusters, clusterConnectionMap, nRows, clusters);
139
+ return { clusters, embedX: embeddings.embedX, embedY: embeddings.embedY, is: sparseMatrix.i, js: sparseMatrix.j };
140
+ }
141
+ async transformWebGPU(sparseMatrix, nRows) {
142
+ // TODO: implement correct webGPU version
143
+ return this.transform(sparseMatrix, nRows);
144
+ }
145
+ // here as we operate on original sparse matrix, we know for sure that there are no duplicates or self loops
146
+ splitConnectionsIntoClusters(sparseMatrix, clusters) {
147
+ const clusterConnections = new Map();
148
+ for (let i = 0; i < clusters.length; i++) {
149
+ if (!clusterConnections.has(clusters[i]))
150
+ clusterConnections.set(clusters[i], { i: [], j: [], v: [] });
151
+ }
152
+ for (let i = 0; i < sparseMatrix.i.length; i++) {
153
+ const cluster = clusters[sparseMatrix.i[i]];
154
+ const cc = clusterConnections.get(cluster);
155
+ cc.i.push(sparseMatrix.i[i]);
156
+ cc.j.push(sparseMatrix.j[i]);
157
+ cc.v.push(1 - sparseMatrix.distance[i]);
158
+ }
159
+ return clusterConnections;
160
+ }
161
+ assignClusters(sparseMatrix, nRows) {
162
+ let clusterNum = 0;
163
+ const is = [];
164
+ const js = [];
165
+ // array containing for each point which cluster it belongs to
166
+ const clusters = new Array(nRows).fill(-1);
167
+ for (let it = 0; it < sparseMatrix.i.length; it++) {
168
+ const i = sparseMatrix.i[it];
169
+ const j = sparseMatrix.j[it];
170
+ if (i === j)
171
+ continue;
172
+ is.push(i);
173
+ js.push(j);
174
+ if (clusters[i] !== -1 && clusters[j] !== -1) {
175
+ if (clusters[i] !== clusters[j])
176
+ this.mergeClusters(clusters, i, j);
177
+ }
178
+ else if (clusters[i] !== -1) {
179
+ clusters[j] = clusters[i];
180
+ }
181
+ else if (clusters[j] !== -1) {
182
+ clusters[i] = clusters[j];
183
+ }
184
+ else {
185
+ clusterNum++;
186
+ clusters[i] = clusterNum;
187
+ clusters[j] = clusterNum;
188
+ }
189
+ }
190
+ // final step for the clusters that are not connected to anything
191
+ for (let i = 0; i < clusters.length; i++) {
192
+ if (clusters[i] === -1) {
193
+ clusterNum++;
194
+ clusters[i] = clusterNum;
195
+ }
196
+ }
197
+ return { clusters, is: new Uint32Array(is), js: new Uint32Array(js) };
198
+ }
199
+ mergeClusters(clusters, i, j) {
200
+ const iCluster = clusters[i];
201
+ const jCluster = clusters[j];
202
+ for (let k = 0; k < clusters.length; k++) {
203
+ if (clusters[k] === jCluster)
204
+ clusters[k] = iCluster;
205
+ }
206
+ }
207
+ /** After assigning and merging, clusters will need reordering according to size */
208
+ correctClusters(clusters) {
209
+ const clusterSizeMap = {};
210
+ for (const cluster of clusters) {
211
+ if (!clusterSizeMap[cluster])
212
+ clusterSizeMap[cluster] = 0;
213
+ clusterSizeMap[cluster]++;
214
+ }
215
+ const sortedIndexes = Object.keys(clusterSizeMap).map(Number).sort((a, b) => clusterSizeMap[b] - clusterSizeMap[a]);
216
+ const clusterMap = {};
217
+ sortedIndexes.forEach((clusterIdx, i) => clusterMap[clusterIdx] = i + 1);
218
+ for (let i = 0; i < clusters.length; i++)
219
+ clusters[i] = clusterMap[clusters[i]];
220
+ }
221
+ /** notice that here, first argument is the superclusters and last is the subClusters
222
+ * the second argument is the original sparse matrix, and the third is the number of rows
223
+ */
224
+ layout(clusters, clusterConnectionMap, nRows, subCluster) {
225
+ const embedX = new Float32Array(nRows).fill(0);
226
+ const embedY = new Float32Array(nRows).fill(0);
227
+ const clusterMap = {};
228
+ clusters.forEach((cluster, i) => {
229
+ if (!clusterMap[cluster])
230
+ clusterMap[cluster] = [];
231
+ clusterMap[cluster].push(i);
232
+ });
233
+ // split sparse matrix connections into super-clusters, save only indexes
234
+ let clusterNum = 0;
235
+ const sortedClusterNames = Object.keys(clusterMap);
236
+ sortedClusterNames.sort((a, b) => clusterMap[b].length - clusterMap[a].length);
237
+ let perRow = 1;
238
+ const perRowMultiplier = 3;
239
+ let yOffset = 0;
240
+ const layoutSize = 5;
241
+ // cluster sizes could be different, but also very similar. first cluster size can be quite similar
242
+ // to the second one. if not accounted for, the layout will be very unbalanced, and first cluster will
243
+ // be very large
244
+ const perRowSizes = [1];
245
+ // if first two cluster sizes are very similar, first perrow should be 2
246
+ if (sortedClusterNames.length > 1) {
247
+ const clustSize1 = clusterMap[sortedClusterNames[0]].length;
248
+ const clustSize2 = clusterMap[sortedClusterNames[1]].length;
249
+ if (clustSize1 / clustSize2 < 2)
250
+ perRowSizes[0] = 2;
251
+ let curPerRowSize = perRowSizes[0];
252
+ let maxClustersInNextRow = curPerRowSize * perRowMultiplier;
253
+ let pointsInCurRow = curPerRowSize == 1 ? clustSize1 : clustSize1 + clustSize2;
254
+ let pointsAccum = 0;
255
+ let clustersAccum = 0;
256
+ for (let i = 2; i < sortedClusterNames.length; i++) {
257
+ pointsAccum += clusterMap[sortedClusterNames[i]].length;
258
+ clustersAccum++;
259
+ if (clustersAccum > maxClustersInNextRow || pointsAccum >= pointsInCurRow * 0.7 || i === sortedClusterNames.length - 1) {
260
+ perRowSizes.push(i === sortedClusterNames.length - 1 ? maxClustersInNextRow : clustersAccum);
261
+ curPerRowSize = clustersAccum;
262
+ maxClustersInNextRow = curPerRowSize * perRowMultiplier;
263
+ pointsInCurRow = Math.max(pointsAccum, pointsInCurRow);
264
+ pointsAccum = 0;
265
+ clustersAccum = 0;
266
+ }
267
+ }
268
+ }
269
+ perRow = perRowSizes[0];
270
+ let perRowIdx = 0;
271
+ for (const clusterName of sortedClusterNames) {
272
+ const cluster = clusterMap[clusterName];
273
+ const clusterConnections = clusterConnectionMap.get(Number(clusterName));
274
+ const embeddings = (0,_webCola__WEBPACK_IMPORTED_MODULE_1__.getWebColaLayot)(cluster, clusterConnections, subCluster);
275
+ if (clusterNum === perRow) {
276
+ clusterNum = 0;
277
+ yOffset += layoutSize / perRow;
278
+ perRowIdx++;
279
+ perRow = Math.min(Math.ceil(perRowSizes[perRowIdx]), 45);
280
+ }
281
+ //const clustersPerRow = Math.ceil(perRow / 1.5);
282
+ const offsetX = ((clusterNum) * layoutSize / perRow + layoutSize / perRow * (1 / 1.2 / 4));
283
+ // const offsetY = Math.floor(clusterNum / perRow) * 2;
284
+ for (let i = 0; i < embeddings.embedX.length; i++) {
285
+ embedX[cluster[i]] = embeddings.embedX[i] * layoutSize / perRow / 1.2 + offsetX;
286
+ embedY[cluster[i]] = embeddings.embedY[i] * layoutSize / perRow / 1.2 + yOffset;
287
+ }
288
+ clusterNum++;
289
+ }
290
+ return { embedX, embedY };
291
+ }
292
+ }
293
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFya292LWNsdXN0ZXIuanMiLCJzb3Vy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5cbiJdfQ==
294
+
295
+ /***/ }),
296
+
297
+ /***/ "./node_modules/@datagrok-libraries/ml/src/MCL/mcl-sparse-matrix-mult.js":
298
+ /*!*******************************************************************************!*\
299
+ !*** ./node_modules/@datagrok-libraries/ml/src/MCL/mcl-sparse-matrix-mult.js ***!
300
+ \*******************************************************************************/
301
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
302
+
303
+ "use strict";
304
+ __webpack_require__.r(__webpack_exports__);
305
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
306
+ /* harmony export */ multSparseMatrix: () => (/* binding */ multSparseMatrix)
307
+ /* harmony export */ });
308
+ // simple semaphore
309
+ let semaphore = Promise.resolve();
310
+ const lock = async () => {
311
+ await semaphore;
312
+ let release = () => { };
313
+ const promise = new Promise((resolve) => {
314
+ release = resolve;
315
+ });
316
+ semaphore = promise;
317
+ return release;
318
+ };
319
+ /** Multiplies sparse matrix by itself. note that it expects that sparse matrix is full
320
+ * (i.e. not only the upper right corner) and it has self loops if any */
321
+ async function multSparseMatrix(sparseMatrix, nRows, pruneValue) {
322
+ const workersNum = Math.min(Math.min(Math.max(navigator.hardwareConcurrency - 2, 1), nRows), 10);
323
+ // number of horizontal strips that we will divide the matrix into
324
+ // we divide the matrix into horizontal strips, because its faster for indexing and better for cache
325
+ const numOfHorizontalStrinps = workersNum * 5;
326
+ const indexStarts = new Uint32Array(numOfHorizontalStrinps);
327
+ const indexEnds = new Uint32Array(numOfHorizontalStrinps);
328
+ const blockHeight = nRows / numOfHorizontalStrinps;
329
+ for (let i = 0; i < numOfHorizontalStrinps; i++) {
330
+ indexStarts[i] = Math.floor(i * blockHeight);
331
+ indexEnds[i] = i === numOfHorizontalStrinps - 1 ? nRows : Math.floor((i + 1) * blockHeight);
332
+ }
333
+ const workers = new Array(workersNum).fill(0)
334
+ .map(() => new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u("node_modules_datagrok-libraries_ml_src_MCL_mcl-sparse-matrix-mult-worker_js"), __webpack_require__.b)));
335
+ const availableIndexes = new Set();
336
+ for (let i = 0; i < numOfHorizontalStrinps; i++)
337
+ availableIndexes.add(i);
338
+ const initPromises = workers.map((worker) => {
339
+ return new Promise((resolve) => {
340
+ worker.postMessage({
341
+ is: sparseMatrix.i,
342
+ js: sparseMatrix.j,
343
+ ds: sparseMatrix.distance,
344
+ nRows,
345
+ pruneValue
346
+ });
347
+ worker.onmessage = () => {
348
+ resolve();
349
+ };
350
+ });
351
+ });
352
+ await Promise.all(initPromises);
353
+ const res = [];
354
+ const takeChunk = async (workerIdx) => {
355
+ const release = await lock();
356
+ const index = availableIndexes.values().next().value;
357
+ if (index == null) {
358
+ release();
359
+ return;
360
+ }
361
+ availableIndexes.delete(index);
362
+ release();
363
+ await new Promise((resolve) => {
364
+ workers[workerIdx].postMessage({
365
+ blockStart: indexStarts[index],
366
+ blockEnd: indexEnds[index],
367
+ workerIdx
368
+ });
369
+ workers[workerIdx].onmessage = (e) => {
370
+ res.push(e.data);
371
+ resolve();
372
+ };
373
+ });
374
+ await takeChunk(workerIdx);
375
+ };
376
+ const promises = workers.map((_worker, i) => {
377
+ return takeChunk(i);
378
+ });
379
+ await Promise.all(promises);
380
+ workers.forEach((worker) => worker.terminate());
381
+ let totLen = 0;
382
+ for (const r of res)
383
+ totLen += r.i.length;
384
+ const i = new Uint32Array(totLen);
385
+ const j = new Uint32Array(totLen);
386
+ const d = new Float32Array(totLen);
387
+ let offset = 0;
388
+ for (const r of res) {
389
+ i.set(r.i, offset);
390
+ j.set(r.j, offset);
391
+ d.set(r.distance, offset);
392
+ offset += r.i.length;
393
+ }
394
+ // don't forget to get the updated values for the diagonal, their rows need to be basically squared and summed
395
+ // also, the diagonal values are not pruned
396
+ return { i, j, distance: d };
397
+ }
398
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWNsLXNwYXJzZS1tYXRyaXgtbXVsdC5qcyIsInNvdXJjZVJvb3QiOiIiLC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b21pc2VzKTtcbiAgd29ya2Vycy5mb3JFYWNoKCh3b3JrZXIpID0+IHdvcmtlci50ZXJtaW5hdGUoKSk7XG5cblxuICBsZXQgdG90TGVuID0gMDtcbiAgZm9yIChjb25zdCByIG9mIHJlcylcbiAgICB0b3RMZW4gKz0gci5pLmxlbmd0aDtcblxuICBjb25zdCBpID0gbmV3IFVpbnQzMkFycmF5KHRvdExlbik7XG4gIGNvbnN0IGogPSBuZXcgVWludDMyQXJyYXkodG90TGVuKTtcbiAgY29uc3QgZCA9IG5ldyBGbG9hdDMyQXJyYXkodG90TGVuKTtcbiAgbGV0IG9mZnNldCA9IDA7XG4gIGZvciAoY29uc3QgciBvZiByZXMpIHtcbiAgICBpLnNldChyLmksIG9mZnNldCk7XG4gICAgai5zZXQoci5qLCBvZmZzZXQpO1xuICAgIGQuc2V0KHIuZGlzdGFuY2UsIG9mZnNldCk7XG4gICAgb2Zmc2V0ICs9IHIuaS5sZW5ndGg7XG4gIH1cblxuICAvLyBkb24ndCBmb3JnZXQgdG8gZ2V0IHRoZSB1cGRhdGVkIHZhbHVlcyBmb3IgdGhlIGRpYWdvbmFsLCB0aGVpciByb3dzIG5lZWQgdG8gYmUgYmFzaWNhbGx5IHNxdWFyZWQgYW5kIHN1bW1lZFxuICAvLyBhbHNvLCB0aGUgZGlhZ29uYWwgdmFsdWVzIGFyZSBub3QgcHJ1bmVkXG5cbiAgcmV0dXJuIHtpLCBqLCBkaXN0YW5jZTogZH07XG59XG4iXX0=
399
+
400
+ /***/ }),
401
+
402
+ /***/ "./node_modules/@datagrok-libraries/ml/src/MCL/mcl-worker.js":
403
+ /*!*******************************************************************!*\
404
+ !*** ./node_modules/@datagrok-libraries/ml/src/MCL/mcl-worker.js ***!
405
+ \*******************************************************************/
406
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
407
+
408
+ "use strict";
409
+ __webpack_require__.r(__webpack_exports__);
410
+ /* harmony import */ var _datagrok_libraries_math_src_webGPU_sparse_matrix_webGPU_sparse_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @datagrok-libraries/math/src/webGPU/sparse-matrix/webGPU-sparse-matrix */ "./node_modules/@datagrok-libraries/math/src/webGPU/sparse-matrix/webGPU-sparse-matrix.js");
411
+ /* harmony import */ var _distance_matrix_sparse_matrix_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../distance-matrix/sparse-matrix-service */ "./node_modules/@datagrok-libraries/ml/src/distance-matrix/sparse-matrix-service.js");
412
+ /* harmony import */ var _markov_cluster__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./markov-cluster */ "./node_modules/@datagrok-libraries/ml/src/MCL/markov-cluster.js");
413
+
414
+
415
+
416
+ onmessage = async (event) => {
417
+ const { data, threshold, weights, aggregationMethod, distanceFnArgs, distanceFns, maxIterations, useWebGPU, inflate } = event.data;
418
+ console.time('sparse matrix');
419
+ let sparse = null;
420
+ if (useWebGPU) {
421
+ try {
422
+ sparse = await (0,_datagrok_libraries_math_src_webGPU_sparse_matrix_webGPU_sparse_matrix__WEBPACK_IMPORTED_MODULE_0__.multiColWebGPUSparseMatrix)(data, threshold / 100, distanceFns, aggregationMethod, weights, distanceFnArgs);
423
+ }
424
+ catch (e) {
425
+ console.error(e);
426
+ }
427
+ }
428
+ if (!sparse) { // falsback to CPU
429
+ if (useWebGPU)
430
+ console.error('WEBGPU sparse matrix calculation failed, falling back to CPU implementation');
431
+ sparse = await new _distance_matrix_sparse_matrix_service__WEBPACK_IMPORTED_MODULE_1__.SparseMatrixService()
432
+ .calcMultiColumn(data, distanceFns, threshold / 100, distanceFnArgs, weights, aggregationMethod);
433
+ }
434
+ const MAX_MCL_CONNECTIONS = 1000000;
435
+ if (sparse.i.length > MAX_MCL_CONNECTIONS)
436
+ sparse = _distance_matrix_sparse_matrix_service__WEBPACK_IMPORTED_MODULE_1__.SparseMatrixService.pruneSparseMatrix(sparse, MAX_MCL_CONNECTIONS);
437
+ console.timeEnd('sparse matrix');
438
+ //const res = await new MCLSparseReducer({maxIterations: maxIterations ?? 5}).transform(sparse, data[0].length);
439
+ const reducer = new _markov_cluster__WEBPACK_IMPORTED_MODULE_2__.MCLSparseReducer({ maxIterations: maxIterations ?? 5, inflateFactor: inflate ?? 2 });
440
+ console.time('MCL');
441
+ let res = null;
442
+ if (useWebGPU) {
443
+ try {
444
+ res = await reducer.transformWebGPU(sparse, data[0].length);
445
+ }
446
+ catch (e) {
447
+ console.error('webGPU MCL failed, falling back to CPU implementation');
448
+ console.error(e);
449
+ }
450
+ }
451
+ if (!res)
452
+ res = await reducer.transform(sparse, data[0].length);
453
+ console.timeEnd('MCL');
454
+ postMessage({ res });
455
+ };
456
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWNsLXdvcmtlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIm1jbC13b3JrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLDBCQUEwQixFQUFDLE1BQU0sd0VBQXdFLENBQUM7QUFDbEgsT0FBTyxFQUFxQixtQkFBbUIsRUFBQyxNQUFNLDBDQUEwQyxDQUFDO0FBR2pHLE9BQU8sRUFBQyxnQkFBZ0IsRUFBQyxNQUFNLGtCQUFrQixDQUFDO0FBRWxELFNBQVMsR0FBRyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUU7SUFDMUIsTUFBTSxFQUFDLElBQUksRUFBRSxTQUFTLEVBQUUsT0FBTyxFQUFFLGlCQUFpQixFQUFFLGNBQWMsRUFBRSxXQUFXLEVBQUUsYUFBYSxFQUFFLFNBQVMsRUFBRSxPQUFPLEVBQUMsR0FNL0csS0FBSyxDQUFDLElBQUksQ0FBQztJQUVmLE9BQU8sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUM7SUFDOUIsSUFBSSxNQUFNLEdBQThCLElBQUksQ0FBQztJQUM3QyxJ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hcnNlUmVkdWNlcih7bWF4SXRlcmF0aW9uczogbWF4SXRlcmF0aW9ucyA/PyA1LCBpbmZsYXRlRmFjdG9yOiBpbmZsYXRlID8/IDJ9KTtcbiAgY29uc29sZS50aW1lKCdNQ0wnKTtcbiAgbGV0IHJlczogYW55ID0gbnVsbDtcbiAgaWYgKHVzZVdlYkdQVSkge1xuICAgIHRyeSB7XG4gICAgICByZXMgPSBhd2FpdCByZWR1Y2VyLnRyYW5zZm9ybVdlYkdQVShzcGFyc2UsIGRhdGFbMF0ubGVuZ3RoKTtcbiAgICB9IGNhdGNoIChlKSB7XG4gICAgICBjb25zb2xlLmVycm9yKCd3ZWJHUFUgTUNMIGZhaWxlZCwgZmFsbGluZyBiYWNrIHRvIENQVSBpbXBsZW1lbnRhdGlvbicpO1xuICAgICAgY29uc29sZS5lcnJvcihlKTtcbiAgICB9XG4gIH1cbiAgaWYgKCFyZXMpXG4gICAgcmVzID0gYXdhaXQgcmVkdWNlci50cmFuc2Zvcm0oc3BhcnNlLCBkYXRhWzBdLmxlbmd0aCk7XG4gIGNvbnNvbGUudGltZUVuZCgnTUNMJyk7XG5cbiAgcG9zdE1lc3NhZ2Uoe3Jlc30pO1xufTtcbiJdfQ==
457
+
458
+ /***/ }),
459
+
460
+ /***/ "./node_modules/@datagrok-libraries/ml/src/MCL/webCola.js":
461
+ /*!****************************************************************!*\
462
+ !*** ./node_modules/@datagrok-libraries/ml/src/MCL/webCola.js ***!
463
+ \****************************************************************/
464
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
465
+
466
+ "use strict";
467
+ __webpack_require__.r(__webpack_exports__);
468
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
469
+ /* harmony export */ getWebColaLayot: () => (/* binding */ getWebColaLayot)
470
+ /* harmony export */ });
471
+ /* harmony import */ var graphology__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphology */ "./node_modules/graphology/dist/graphology.umd.min.js");
472
+ /* harmony import */ var graphology__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphology__WEBPACK_IMPORTED_MODULE_0__);
473
+ /* harmony import */ var graphology_layout_forceatlas2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphology-layout-forceatlas2 */ "./node_modules/graphology-layout-forceatlas2/index.js");
474
+ /* harmony import */ var graphology_layout_forceatlas2__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphology_layout_forceatlas2__WEBPACK_IMPORTED_MODULE_1__);
475
+ /* eslint-disable max-len */
476
+
477
+
478
+ // note: subCluster is of size nRows and contains for each point which subcluster it belongs to
479
+ // note: cluster is of size of this concrete supercluster, and contains the indexes of the points in that supercluster
480
+ function getWebColaLayot(cluster, clusterConnections, _subCluster) {
481
+ const graph = new (graphology__WEBPACK_IMPORTED_MODULE_0___default())();
482
+ for (let i = 0; i < cluster.length; i++)
483
+ graph.addNode(cluster[i], { x: Math.random() * 20000, y: Math.random() * 20000 });
484
+ for (let it = 0; it < clusterConnections.i.length; it++) {
485
+ const i = clusterConnections.i[it];
486
+ const j = clusterConnections.j[it];
487
+ const v = clusterConnections.v[it];
488
+ if (i === j || v <= 0)
489
+ continue;
490
+ const weight = _subCluster[i] === _subCluster[j] ? 2 : 1;
491
+ graph.addEdge(i, j, { weight: v * weight });
492
+ }
493
+ const settings = {
494
+ iterations: 100,
495
+ // edgeWeightInfluence: 1, // Influence of edge weights on the layout
496
+ // scalingRatio: 1, // Scaling ratio to account for node sizes
497
+ // //barnesHutOptimize: true,
498
+ // //barnesHutTheta: 0.5,
499
+ // adjustSizes: true,
500
+ // weighted: true,
501
+ // strongGravityMode: true,
502
+ getEdgeWeight: 'weight',
503
+ settings: { ...graphology_layout_forceatlas2__WEBPACK_IMPORTED_MODULE_1___default().inferSettings(graph), weighted: true, edgeWeightInfluence: 1 }
504
+ };
505
+ graphology_layout_forceatlas2__WEBPACK_IMPORTED_MODULE_1___default().assign(graph, settings);
506
+ const embedX1 = new Float32Array(cluster.length);
507
+ const embedY1 = new Float32Array(cluster.length);
508
+ for (let i = 0; i < cluster.length; i++) {
509
+ const node = graph.getNodeAttributes(cluster[i]);
510
+ embedX1[i] = node.x;
511
+ embedY1[i] = node.y;
512
+ }
513
+ let minX = embedX1[0];
514
+ let minY = embedY1[0];
515
+ let maxX = embedX1[0];
516
+ let maxY = embedY1[0];
517
+ for (let i = 1; i < cluster.length; i++) {
518
+ minX = Math.min(minX, embedX1[i]);
519
+ minY = Math.min(minY, embedY1[i]);
520
+ maxX = Math.max(maxX, embedX1[i]);
521
+ maxY = Math.max(maxY, embedY1[i]);
522
+ }
523
+ let scaleX = maxX - minX;
524
+ let scaleY = maxY - minY;
525
+ if (scaleX === 0)
526
+ scaleX = 1;
527
+ if (scaleY === 0)
528
+ scaleY = 1;
529
+ for (let i = 0; i < cluster.length; i++) {
530
+ embedX1[i] = (embedX1[i] - minX) / scaleX;
531
+ embedY1[i] = (embedY1[i] - minY) / scaleY;
532
+ }
533
+ return { embedX: embedX1, embedY: embedY1 };
534
+ }
535
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2ViQ29sYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIndlYkNvbGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNEJBQTRCO0FBRTVCLE9BQU8sS0FBSyxNQUFNLFlBQVksQ0FBQztBQUMvQixPQUFPLFdBQVcsTUFBTSwrQkFBK0IsQ0FBQztBQUV4RCwrRkFBK0Y7QUFDL0Ysc0hBQXNIO0FBQ3RILE1BQU0sVUFBVSxlQUFlLENBQzdCLE9BQWlCLEVBQUUsa0JBQTJELEVBQUUsV0FBcUI7SUFLckcsTUFBTSxLQUFLLEdBQUcsSUFBSSxLQUFLLEVBQUUsQ0FBQztJQUMxQixLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUc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taW5ZO1xuICBpZiAoc2NhbGVYID09PSAwKVxuICAgIHNjYWxlWCA9IDE7XG4gIGlmIChzY2FsZVkgPT09IDApXG4gICAgc2NhbGVZID0gMTtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBjbHVzdGVyLmxlbmd0aDsgaSsrKSB7XG4gICAgZW1iZWRYMVtpXSA9IChlbWJlZFgxW2ldIC0gbWluWCkgLyBzY2FsZVg7XG4gICAgZW1iZWRZMVtpXSA9IChlbWJlZFkxW2ldIC0gbWluWSkgLyBzY2FsZVk7XG4gIH1cblxuICByZXR1cm4ge2VtYmVkWDogZW1iZWRYMSwgZW1iZWRZOiBlbWJlZFkxfTtcbn1cbiJdfQ==
536
+
537
+ /***/ }),
538
+
539
+ /***/ "./node_modules/@datagrok-libraries/ml/src/distance-matrix/types.js":
540
+ /*!**************************************************************************!*\
541
+ !*** ./node_modules/@datagrok-libraries/ml/src/distance-matrix/types.js ***!
542
+ \**************************************************************************/
543
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
544
+
545
+ "use strict";
546
+ __webpack_require__.r(__webpack_exports__);
547
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
548
+ /* harmony export */ DistanceAggregationMethods: () => (/* binding */ DistanceAggregationMethods)
549
+ /* harmony export */ });
550
+ var DistanceAggregationMethods;
551
+ (function (DistanceAggregationMethods) {
552
+ DistanceAggregationMethods["EUCLIDEAN"] = "EUCLIDEAN";
553
+ DistanceAggregationMethods["MANHATTAN"] = "MANHATTAN";
554
+ })(DistanceAggregationMethods || (DistanceAggregationMethods = {}));
555
+ ;
556
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSwwQkFHVDtBQUhILFdBQVksMEJBQTBCO0lBQ2xDLHFEQUF1QixDQUFBO0lBQ3ZCLHFEQUF1QixDQUFBO0FBQ3pCLENBQUMsRUFIUywwQkFBMEIsS0FBMUIsMEJBQTBCLFFBR25DO0FBQUEsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBlbnVtIERpc3RhbmNlQWdncmVnYXRpb25NZXRob2RzIHtcbiAgICBFVUNMSURFQU4gPSAnRVVDTElERUFOJyxcbiAgICBNQU5IQVRUQU4gPSAnTUFOSEFUVEFOJyxcbiAgfTtcblxuZXhwb3J0IHR5cGUgRGlzdGFuY2VBZ2dyZWdhdGlvbk1ldGhvZCA9IGtleW9mIHR5cGVvZiBEaXN0YW5jZUFnZ3JlZ2F0aW9uTWV0aG9kcztcbiJdfQ==
557
+
558
+ /***/ }),
559
+
560
+ /***/ "./node_modules/@datagrok-libraries/ml/src/distance-matrix/utils.js":
561
+ /*!**************************************************************************!*\
562
+ !*** ./node_modules/@datagrok-libraries/ml/src/distance-matrix/utils.js ***!
563
+ \**************************************************************************/
564
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
565
+
566
+ "use strict";
567
+ __webpack_require__.r(__webpack_exports__);
568
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
569
+ /* harmony export */ getAggregationFunction: () => (/* binding */ getAggregationFunction),
570
+ /* harmony export */ insertLarger: () => (/* binding */ insertLarger),
571
+ /* harmony export */ insertSmaller: () => (/* binding */ insertSmaller),
572
+ /* harmony export */ isNil: () => (/* binding */ isNil)
573
+ /* harmony export */ });
574
+ /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./node_modules/@datagrok-libraries/ml/src/distance-matrix/types.js");
575
+
576
+ const isNil = (x) => x === null || x === undefined;
577
+ function insertSmaller(distancesAr, indexes, num, index) {
578
+ if (num > distancesAr[distancesAr.length - 1])
579
+ return;
580
+ const newPosition = distancesAr.findIndex((v) => num < v);
581
+ distancesAr.pop();
582
+ distancesAr.splice(newPosition, 0, num);
583
+ indexes.pop();
584
+ indexes.splice(newPosition, 0, index);
585
+ }
586
+ function insertLarger(distancesAr, indexes, num, index) {
587
+ if (num < distancesAr[distancesAr.length - 1])
588
+ return;
589
+ const newPosition = distancesAr.findIndex((v) => num > v);
590
+ distancesAr.pop();
591
+ distancesAr.splice(newPosition, 0, num);
592
+ indexes.pop();
593
+ indexes.splice(newPosition, 0, index);
594
+ }
595
+ function getAggregationFunction(aggregationMethod, weights) {
596
+ switch (aggregationMethod) {
597
+ case _types__WEBPACK_IMPORTED_MODULE_0__.DistanceAggregationMethods.MANHATTAN:
598
+ return (vs) => vs.reduce((acc, val, idx) => acc + val * weights[idx], 0);
599
+ default:
600
+ return (vs) => {
601
+ // euclidean
602
+ const sum = vs.reduce((acc, val, idx) => acc + (val * weights[idx]) ** 2, 0);
603
+ return Math.sqrt(sum);
604
+ };
605
+ }
606
+ }
607
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ1dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQTRCLDBCQUEwQixFQUFDLE1BQU0sU0FBUyxDQUFDO0FBRTlFLE1BQU0sQ0FBQyxNQUFNLEtBQUssR0FBRyxDQUFDLENBQU0sRUFBRSxFQUFFLENBQUMsQ0FBQyxLQUFLLElBQUksSUFBSSxDQUFDLEtBQUssU0FBUyxDQUFDO0FBRS9ELE1BQU0sVUFBVSxhQUFhLENBQUMsV0FBcUIsRUFBRSxPQUFpQixFQUFFLEdBQVcsRUFBRSxLQUFhO0lBQ2hHLElBQUksR0FBRyxHQUFHLFdBQVcsQ0FBQyxXQUFXLENBQUMsTUFBTSxHQUFDLENBQUMsQ0FBQztRQUN6QyxPQUFPO0lBRVQsTUFBTSxXQUFXLEdBQUcsV0FBVyxDQUFDLFNBQVMsQ0FBQyxDQU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hY2MsIHZhbCwgaWR4KSA9PiBhY2MgKyB2YWwgKiB3ZWlnaHRzW2lkeF0sIDApO1xuICAgIGRlZmF1bHQ6XG4gICAgICByZXR1cm4gKHZzOiBudW1iZXJbXSkgPT4ge1xuICAgICAgICAvLyBldWNsaWRlYW5cbiAgICAgICAgY29uc3Qgc3VtID0gdnMucmVkdWNlKChhY2MsIHZhbCwgaWR4KSA9PiBhY2MgKyAodmFsICogd2VpZ2h0c1tpZHhdKSAqKiAyLCAwKTtcbiAgICAgICAgcmV0dXJuIE1hdGguc3FydChzdW0pO1xuICAgICAgfTtcbiAgfVxufVxuIl19
608
+
609
+ /***/ }),
610
+
611
+ /***/ "./node_modules/graphology-layout-forceatlas2/defaults.js":
612
+ /*!****************************************************************!*\
613
+ !*** ./node_modules/graphology-layout-forceatlas2/defaults.js ***!
614
+ \****************************************************************/
615
+ /***/ ((module) => {
616
+
617
+ /**
618
+ * Graphology ForceAtlas2 Layout Default Settings
619
+ * ===============================================
620
+ */
621
+ module.exports = {
622
+ linLogMode: false,
623
+ outboundAttractionDistribution: false,
624
+ adjustSizes: false,
625
+ edgeWeightInfluence: 1,
626
+ scalingRatio: 1,
627
+ strongGravityMode: false,
628
+ gravity: 1,
629
+ slowDown: 1,
630
+ barnesHutOptimize: false,
631
+ barnesHutTheta: 0.5
632
+ };
633
+
634
+
635
+ /***/ }),
636
+
637
+ /***/ "./node_modules/graphology-layout-forceatlas2/helpers.js":
638
+ /*!***************************************************************!*\
639
+ !*** ./node_modules/graphology-layout-forceatlas2/helpers.js ***!
640
+ \***************************************************************/
641
+ /***/ ((__unused_webpack_module, exports) => {
642
+
643
+ /**
644
+ * Graphology ForceAtlas2 Helpers
645
+ * ===============================
646
+ *
647
+ * Miscellaneous helper functions.
648
+ */
649
+
650
+ /**
651
+ * Constants.
652
+ */
653
+ var PPN = 10;
654
+ var PPE = 3;
655
+
656
+ /**
657
+ * Very simple Object.assign-like function.
658
+ *
659
+ * @param {object} target - First object.
660
+ * @param {object} [...objects] - Objects to merge.
661
+ * @return {object}
662
+ */
663
+ exports.assign = function (target) {
664
+ target = target || {};
665
+
666
+ var objects = Array.prototype.slice.call(arguments).slice(1),
667
+ i,
668
+ k,
669
+ l;
670
+
671
+ for (i = 0, l = objects.length; i < l; i++) {
672
+ if (!objects[i]) continue;
673
+
674
+ for (k in objects[i]) target[k] = objects[i][k];
675
+ }
676
+
677
+ return target;
678
+ };
679
+
680
+ /**
681
+ * Function used to validate the given settings.
682
+ *
683
+ * @param {object} settings - Settings to validate.
684
+ * @return {object|null}
685
+ */
686
+ exports.validateSettings = function (settings) {
687
+ if ('linLogMode' in settings && typeof settings.linLogMode !== 'boolean')
688
+ return {message: 'the `linLogMode` setting should be a boolean.'};
689
+
690
+ if (
691
+ 'outboundAttractionDistribution' in settings &&
692
+ typeof settings.outboundAttractionDistribution !== 'boolean'
693
+ )
694
+ return {
695
+ message:
696
+ 'the `outboundAttractionDistribution` setting should be a boolean.'
697
+ };
698
+
699
+ if ('adjustSizes' in settings && typeof settings.adjustSizes !== 'boolean')
700
+ return {message: 'the `adjustSizes` setting should be a boolean.'};
701
+
702
+ if (
703
+ 'edgeWeightInfluence' in settings &&
704
+ typeof settings.edgeWeightInfluence !== 'number'
705
+ )
706
+ return {
707
+ message: 'the `edgeWeightInfluence` setting should be a number.'
708
+ };
709
+
710
+ if (
711
+ 'scalingRatio' in settings &&
712
+ !(typeof settings.scalingRatio === 'number' && settings.scalingRatio >= 0)
713
+ )
714
+ return {message: 'the `scalingRatio` setting should be a number >= 0.'};
715
+
716
+ if (
717
+ 'strongGravityMode' in settings &&
718
+ typeof settings.strongGravityMode !== 'boolean'
719
+ )
720
+ return {message: 'the `strongGravityMode` setting should be a boolean.'};
721
+
722
+ if (
723
+ 'gravity' in settings &&
724
+ !(typeof settings.gravity === 'number' && settings.gravity >= 0)
725
+ )
726
+ return {message: 'the `gravity` setting should be a number >= 0.'};
727
+
728
+ if (
729
+ 'slowDown' in settings &&
730
+ !(typeof settings.slowDown === 'number' || settings.slowDown >= 0)
731
+ )
732
+ return {message: 'the `slowDown` setting should be a number >= 0.'};
733
+
734
+ if (
735
+ 'barnesHutOptimize' in settings &&
736
+ typeof settings.barnesHutOptimize !== 'boolean'
737
+ )
738
+ return {message: 'the `barnesHutOptimize` setting should be a boolean.'};
739
+
740
+ if (
741
+ 'barnesHutTheta' in settings &&
742
+ !(
743
+ typeof settings.barnesHutTheta === 'number' &&
744
+ settings.barnesHutTheta >= 0
745
+ )
746
+ )
747
+ return {message: 'the `barnesHutTheta` setting should be a number >= 0.'};
748
+
749
+ return null;
750
+ };
751
+
752
+ /**
753
+ * Function generating a flat matrix for both nodes & edges of the given graph.
754
+ *
755
+ * @param {Graph} graph - Target graph.
756
+ * @param {function} getEdgeWeight - Edge weight getter function.
757
+ * @return {object} - Both matrices.
758
+ */
759
+ exports.graphToByteArrays = function (graph, getEdgeWeight) {
760
+ var order = graph.order;
761
+ var size = graph.size;
762
+ var index = {};
763
+ var j;
764
+
765
+ // NOTE: float32 could lead to issues if edge array needs to index large
766
+ // number of nodes.
767
+ var NodeMatrix = new Float32Array(order * PPN);
768
+ var EdgeMatrix = new Float32Array(size * PPE);
769
+
770
+ // Iterate through nodes
771
+ j = 0;
772
+ graph.forEachNode(function (node, attr) {
773
+ // Node index
774
+ index[node] = j;
775
+
776
+ // Populating byte array
777
+ NodeMatrix[j] = attr.x;
778
+ NodeMatrix[j + 1] = attr.y;
779
+ NodeMatrix[j + 2] = 0; // dx
780
+ NodeMatrix[j + 3] = 0; // dy
781
+ NodeMatrix[j + 4] = 0; // old_dx
782
+ NodeMatrix[j + 5] = 0; // old_dy
783
+ NodeMatrix[j + 6] = 1; // mass
784
+ NodeMatrix[j + 7] = 1; // convergence
785
+ NodeMatrix[j + 8] = attr.size || 1;
786
+ NodeMatrix[j + 9] = attr.fixed ? 1 : 0;
787
+ j += PPN;
788
+ });
789
+
790
+ // Iterate through edges
791
+ j = 0;
792
+ graph.forEachEdge(function (edge, attr, source, target, sa, ta, u) {
793
+ var sj = index[source];
794
+ var tj = index[target];
795
+
796
+ var weight = getEdgeWeight(edge, attr, source, target, sa, ta, u);
797
+
798
+ // Incrementing mass to be a node's weighted degree
799
+ NodeMatrix[sj + 6] += weight;
800
+ NodeMatrix[tj + 6] += weight;
801
+
802
+ // Populating byte array
803
+ EdgeMatrix[j] = sj;
804
+ EdgeMatrix[j + 1] = tj;
805
+ EdgeMatrix[j + 2] = weight;
806
+ j += PPE;
807
+ });
808
+
809
+ return {
810
+ nodes: NodeMatrix,
811
+ edges: EdgeMatrix
812
+ };
813
+ };
814
+
815
+ /**
816
+ * Function applying the layout back to the graph.
817
+ *
818
+ * @param {Graph} graph - Target graph.
819
+ * @param {Float32Array} NodeMatrix - Node matrix.
820
+ * @param {function|null} outputReducer - A node reducer.
821
+ */
822
+ exports.assignLayoutChanges = function (graph, NodeMatrix, outputReducer) {
823
+ var i = 0;
824
+
825
+ graph.updateEachNodeAttributes(function (node, attr) {
826
+ attr.x = NodeMatrix[i];
827
+ attr.y = NodeMatrix[i + 1];
828
+
829
+ i += PPN;
830
+
831
+ return outputReducer ? outputReducer(node, attr) : attr;
832
+ });
833
+ };
834
+
835
+ /**
836
+ * Function reading the positions (only) from the graph, to write them in the matrix.
837
+ *
838
+ * @param {Graph} graph - Target graph.
839
+ * @param {Float32Array} NodeMatrix - Node matrix.
840
+ */
841
+ exports.readGraphPositions = function (graph, NodeMatrix) {
842
+ var i = 0;
843
+
844
+ graph.forEachNode(function (node, attr) {
845
+ NodeMatrix[i] = attr.x;
846
+ NodeMatrix[i + 1] = attr.y;
847
+
848
+ i += PPN;
849
+ });
850
+ };
851
+
852
+ /**
853
+ * Function collecting the layout positions.
854
+ *
855
+ * @param {Graph} graph - Target graph.
856
+ * @param {Float32Array} NodeMatrix - Node matrix.
857
+ * @param {function|null} outputReducer - A nodes reducer.
858
+ * @return {object} - Map to node positions.
859
+ */
860
+ exports.collectLayoutChanges = function (graph, NodeMatrix, outputReducer) {
861
+ var nodes = graph.nodes(),
862
+ positions = {};
863
+
864
+ for (var i = 0, j = 0, l = NodeMatrix.length; i < l; i += PPN) {
865
+ if (outputReducer) {
866
+ var newAttr = Object.assign({}, graph.getNodeAttributes(nodes[j]));
867
+ newAttr.x = NodeMatrix[i];
868
+ newAttr.y = NodeMatrix[i + 1];
869
+ newAttr = outputReducer(nodes[j], newAttr);
870
+ positions[nodes[j]] = {
871
+ x: newAttr.x,
872
+ y: newAttr.y
873
+ };
874
+ } else {
875
+ positions[nodes[j]] = {
876
+ x: NodeMatrix[i],
877
+ y: NodeMatrix[i + 1]
878
+ };
879
+ }
880
+
881
+ j++;
882
+ }
883
+
884
+ return positions;
885
+ };
886
+
887
+ /**
888
+ * Function returning a web worker from the given function.
889
+ *
890
+ * @param {function} fn - Function for the worker.
891
+ * @return {DOMString}
892
+ */
893
+ exports.createWorker = function createWorker(fn) {
894
+ var xURL = window.URL || window.webkitURL;
895
+ var code = fn.toString();
896
+ var objectUrl = xURL.createObjectURL(
897
+ new Blob(['(' + code + ').call(this);'], {type: 'text/javascript'})
898
+ );
899
+ var worker = new Worker(objectUrl);
900
+ xURL.revokeObjectURL(objectUrl);
901
+
902
+ return worker;
903
+ };
904
+
905
+
906
+ /***/ }),
907
+
908
+ /***/ "./node_modules/graphology-layout-forceatlas2/index.js":
909
+ /*!*************************************************************!*\
910
+ !*** ./node_modules/graphology-layout-forceatlas2/index.js ***!
911
+ \*************************************************************/
912
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
913
+
914
+ /**
915
+ * Graphology ForceAtlas2 Layout
916
+ * ==============================
917
+ *
918
+ * Library endpoint.
919
+ */
920
+ var isGraph = __webpack_require__(/*! graphology-utils/is-graph */ "./node_modules/graphology-utils/is-graph.js");
921
+ var createEdgeWeightGetter =
922
+ (__webpack_require__(/*! graphology-utils/getters */ "./node_modules/graphology-utils/getters.js").createEdgeWeightGetter);
923
+ var iterate = __webpack_require__(/*! ./iterate.js */ "./node_modules/graphology-layout-forceatlas2/iterate.js");
924
+ var helpers = __webpack_require__(/*! ./helpers.js */ "./node_modules/graphology-layout-forceatlas2/helpers.js");
925
+
926
+ var DEFAULT_SETTINGS = __webpack_require__(/*! ./defaults.js */ "./node_modules/graphology-layout-forceatlas2/defaults.js");
927
+
928
+ /**
929
+ * Asbtract function used to run a certain number of iterations.
930
+ *
931
+ * @param {boolean} assign - Whether to assign positions.
932
+ * @param {Graph} graph - Target graph.
933
+ * @param {object|number} params - If number, params.iterations, else:
934
+ * @param {function} getWeight - Edge weight getter function.
935
+ * @param {number} iterations - Number of iterations.
936
+ * @param {function|null} outputReducer - A node reducer
937
+ * @param {object} [settings] - Settings.
938
+ * @return {object|undefined}
939
+ */
940
+ function abstractSynchronousLayout(assign, graph, params) {
941
+ if (!isGraph(graph))
942
+ throw new Error(
943
+ 'graphology-layout-forceatlas2: the given graph is not a valid graphology instance.'
944
+ );
945
+
946
+ if (typeof params === 'number') params = {iterations: params};
947
+
948
+ var iterations = params.iterations;
949
+
950
+ if (typeof iterations !== 'number')
951
+ throw new Error(
952
+ 'graphology-layout-forceatlas2: invalid number of iterations.'
953
+ );
954
+
955
+ if (iterations <= 0)
956
+ throw new Error(
957
+ 'graphology-layout-forceatlas2: you should provide a positive number of iterations.'
958
+ );
959
+
960
+ var getEdgeWeight = createEdgeWeightGetter(
961
+ 'getEdgeWeight' in params ? params.getEdgeWeight : 'weight'
962
+ ).fromEntry;
963
+
964
+ var outputReducer =
965
+ typeof params.outputReducer === 'function' ? params.outputReducer : null;
966
+
967
+ // Validating settings
968
+ var settings = helpers.assign({}, DEFAULT_SETTINGS, params.settings);
969
+ var validationError = helpers.validateSettings(settings);
970
+
971
+ if (validationError)
972
+ throw new Error(
973
+ 'graphology-layout-forceatlas2: ' + validationError.message
974
+ );
975
+
976
+ // Building matrices
977
+ var matrices = helpers.graphToByteArrays(graph, getEdgeWeight);
978
+
979
+ var i;
980
+
981
+ // Iterating
982
+ for (i = 0; i < iterations; i++)
983
+ iterate(settings, matrices.nodes, matrices.edges);
984
+
985
+ // Applying
986
+ if (assign) {
987
+ helpers.assignLayoutChanges(graph, matrices.nodes, outputReducer);
988
+ return;
989
+ }
990
+
991
+ return helpers.collectLayoutChanges(graph, matrices.nodes);
992
+ }
993
+
994
+ /**
995
+ * Function returning sane layout settings for the given graph.
996
+ *
997
+ * @param {Graph|number} graph - Target graph or graph order.
998
+ * @return {object}
999
+ */
1000
+ function inferSettings(graph) {
1001
+ var order = typeof graph === 'number' ? graph : graph.order;
1002
+
1003
+ return {
1004
+ barnesHutOptimize: order > 2000,
1005
+ strongGravityMode: true,
1006
+ gravity: 0.05,
1007
+ scalingRatio: 10,
1008
+ slowDown: 1 + Math.log(order)
1009
+ };
1010
+ }
1011
+
1012
+ /**
1013
+ * Exporting.
1014
+ */
1015
+ var synchronousLayout = abstractSynchronousLayout.bind(null, false);
1016
+ synchronousLayout.assign = abstractSynchronousLayout.bind(null, true);
1017
+ synchronousLayout.inferSettings = inferSettings;
1018
+
1019
+ module.exports = synchronousLayout;
1020
+
1021
+
1022
+ /***/ }),
1023
+
1024
+ /***/ "./node_modules/graphology-layout-forceatlas2/iterate.js":
1025
+ /*!***************************************************************!*\
1026
+ !*** ./node_modules/graphology-layout-forceatlas2/iterate.js ***!
1027
+ \***************************************************************/
1028
+ /***/ ((module) => {
1029
+
1030
+ /* eslint no-constant-condition: 0 */
1031
+ /**
1032
+ * Graphology ForceAtlas2 Iteration
1033
+ * =================================
1034
+ *
1035
+ * Function used to perform a single iteration of the algorithm.
1036
+ */
1037
+
1038
+ /**
1039
+ * Matrices properties accessors.
1040
+ */
1041
+ var NODE_X = 0;
1042
+ var NODE_Y = 1;
1043
+ var NODE_DX = 2;
1044
+ var NODE_DY = 3;
1045
+ var NODE_OLD_DX = 4;
1046
+ var NODE_OLD_DY = 5;
1047
+ var NODE_MASS = 6;
1048
+ var NODE_CONVERGENCE = 7;
1049
+ var NODE_SIZE = 8;
1050
+ var NODE_FIXED = 9;
1051
+
1052
+ var EDGE_SOURCE = 0;
1053
+ var EDGE_TARGET = 1;
1054
+ var EDGE_WEIGHT = 2;
1055
+
1056
+ var REGION_NODE = 0;
1057
+ var REGION_CENTER_X = 1;
1058
+ var REGION_CENTER_Y = 2;
1059
+ var REGION_SIZE = 3;
1060
+ var REGION_NEXT_SIBLING = 4;
1061
+ var REGION_FIRST_CHILD = 5;
1062
+ var REGION_MASS = 6;
1063
+ var REGION_MASS_CENTER_X = 7;
1064
+ var REGION_MASS_CENTER_Y = 8;
1065
+
1066
+ var SUBDIVISION_ATTEMPTS = 3;
1067
+
1068
+ /**
1069
+ * Constants.
1070
+ */
1071
+ var PPN = 10;
1072
+ var PPE = 3;
1073
+ var PPR = 9;
1074
+
1075
+ var MAX_FORCE = 10;
1076
+
1077
+ /**
1078
+ * Function used to perform a single interation of the algorithm.
1079
+ *
1080
+ * @param {object} options - Layout options.
1081
+ * @param {Float32Array} NodeMatrix - Node data.
1082
+ * @param {Float32Array} EdgeMatrix - Edge data.
1083
+ * @return {object} - Some metadata.
1084
+ */
1085
+ module.exports = function iterate(options, NodeMatrix, EdgeMatrix) {
1086
+ // Initializing variables
1087
+ var l, r, n, n1, n2, rn, e, w, g, s;
1088
+
1089
+ var order = NodeMatrix.length,
1090
+ size = EdgeMatrix.length;
1091
+
1092
+ var adjustSizes = options.adjustSizes;
1093
+
1094
+ var thetaSquared = options.barnesHutTheta * options.barnesHutTheta;
1095
+
1096
+ var outboundAttCompensation, coefficient, xDist, yDist, ewc, distance, factor;
1097
+
1098
+ var RegionMatrix = [];
1099
+
1100
+ // 1) Initializing layout data
1101
+ //-----------------------------
1102
+
1103
+ // Resetting positions & computing max values
1104
+ for (n = 0; n < order; n += PPN) {
1105
+ NodeMatrix[n + NODE_OLD_DX] = NodeMatrix[n + NODE_DX];
1106
+ NodeMatrix[n + NODE_OLD_DY] = NodeMatrix[n + NODE_DY];
1107
+ NodeMatrix[n + NODE_DX] = 0;
1108
+ NodeMatrix[n + NODE_DY] = 0;
1109
+ }
1110
+
1111
+ // If outbound attraction distribution, compensate
1112
+ if (options.outboundAttractionDistribution) {
1113
+ outboundAttCompensation = 0;
1114
+ for (n = 0; n < order; n += PPN) {
1115
+ outboundAttCompensation += NodeMatrix[n + NODE_MASS];
1116
+ }
1117
+
1118
+ outboundAttCompensation /= order / PPN;
1119
+ }
1120
+
1121
+ // 1.bis) Barnes-Hut computation
1122
+ //------------------------------
1123
+
1124
+ if (options.barnesHutOptimize) {
1125
+ // Setting up
1126
+ var minX = Infinity,
1127
+ maxX = -Infinity,
1128
+ minY = Infinity,
1129
+ maxY = -Infinity,
1130
+ q,
1131
+ q2,
1132
+ subdivisionAttempts;
1133
+
1134
+ // Computing min and max values
1135
+ for (n = 0; n < order; n += PPN) {
1136
+ minX = Math.min(minX, NodeMatrix[n + NODE_X]);
1137
+ maxX = Math.max(maxX, NodeMatrix[n + NODE_X]);
1138
+ minY = Math.min(minY, NodeMatrix[n + NODE_Y]);
1139
+ maxY = Math.max(maxY, NodeMatrix[n + NODE_Y]);
1140
+ }
1141
+
1142
+ // squarify bounds, it's a quadtree
1143
+ var dx = maxX - minX,
1144
+ dy = maxY - minY;
1145
+ if (dx > dy) {
1146
+ minY -= (dx - dy) / 2;
1147
+ maxY = minY + dx;
1148
+ } else {
1149
+ minX -= (dy - dx) / 2;
1150
+ maxX = minX + dy;
1151
+ }
1152
+
1153
+ // Build the Barnes Hut root region
1154
+ RegionMatrix[0 + REGION_NODE] = -1;
1155
+ RegionMatrix[0 + REGION_CENTER_X] = (minX + maxX) / 2;
1156
+ RegionMatrix[0 + REGION_CENTER_Y] = (minY + maxY) / 2;
1157
+ RegionMatrix[0 + REGION_SIZE] = Math.max(maxX - minX, maxY - minY);
1158
+ RegionMatrix[0 + REGION_NEXT_SIBLING] = -1;
1159
+ RegionMatrix[0 + REGION_FIRST_CHILD] = -1;
1160
+ RegionMatrix[0 + REGION_MASS] = 0;
1161
+ RegionMatrix[0 + REGION_MASS_CENTER_X] = 0;
1162
+ RegionMatrix[0 + REGION_MASS_CENTER_Y] = 0;
1163
+
1164
+ // Add each node in the tree
1165
+ l = 1;
1166
+ for (n = 0; n < order; n += PPN) {
1167
+ // Current region, starting with root
1168
+ r = 0;
1169
+ subdivisionAttempts = SUBDIVISION_ATTEMPTS;
1170
+
1171
+ while (true) {
1172
+ // Are there sub-regions?
1173
+
1174
+ // We look at first child index
1175
+ if (RegionMatrix[r + REGION_FIRST_CHILD] >= 0) {
1176
+ // There are sub-regions
1177
+
1178
+ // We just iterate to find a "leaf" of the tree
1179
+ // that is an empty region or a region with a single node
1180
+ // (see next case)
1181
+
1182
+ // Find the quadrant of n
1183
+ if (NodeMatrix[n + NODE_X] < RegionMatrix[r + REGION_CENTER_X]) {
1184
+ if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {
1185
+ // Top Left quarter
1186
+ q = RegionMatrix[r + REGION_FIRST_CHILD];
1187
+ } else {
1188
+ // Bottom Left quarter
1189
+ q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR;
1190
+ }
1191
+ } else {
1192
+ if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {
1193
+ // Top Right quarter
1194
+ q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 2;
1195
+ } else {
1196
+ // Bottom Right quarter
1197
+ q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 3;
1198
+ }
1199
+ }
1200
+
1201
+ // Update center of mass and mass (we only do it for non-leave regions)
1202
+ RegionMatrix[r + REGION_MASS_CENTER_X] =
1203
+ (RegionMatrix[r + REGION_MASS_CENTER_X] *
1204
+ RegionMatrix[r + REGION_MASS] +
1205
+ NodeMatrix[n + NODE_X] * NodeMatrix[n + NODE_MASS]) /
1206
+ (RegionMatrix[r + REGION_MASS] + NodeMatrix[n + NODE_MASS]);
1207
+
1208
+ RegionMatrix[r + REGION_MASS_CENTER_Y] =
1209
+ (RegionMatrix[r + REGION_MASS_CENTER_Y] *
1210
+ RegionMatrix[r + REGION_MASS] +
1211
+ NodeMatrix[n + NODE_Y] * NodeMatrix[n + NODE_MASS]) /
1212
+ (RegionMatrix[r + REGION_MASS] + NodeMatrix[n + NODE_MASS]);
1213
+
1214
+ RegionMatrix[r + REGION_MASS] += NodeMatrix[n + NODE_MASS];
1215
+
1216
+ // Iterate on the right quadrant
1217
+ r = q;
1218
+ continue;
1219
+ } else {
1220
+ // There are no sub-regions: we are in a "leaf"
1221
+
1222
+ // Is there a node in this leave?
1223
+ if (RegionMatrix[r + REGION_NODE] < 0) {
1224
+ // There is no node in region:
1225
+ // we record node n and go on
1226
+ RegionMatrix[r + REGION_NODE] = n;
1227
+ break;
1228
+ } else {
1229
+ // There is a node in this region
1230
+
1231
+ // We will need to create sub-regions, stick the two
1232
+ // nodes (the old one r[0] and the new one n) in two
1233
+ // subregions. If they fall in the same quadrant,
1234
+ // we will iterate.
1235
+
1236
+ // Create sub-regions
1237
+ RegionMatrix[r + REGION_FIRST_CHILD] = l * PPR;
1238
+ w = RegionMatrix[r + REGION_SIZE] / 2; // new size (half)
1239
+
1240
+ // NOTE: we use screen coordinates
1241
+ // from Top Left to Bottom Right
1242
+
1243
+ // Top Left sub-region
1244
+ g = RegionMatrix[r + REGION_FIRST_CHILD];
1245
+
1246
+ RegionMatrix[g + REGION_NODE] = -1;
1247
+ RegionMatrix[g + REGION_CENTER_X] =
1248
+ RegionMatrix[r + REGION_CENTER_X] - w;
1249
+ RegionMatrix[g + REGION_CENTER_Y] =
1250
+ RegionMatrix[r + REGION_CENTER_Y] - w;
1251
+ RegionMatrix[g + REGION_SIZE] = w;
1252
+ RegionMatrix[g + REGION_NEXT_SIBLING] = g + PPR;
1253
+ RegionMatrix[g + REGION_FIRST_CHILD] = -1;
1254
+ RegionMatrix[g + REGION_MASS] = 0;
1255
+ RegionMatrix[g + REGION_MASS_CENTER_X] = 0;
1256
+ RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;
1257
+
1258
+ // Bottom Left sub-region
1259
+ g += PPR;
1260
+ RegionMatrix[g + REGION_NODE] = -1;
1261
+ RegionMatrix[g + REGION_CENTER_X] =
1262
+ RegionMatrix[r + REGION_CENTER_X] - w;
1263
+ RegionMatrix[g + REGION_CENTER_Y] =
1264
+ RegionMatrix[r + REGION_CENTER_Y] + w;
1265
+ RegionMatrix[g + REGION_SIZE] = w;
1266
+ RegionMatrix[g + REGION_NEXT_SIBLING] = g + PPR;
1267
+ RegionMatrix[g + REGION_FIRST_CHILD] = -1;
1268
+ RegionMatrix[g + REGION_MASS] = 0;
1269
+ RegionMatrix[g + REGION_MASS_CENTER_X] = 0;
1270
+ RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;
1271
+
1272
+ // Top Right sub-region
1273
+ g += PPR;
1274
+ RegionMatrix[g + REGION_NODE] = -1;
1275
+ RegionMatrix[g + REGION_CENTER_X] =
1276
+ RegionMatrix[r + REGION_CENTER_X] + w;
1277
+ RegionMatrix[g + REGION_CENTER_Y] =
1278
+ RegionMatrix[r + REGION_CENTER_Y] - w;
1279
+ RegionMatrix[g + REGION_SIZE] = w;
1280
+ RegionMatrix[g + REGION_NEXT_SIBLING] = g + PPR;
1281
+ RegionMatrix[g + REGION_FIRST_CHILD] = -1;
1282
+ RegionMatrix[g + REGION_MASS] = 0;
1283
+ RegionMatrix[g + REGION_MASS_CENTER_X] = 0;
1284
+ RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;
1285
+
1286
+ // Bottom Right sub-region
1287
+ g += PPR;
1288
+ RegionMatrix[g + REGION_NODE] = -1;
1289
+ RegionMatrix[g + REGION_CENTER_X] =
1290
+ RegionMatrix[r + REGION_CENTER_X] + w;
1291
+ RegionMatrix[g + REGION_CENTER_Y] =
1292
+ RegionMatrix[r + REGION_CENTER_Y] + w;
1293
+ RegionMatrix[g + REGION_SIZE] = w;
1294
+ RegionMatrix[g + REGION_NEXT_SIBLING] =
1295
+ RegionMatrix[r + REGION_NEXT_SIBLING];
1296
+ RegionMatrix[g + REGION_FIRST_CHILD] = -1;
1297
+ RegionMatrix[g + REGION_MASS] = 0;
1298
+ RegionMatrix[g + REGION_MASS_CENTER_X] = 0;
1299
+ RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;
1300
+
1301
+ l += 4;
1302
+
1303
+ // Now the goal is to find two different sub-regions
1304
+ // for the two nodes: the one previously recorded (r[0])
1305
+ // and the one we want to add (n)
1306
+
1307
+ // Find the quadrant of the old node
1308
+ if (
1309
+ NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_X] <
1310
+ RegionMatrix[r + REGION_CENTER_X]
1311
+ ) {
1312
+ if (
1313
+ NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_Y] <
1314
+ RegionMatrix[r + REGION_CENTER_Y]
1315
+ ) {
1316
+ // Top Left quarter
1317
+ q = RegionMatrix[r + REGION_FIRST_CHILD];
1318
+ } else {
1319
+ // Bottom Left quarter
1320
+ q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR;
1321
+ }
1322
+ } else {
1323
+ if (
1324
+ NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_Y] <
1325
+ RegionMatrix[r + REGION_CENTER_Y]
1326
+ ) {
1327
+ // Top Right quarter
1328
+ q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 2;
1329
+ } else {
1330
+ // Bottom Right quarter
1331
+ q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 3;
1332
+ }
1333
+ }
1334
+
1335
+ // We remove r[0] from the region r, add its mass to r and record it in q
1336
+ RegionMatrix[r + REGION_MASS] =
1337
+ NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_MASS];
1338
+ RegionMatrix[r + REGION_MASS_CENTER_X] =
1339
+ NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_X];
1340
+ RegionMatrix[r + REGION_MASS_CENTER_Y] =
1341
+ NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_Y];
1342
+
1343
+ RegionMatrix[q + REGION_NODE] = RegionMatrix[r + REGION_NODE];
1344
+ RegionMatrix[r + REGION_NODE] = -1;
1345
+
1346
+ // Find the quadrant of n
1347
+ if (NodeMatrix[n + NODE_X] < RegionMatrix[r + REGION_CENTER_X]) {
1348
+ if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {
1349
+ // Top Left quarter
1350
+ q2 = RegionMatrix[r + REGION_FIRST_CHILD];
1351
+ } else {
1352
+ // Bottom Left quarter
1353
+ q2 = RegionMatrix[r + REGION_FIRST_CHILD] + PPR;
1354
+ }
1355
+ } else {
1356
+ if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {
1357
+ // Top Right quarter
1358
+ q2 = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 2;
1359
+ } else {
1360
+ // Bottom Right quarter
1361
+ q2 = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 3;
1362
+ }
1363
+ }
1364
+
1365
+ if (q === q2) {
1366
+ // If both nodes are in the same quadrant,
1367
+ // we have to try it again on this quadrant
1368
+ if (subdivisionAttempts--) {
1369
+ r = q;
1370
+ continue; // while
1371
+ } else {
1372
+ // we are out of precision here, and we cannot subdivide anymore
1373
+ // but we have to break the loop anyway
1374
+ subdivisionAttempts = SUBDIVISION_ATTEMPTS;
1375
+ break; // while
1376
+ }
1377
+ }
1378
+
1379
+ // If both quadrants are different, we record n
1380
+ // in its quadrant
1381
+ RegionMatrix[q2 + REGION_NODE] = n;
1382
+ break;
1383
+ }
1384
+ }
1385
+ }
1386
+ }
1387
+ }
1388
+
1389
+ // 2) Repulsion
1390
+ //--------------
1391
+ // NOTES: adjustSizes = antiCollision & scalingRatio = coefficient
1392
+
1393
+ if (options.barnesHutOptimize) {
1394
+ coefficient = options.scalingRatio;
1395
+
1396
+ // Applying repulsion through regions
1397
+ for (n = 0; n < order; n += PPN) {
1398
+ // Computing leaf quad nodes iteration
1399
+
1400
+ r = 0; // Starting with root region
1401
+ while (true) {
1402
+ if (RegionMatrix[r + REGION_FIRST_CHILD] >= 0) {
1403
+ // The region has sub-regions
1404
+
1405
+ // We run the Barnes Hut test to see if we are at the right distance
1406
+ distance =
1407
+ Math.pow(
1408
+ NodeMatrix[n + NODE_X] - RegionMatrix[r + REGION_MASS_CENTER_X],
1409
+ 2
1410
+ ) +
1411
+ Math.pow(
1412
+ NodeMatrix[n + NODE_Y] - RegionMatrix[r + REGION_MASS_CENTER_Y],
1413
+ 2
1414
+ );
1415
+
1416
+ s = RegionMatrix[r + REGION_SIZE];
1417
+
1418
+ if ((4 * s * s) / distance < thetaSquared) {
1419
+ // We treat the region as a single body, and we repulse
1420
+
1421
+ xDist =
1422
+ NodeMatrix[n + NODE_X] - RegionMatrix[r + REGION_MASS_CENTER_X];
1423
+ yDist =
1424
+ NodeMatrix[n + NODE_Y] - RegionMatrix[r + REGION_MASS_CENTER_Y];
1425
+
1426
+ if (adjustSizes === true) {
1427
+ //-- Linear Anti-collision Repulsion
1428
+ if (distance > 0) {
1429
+ factor =
1430
+ (coefficient *
1431
+ NodeMatrix[n + NODE_MASS] *
1432
+ RegionMatrix[r + REGION_MASS]) /
1433
+ distance;
1434
+
1435
+ NodeMatrix[n + NODE_DX] += xDist * factor;
1436
+ NodeMatrix[n + NODE_DY] += yDist * factor;
1437
+ } else if (distance < 0) {
1438
+ factor =
1439
+ (-coefficient *
1440
+ NodeMatrix[n + NODE_MASS] *
1441
+ RegionMatrix[r + REGION_MASS]) /
1442
+ Math.sqrt(distance);
1443
+
1444
+ NodeMatrix[n + NODE_DX] += xDist * factor;
1445
+ NodeMatrix[n + NODE_DY] += yDist * factor;
1446
+ }
1447
+ } else {
1448
+ //-- Linear Repulsion
1449
+ if (distance > 0) {
1450
+ factor =
1451
+ (coefficient *
1452
+ NodeMatrix[n + NODE_MASS] *
1453
+ RegionMatrix[r + REGION_MASS]) /
1454
+ distance;
1455
+
1456
+ NodeMatrix[n + NODE_DX] += xDist * factor;
1457
+ NodeMatrix[n + NODE_DY] += yDist * factor;
1458
+ }
1459
+ }
1460
+
1461
+ // When this is done, we iterate. We have to look at the next sibling.
1462
+ r = RegionMatrix[r + REGION_NEXT_SIBLING];
1463
+ if (r < 0) break; // No next sibling: we have finished the tree
1464
+
1465
+ continue;
1466
+ } else {
1467
+ // The region is too close and we have to look at sub-regions
1468
+ r = RegionMatrix[r + REGION_FIRST_CHILD];
1469
+ continue;
1470
+ }
1471
+ } else {
1472
+ // The region has no sub-region
1473
+ // If there is a node r[0] and it is not n, then repulse
1474
+ rn = RegionMatrix[r + REGION_NODE];
1475
+
1476
+ if (rn >= 0 && rn !== n) {
1477
+ xDist = NodeMatrix[n + NODE_X] - NodeMatrix[rn + NODE_X];
1478
+ yDist = NodeMatrix[n + NODE_Y] - NodeMatrix[rn + NODE_Y];
1479
+
1480
+ distance = xDist * xDist + yDist * yDist;
1481
+
1482
+ if (adjustSizes === true) {
1483
+ //-- Linear Anti-collision Repulsion
1484
+ if (distance > 0) {
1485
+ factor =
1486
+ (coefficient *
1487
+ NodeMatrix[n + NODE_MASS] *
1488
+ NodeMatrix[rn + NODE_MASS]) /
1489
+ distance;
1490
+
1491
+ NodeMatrix[n + NODE_DX] += xDist * factor;
1492
+ NodeMatrix[n + NODE_DY] += yDist * factor;
1493
+ } else if (distance < 0) {
1494
+ factor =
1495
+ (-coefficient *
1496
+ NodeMatrix[n + NODE_MASS] *
1497
+ NodeMatrix[rn + NODE_MASS]) /
1498
+ Math.sqrt(distance);
1499
+
1500
+ NodeMatrix[n + NODE_DX] += xDist * factor;
1501
+ NodeMatrix[n + NODE_DY] += yDist * factor;
1502
+ }
1503
+ } else {
1504
+ //-- Linear Repulsion
1505
+ if (distance > 0) {
1506
+ factor =
1507
+ (coefficient *
1508
+ NodeMatrix[n + NODE_MASS] *
1509
+ NodeMatrix[rn + NODE_MASS]) /
1510
+ distance;
1511
+
1512
+ NodeMatrix[n + NODE_DX] += xDist * factor;
1513
+ NodeMatrix[n + NODE_DY] += yDist * factor;
1514
+ }
1515
+ }
1516
+ }
1517
+
1518
+ // When this is done, we iterate. We have to look at the next sibling.
1519
+ r = RegionMatrix[r + REGION_NEXT_SIBLING];
1520
+
1521
+ if (r < 0) break; // No next sibling: we have finished the tree
1522
+
1523
+ continue;
1524
+ }
1525
+ }
1526
+ }
1527
+ } else {
1528
+ coefficient = options.scalingRatio;
1529
+
1530
+ // Square iteration
1531
+ for (n1 = 0; n1 < order; n1 += PPN) {
1532
+ for (n2 = 0; n2 < n1; n2 += PPN) {
1533
+ // Common to both methods
1534
+ xDist = NodeMatrix[n1 + NODE_X] - NodeMatrix[n2 + NODE_X];
1535
+ yDist = NodeMatrix[n1 + NODE_Y] - NodeMatrix[n2 + NODE_Y];
1536
+
1537
+ if (adjustSizes === true) {
1538
+ //-- Anticollision Linear Repulsion
1539
+ distance =
1540
+ Math.sqrt(xDist * xDist + yDist * yDist) -
1541
+ NodeMatrix[n1 + NODE_SIZE] -
1542
+ NodeMatrix[n2 + NODE_SIZE];
1543
+
1544
+ if (distance > 0) {
1545
+ factor =
1546
+ (coefficient *
1547
+ NodeMatrix[n1 + NODE_MASS] *
1548
+ NodeMatrix[n2 + NODE_MASS]) /
1549
+ distance /
1550
+ distance;
1551
+
1552
+ // Updating nodes' dx and dy
1553
+ NodeMatrix[n1 + NODE_DX] += xDist * factor;
1554
+ NodeMatrix[n1 + NODE_DY] += yDist * factor;
1555
+
1556
+ NodeMatrix[n2 + NODE_DX] -= xDist * factor;
1557
+ NodeMatrix[n2 + NODE_DY] -= yDist * factor;
1558
+ } else if (distance < 0) {
1559
+ factor =
1560
+ 100 *
1561
+ coefficient *
1562
+ NodeMatrix[n1 + NODE_MASS] *
1563
+ NodeMatrix[n2 + NODE_MASS];
1564
+
1565
+ // Updating nodes' dx and dy
1566
+ NodeMatrix[n1 + NODE_DX] += xDist * factor;
1567
+ NodeMatrix[n1 + NODE_DY] += yDist * factor;
1568
+
1569
+ NodeMatrix[n2 + NODE_DX] -= xDist * factor;
1570
+ NodeMatrix[n2 + NODE_DY] -= yDist * factor;
1571
+ }
1572
+ } else {
1573
+ //-- Linear Repulsion
1574
+ distance = Math.sqrt(xDist * xDist + yDist * yDist);
1575
+
1576
+ if (distance > 0) {
1577
+ factor =
1578
+ (coefficient *
1579
+ NodeMatrix[n1 + NODE_MASS] *
1580
+ NodeMatrix[n2 + NODE_MASS]) /
1581
+ distance /
1582
+ distance;
1583
+
1584
+ // Updating nodes' dx and dy
1585
+ NodeMatrix[n1 + NODE_DX] += xDist * factor;
1586
+ NodeMatrix[n1 + NODE_DY] += yDist * factor;
1587
+
1588
+ NodeMatrix[n2 + NODE_DX] -= xDist * factor;
1589
+ NodeMatrix[n2 + NODE_DY] -= yDist * factor;
1590
+ }
1591
+ }
1592
+ }
1593
+ }
1594
+ }
1595
+
1596
+ // 3) Gravity
1597
+ //------------
1598
+ g = options.gravity / options.scalingRatio;
1599
+ coefficient = options.scalingRatio;
1600
+ for (n = 0; n < order; n += PPN) {
1601
+ factor = 0;
1602
+
1603
+ // Common to both methods
1604
+ xDist = NodeMatrix[n + NODE_X];
1605
+ yDist = NodeMatrix[n + NODE_Y];
1606
+ distance = Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2));
1607
+
1608
+ if (options.strongGravityMode) {
1609
+ //-- Strong gravity
1610
+ if (distance > 0) factor = coefficient * NodeMatrix[n + NODE_MASS] * g;
1611
+ } else {
1612
+ //-- Linear Anti-collision Repulsion n
1613
+ if (distance > 0)
1614
+ factor = (coefficient * NodeMatrix[n + NODE_MASS] * g) / distance;
1615
+ }
1616
+
1617
+ // Updating node's dx and dy
1618
+ NodeMatrix[n + NODE_DX] -= xDist * factor;
1619
+ NodeMatrix[n + NODE_DY] -= yDist * factor;
1620
+ }
1621
+
1622
+ // 4) Attraction
1623
+ //---------------
1624
+ coefficient =
1625
+ 1 * (options.outboundAttractionDistribution ? outboundAttCompensation : 1);
1626
+
1627
+ // TODO: simplify distance
1628
+ // TODO: coefficient is always used as -c --> optimize?
1629
+ for (e = 0; e < size; e += PPE) {
1630
+ n1 = EdgeMatrix[e + EDGE_SOURCE];
1631
+ n2 = EdgeMatrix[e + EDGE_TARGET];
1632
+ w = EdgeMatrix[e + EDGE_WEIGHT];
1633
+
1634
+ // Edge weight influence
1635
+ ewc = Math.pow(w, options.edgeWeightInfluence);
1636
+
1637
+ // Common measures
1638
+ xDist = NodeMatrix[n1 + NODE_X] - NodeMatrix[n2 + NODE_X];
1639
+ yDist = NodeMatrix[n1 + NODE_Y] - NodeMatrix[n2 + NODE_Y];
1640
+
1641
+ // Applying attraction to nodes
1642
+ if (adjustSizes === true) {
1643
+ distance =
1644
+ Math.sqrt(xDist * xDist + yDist * yDist) -
1645
+ NodeMatrix[n1 + NODE_SIZE] -
1646
+ NodeMatrix[n2 + NODE_SIZE];
1647
+
1648
+ if (options.linLogMode) {
1649
+ if (options.outboundAttractionDistribution) {
1650
+ //-- LinLog Degree Distributed Anti-collision Attraction
1651
+ if (distance > 0) {
1652
+ factor =
1653
+ (-coefficient * ewc * Math.log(1 + distance)) /
1654
+ distance /
1655
+ NodeMatrix[n1 + NODE_MASS];
1656
+ }
1657
+ } else {
1658
+ //-- LinLog Anti-collision Attraction
1659
+ if (distance > 0) {
1660
+ factor = (-coefficient * ewc * Math.log(1 + distance)) / distance;
1661
+ }
1662
+ }
1663
+ } else {
1664
+ if (options.outboundAttractionDistribution) {
1665
+ //-- Linear Degree Distributed Anti-collision Attraction
1666
+ if (distance > 0) {
1667
+ factor = (-coefficient * ewc) / NodeMatrix[n1 + NODE_MASS];
1668
+ }
1669
+ } else {
1670
+ //-- Linear Anti-collision Attraction
1671
+ if (distance > 0) {
1672
+ factor = -coefficient * ewc;
1673
+ }
1674
+ }
1675
+ }
1676
+ } else {
1677
+ distance = Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2));
1678
+
1679
+ if (options.linLogMode) {
1680
+ if (options.outboundAttractionDistribution) {
1681
+ //-- LinLog Degree Distributed Attraction
1682
+ if (distance > 0) {
1683
+ factor =
1684
+ (-coefficient * ewc * Math.log(1 + distance)) /
1685
+ distance /
1686
+ NodeMatrix[n1 + NODE_MASS];
1687
+ }
1688
+ } else {
1689
+ //-- LinLog Attraction
1690
+ if (distance > 0)
1691
+ factor = (-coefficient * ewc * Math.log(1 + distance)) / distance;
1692
+ }
1693
+ } else {
1694
+ if (options.outboundAttractionDistribution) {
1695
+ //-- Linear Attraction Mass Distributed
1696
+ // NOTE: Distance is set to 1 to override next condition
1697
+ distance = 1;
1698
+ factor = (-coefficient * ewc) / NodeMatrix[n1 + NODE_MASS];
1699
+ } else {
1700
+ //-- Linear Attraction
1701
+ // NOTE: Distance is set to 1 to override next condition
1702
+ distance = 1;
1703
+ factor = -coefficient * ewc;
1704
+ }
1705
+ }
1706
+ }
1707
+
1708
+ // Updating nodes' dx and dy
1709
+ // TODO: if condition or factor = 1?
1710
+ if (distance > 0) {
1711
+ // Updating nodes' dx and dy
1712
+ NodeMatrix[n1 + NODE_DX] += xDist * factor;
1713
+ NodeMatrix[n1 + NODE_DY] += yDist * factor;
1714
+
1715
+ NodeMatrix[n2 + NODE_DX] -= xDist * factor;
1716
+ NodeMatrix[n2 + NODE_DY] -= yDist * factor;
1717
+ }
1718
+ }
1719
+
1720
+ // 5) Apply Forces
1721
+ //-----------------
1722
+ var force, swinging, traction, nodespeed, newX, newY;
1723
+
1724
+ // MATH: sqrt and square distances
1725
+ if (adjustSizes === true) {
1726
+ for (n = 0; n < order; n += PPN) {
1727
+ if (NodeMatrix[n + NODE_FIXED] !== 1) {
1728
+ force = Math.sqrt(
1729
+ Math.pow(NodeMatrix[n + NODE_DX], 2) +
1730
+ Math.pow(NodeMatrix[n + NODE_DY], 2)
1731
+ );
1732
+
1733
+ if (force > MAX_FORCE) {
1734
+ NodeMatrix[n + NODE_DX] =
1735
+ (NodeMatrix[n + NODE_DX] * MAX_FORCE) / force;
1736
+ NodeMatrix[n + NODE_DY] =
1737
+ (NodeMatrix[n + NODE_DY] * MAX_FORCE) / force;
1738
+ }
1739
+
1740
+ swinging =
1741
+ NodeMatrix[n + NODE_MASS] *
1742
+ Math.sqrt(
1743
+ (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) *
1744
+ (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) +
1745
+ (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY]) *
1746
+ (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY])
1747
+ );
1748
+
1749
+ traction =
1750
+ Math.sqrt(
1751
+ (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) *
1752
+ (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) +
1753
+ (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY]) *
1754
+ (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY])
1755
+ ) / 2;
1756
+
1757
+ nodespeed = (0.1 * Math.log(1 + traction)) / (1 + Math.sqrt(swinging));
1758
+
1759
+ // Updating node's positon
1760
+ newX =
1761
+ NodeMatrix[n + NODE_X] +
1762
+ NodeMatrix[n + NODE_DX] * (nodespeed / options.slowDown);
1763
+ NodeMatrix[n + NODE_X] = newX;
1764
+
1765
+ newY =
1766
+ NodeMatrix[n + NODE_Y] +
1767
+ NodeMatrix[n + NODE_DY] * (nodespeed / options.slowDown);
1768
+ NodeMatrix[n + NODE_Y] = newY;
1769
+ }
1770
+ }
1771
+ } else {
1772
+ for (n = 0; n < order; n += PPN) {
1773
+ if (NodeMatrix[n + NODE_FIXED] !== 1) {
1774
+ swinging =
1775
+ NodeMatrix[n + NODE_MASS] *
1776
+ Math.sqrt(
1777
+ (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) *
1778
+ (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) +
1779
+ (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY]) *
1780
+ (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY])
1781
+ );
1782
+
1783
+ traction =
1784
+ Math.sqrt(
1785
+ (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) *
1786
+ (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) +
1787
+ (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY]) *
1788
+ (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY])
1789
+ ) / 2;
1790
+
1791
+ nodespeed =
1792
+ (NodeMatrix[n + NODE_CONVERGENCE] * Math.log(1 + traction)) /
1793
+ (1 + Math.sqrt(swinging));
1794
+
1795
+ // Updating node convergence
1796
+ NodeMatrix[n + NODE_CONVERGENCE] = Math.min(
1797
+ 1,
1798
+ Math.sqrt(
1799
+ (nodespeed *
1800
+ (Math.pow(NodeMatrix[n + NODE_DX], 2) +
1801
+ Math.pow(NodeMatrix[n + NODE_DY], 2))) /
1802
+ (1 + Math.sqrt(swinging))
1803
+ )
1804
+ );
1805
+
1806
+ // Updating node's positon
1807
+ newX =
1808
+ NodeMatrix[n + NODE_X] +
1809
+ NodeMatrix[n + NODE_DX] * (nodespeed / options.slowDown);
1810
+ NodeMatrix[n + NODE_X] = newX;
1811
+
1812
+ newY =
1813
+ NodeMatrix[n + NODE_Y] +
1814
+ NodeMatrix[n + NODE_DY] * (nodespeed / options.slowDown);
1815
+ NodeMatrix[n + NODE_Y] = newY;
1816
+ }
1817
+ }
1818
+ }
1819
+
1820
+ // We return the information about the layout (no need to return the matrices)
1821
+ return {};
1822
+ };
1823
+
1824
+
1825
+ /***/ }),
1826
+
1827
+ /***/ "./node_modules/graphology-utils/getters.js":
1828
+ /*!**************************************************!*\
1829
+ !*** ./node_modules/graphology-utils/getters.js ***!
1830
+ \**************************************************/
1831
+ /***/ ((__unused_webpack_module, exports) => {
1832
+
1833
+ /**
1834
+ * Graphology Weight Getter
1835
+ * =========================
1836
+ *
1837
+ * Function creating weight getters.
1838
+ */
1839
+ function coerceWeight(value) {
1840
+ // Ensuring target value is a correct number
1841
+ if (typeof value !== 'number' || isNaN(value)) return 1;
1842
+
1843
+ return value;
1844
+ }
1845
+
1846
+ function createNodeValueGetter(nameOrFunction, defaultValue) {
1847
+ var getter = {};
1848
+
1849
+ var coerceToDefault = function (v) {
1850
+ if (typeof v === 'undefined') return defaultValue;
1851
+
1852
+ return v;
1853
+ };
1854
+
1855
+ if (typeof defaultValue === 'function') coerceToDefault = defaultValue;
1856
+
1857
+ var get = function (attributes) {
1858
+ return coerceToDefault(attributes[nameOrFunction]);
1859
+ };
1860
+
1861
+ var returnDefault = function () {
1862
+ return coerceToDefault(undefined);
1863
+ };
1864
+
1865
+ if (typeof nameOrFunction === 'string') {
1866
+ getter.fromAttributes = get;
1867
+ getter.fromGraph = function (graph, node) {
1868
+ return get(graph.getNodeAttributes(node));
1869
+ };
1870
+ getter.fromEntry = function (node, attributes) {
1871
+ return get(attributes);
1872
+ };
1873
+ } else if (typeof nameOrFunction === 'function') {
1874
+ getter.fromAttributes = function () {
1875
+ throw new Error(
1876
+ 'graphology-utils/getters/createNodeValueGetter: irrelevant usage.'
1877
+ );
1878
+ };
1879
+ getter.fromGraph = function (graph, node) {
1880
+ return coerceToDefault(
1881
+ nameOrFunction(node, graph.getNodeAttributes(node))
1882
+ );
1883
+ };
1884
+ getter.fromEntry = function (node, attributes) {
1885
+ return coerceToDefault(nameOrFunction(node, attributes));
1886
+ };
1887
+ } else {
1888
+ getter.fromAttributes = returnDefault;
1889
+ getter.fromGraph = returnDefault;
1890
+ getter.fromEntry = returnDefault;
1891
+ }
1892
+
1893
+ return getter;
1894
+ }
1895
+
1896
+ function createEdgeValueGetter(nameOrFunction, defaultValue) {
1897
+ var getter = {};
1898
+
1899
+ var coerceToDefault = function (v) {
1900
+ if (typeof v === 'undefined') return defaultValue;
1901
+
1902
+ return v;
1903
+ };
1904
+
1905
+ if (typeof defaultValue === 'function') coerceToDefault = defaultValue;
1906
+
1907
+ var get = function (attributes) {
1908
+ return coerceToDefault(attributes[nameOrFunction]);
1909
+ };
1910
+
1911
+ var returnDefault = function () {
1912
+ return coerceToDefault(undefined);
1913
+ };
1914
+
1915
+ if (typeof nameOrFunction === 'string') {
1916
+ getter.fromAttributes = get;
1917
+ getter.fromGraph = function (graph, edge) {
1918
+ return get(graph.getEdgeAttributes(edge));
1919
+ };
1920
+ getter.fromEntry = function (edge, attributes) {
1921
+ return get(attributes);
1922
+ };
1923
+ getter.fromPartialEntry = getter.fromEntry;
1924
+ getter.fromMinimalEntry = getter.fromEntry;
1925
+ } else if (typeof nameOrFunction === 'function') {
1926
+ getter.fromAttributes = function () {
1927
+ throw new Error(
1928
+ 'graphology-utils/getters/createEdgeValueGetter: irrelevant usage.'
1929
+ );
1930
+ };
1931
+ getter.fromGraph = function (graph, edge) {
1932
+ // TODO: we can do better, check #310
1933
+ var extremities = graph.extremities(edge);
1934
+ return coerceToDefault(
1935
+ nameOrFunction(
1936
+ edge,
1937
+ graph.getEdgeAttributes(edge),
1938
+ extremities[0],
1939
+ extremities[1],
1940
+ graph.getNodeAttributes(extremities[0]),
1941
+ graph.getNodeAttributes(extremities[1]),
1942
+ graph.isUndirected(edge)
1943
+ )
1944
+ );
1945
+ };
1946
+ getter.fromEntry = function (e, a, s, t, sa, ta, u) {
1947
+ return coerceToDefault(nameOrFunction(e, a, s, t, sa, ta, u));
1948
+ };
1949
+ getter.fromPartialEntry = function (e, a, s, t) {
1950
+ return coerceToDefault(nameOrFunction(e, a, s, t));
1951
+ };
1952
+ getter.fromMinimalEntry = function (e, a) {
1953
+ return coerceToDefault(nameOrFunction(e, a));
1954
+ };
1955
+ } else {
1956
+ getter.fromAttributes = returnDefault;
1957
+ getter.fromGraph = returnDefault;
1958
+ getter.fromEntry = returnDefault;
1959
+ getter.fromMinimalEntry = returnDefault;
1960
+ }
1961
+
1962
+ return getter;
1963
+ }
1964
+
1965
+ exports.createNodeValueGetter = createNodeValueGetter;
1966
+ exports.createEdgeValueGetter = createEdgeValueGetter;
1967
+ exports.createEdgeWeightGetter = function (name) {
1968
+ return createEdgeValueGetter(name, coerceWeight);
1969
+ };
1970
+
1971
+
1972
+ /***/ }),
1973
+
1974
+ /***/ "./node_modules/graphology-utils/is-graph.js":
1975
+ /*!***************************************************!*\
1976
+ !*** ./node_modules/graphology-utils/is-graph.js ***!
1977
+ \***************************************************/
1978
+ /***/ ((module) => {
1979
+
1980
+ /**
1981
+ * Graphology isGraph
1982
+ * ===================
1983
+ *
1984
+ * Very simple function aiming at ensuring the given variable is a
1985
+ * graphology instance.
1986
+ */
1987
+
1988
+ /**
1989
+ * Checking the value is a graphology instance.
1990
+ *
1991
+ * @param {any} value - Target value.
1992
+ * @return {boolean}
1993
+ */
1994
+ module.exports = function isGraph(value) {
1995
+ return (
1996
+ value !== null &&
1997
+ typeof value === 'object' &&
1998
+ typeof value.addUndirectedEdgeWithKey === 'function' &&
1999
+ typeof value.dropNode === 'function' &&
2000
+ typeof value.multi === 'boolean'
2001
+ );
2002
+ };
2003
+
2004
+
2005
+ /***/ }),
2006
+
2007
+ /***/ "./node_modules/graphology/dist/graphology.umd.min.js":
2008
+ /*!************************************************************!*\
2009
+ !*** ./node_modules/graphology/dist/graphology.umd.min.js ***!
2010
+ \************************************************************/
2011
+ /***/ (function(module) {
2012
+
2013
+ !function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function o(t,e,n){return o=i()?Reflect.construct.bind():function(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&r(o,n.prototype),o},o.apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return a=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return o(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,t)},a(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var u=function(){for(var t=arguments[0],e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var r in arguments[e])t[r]=arguments[e][r];return t};function d(t,e,n,r){var i=t._nodes.get(e),o=null;return i?o="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n]:o}function s(e){return"object"===t(e)&&null!==e}function h(t){var e;for(e in t)return!1;return!0}function p(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function f(t,e,n){var r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function l(t){return!!s(t)&&!(t.attributes&&!Array.isArray(t.attributes))}"function"==typeof Object.assign&&(u=Object.assign);var g,y={exports:{}},w="object"==typeof Reflect?Reflect:null,v=w&&"function"==typeof w.apply?w.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};g=w&&"function"==typeof w.ownKeys?w.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var b=Number.isNaN||function(t){return t!=t};function m(){m.init.call(this)}y.exports=m,y.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}U(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&U(t,"error",e,n)}(t,i,{once:!0})}))},m.EventEmitter=m,m.prototype._events=void 0,m.prototype._eventsCount=0,m.prototype._maxListeners=void 0;var k=10;function _(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function G(t){return void 0===t._maxListeners?m.defaultMaxListeners:t._maxListeners}function x(t,e,n,r){var i,o,a,c;if(_(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=G(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,c=u,console&&console.warn&&console.warn(c)}return t}function E(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function A(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=E.bind(r);return i.listener=n,r.wrapFn=i,i}function L(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):D(i,i.length)}function S(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function D(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function U(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}function N(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}Object.defineProperty(m,"defaultMaxListeners",{enumerable:!0,get:function(){return k},set:function(t){if("number"!=typeof t||t<0||b(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");k=t}}),m.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},m.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||b(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},m.prototype.getMaxListeners=function(){return G(this)},m.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)v(c,this,e);else{var u=c.length,d=D(c,u);for(n=0;n<u;++n)v(d[n],this,e)}return!0},m.prototype.addListener=function(t,e){return x(this,t,e,!1)},m.prototype.on=m.prototype.addListener,m.prototype.prependListener=function(t,e){return x(this,t,e,!0)},m.prototype.once=function(t,e){return _(e),this.on(t,A(this,t,e)),this},m.prototype.prependOnceListener=function(t,e){return _(e),this.prependListener(t,A(this,t,e)),this},m.prototype.removeListener=function(t,e){var n,r,i,o,a;if(_(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},m.prototype.off=m.prototype.removeListener,m.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},m.prototype.listeners=function(t){return L(this,t,!0)},m.prototype.rawListeners=function(t){return L(this,t,!1)},m.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):S.call(t,e)},m.prototype.listenerCount=S,m.prototype.eventNames=function(){return this._eventsCount>0?g(this._events):[]},"undefined"!=typeof Symbol&&(N.prototype[Symbol.iterator]=function(){return this}),N.of=function(){var t=arguments,e=t.length,n=0;return new N((function(){return n>=e?{done:!0}:{done:!1,value:t[n++]}}))},N.empty=function(){return new N((function(){return{done:!0}}))},N.fromSequence=function(t){var e=0,n=t.length;return new N((function(){return e>=n?{done:!0}:{done:!1,value:t[e++]}}))},N.is=function(t){return t instanceof N||"object"==typeof t&&null!==t&&"function"==typeof t.next};var O=N,j={};j.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,j.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var C=O,M=j,z=M.ARRAY_BUFFER_SUPPORT,W=M.SYMBOL_SUPPORT;var P=function(t){var e=function(t){return"string"==typeof t||Array.isArray(t)||z&&ArrayBuffer.isView(t)?C.fromSequence(t):"object"!=typeof t||null===t?null:W&&"function"==typeof t[Symbol.iterator]?t[Symbol.iterator]():"function"==typeof t.next?t:null}(t);if(!e)throw new Error("obliterator: target is not iterable nor a valid iterator.");return e},R=P,K=function(t,e){for(var n,r=arguments.length>1?e:1/0,i=r!==1/0?new Array(r):[],o=0,a=R(t);;){if(o===r)return i;if((n=a.next()).done)return o!==e&&(i.length=o),i;i[o++]=n.value}},T=function(t){function n(e){var n;return(n=t.call(this)||this).name="GraphError",n.message=e,n}return e(n,t),n}(a(Error)),B=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(c(r),n.prototype.constructor),r}return e(n,t),n}(T),F=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(c(r),n.prototype.constructor),r}return e(n,t),n}(T),I=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(c(r),n.prototype.constructor),r}return e(n,t),n}(T);function Y(t,e){this.key=t,this.attributes=e,this.clear()}function q(t,e){this.key=t,this.attributes=e,this.clear()}function J(t,e){this.key=t,this.attributes=e,this.clear()}function V(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}Y.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},q.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},J.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},V.prototype.attach=function(){var t="out",e="in";this.undirected&&(t=e="undirected");var n=this.source.key,r=this.target.key;this.source[t][r]=this,this.undirected&&n===r||(this.target[e][n]=this)},V.prototype.attachMulti=function(){var t="out",e="in",n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");var i=this.source[t],o=i[r];if(void 0===o)return i[r]=this,void(this.undirected&&n===r||(this.target[e][n]=this));o.previous=this,this.next=o,i[r]=this,this.target[e][n]=this},V.prototype.detach=function(){var t=this.source.key,e=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},V.prototype.detachMulti=function(){var t=this.source.key,e=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};function H(t,e,n,r,i,o,a){var c,u,d,s;if(r=""+r,0===n){if(!(c=t._nodes.get(r)))throw new F("Graph.".concat(e,': could not find the "').concat(r,'" node in the graph.'));d=i,s=o}else if(3===n){if(i=""+i,!(u=t._edges.get(i)))throw new F("Graph.".concat(e,': could not find the "').concat(i,'" edge in the graph.'));var h=u.source.key,p=u.target.key;if(r===h)c=u.target;else{if(r!==p)throw new F("Graph.".concat(e,': the "').concat(r,'" node is not attached to the "').concat(i,'" edge (').concat(h,", ").concat(p,")."));c=u.source}d=o,s=a}else{if(!(u=t._edges.get(r)))throw new F("Graph.".concat(e,': could not find the "').concat(r,'" edge in the graph.'));c=1===n?u.source:u.target,d=i,s=o}return[c,d,s]}var Q=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=H(this,e,n,t,r,i),a=o[0],c=o[1];return a.attributes[c]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){return H(this,e,n,t,r)[0].attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=H(this,e,n,t,r,i),a=o[0],c=o[1];return a.attributes.hasOwnProperty(c)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){var a=H(this,e,n,t,r,i,o),c=a[0],u=a[1],d=a[2];return c.attributes[u]=d,this.emit("nodeAttributesUpdated",{key:c.key,type:"set",attributes:c.attributes,name:u}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){var a=H(this,e,n,t,r,i,o),c=a[0],u=a[1],d=a[2];if("function"!=typeof d)throw new B("Graph.".concat(e,": updater should be a function."));var s=c.attributes,h=d(s[u]);return s[u]=h,this.emit("nodeAttributesUpdated",{key:c.key,type:"set",attributes:c.attributes,name:u}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=H(this,e,n,t,r,i),a=o[0],c=o[1];return delete a.attributes[c],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:c}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=H(this,e,n,t,r,i),a=o[0],c=o[1];if(!s(c))throw new B("Graph.".concat(e,": provided attributes are not a plain object."));return a.attributes=c,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=H(this,e,n,t,r,i),a=o[0],c=o[1];if(!s(c))throw new B("Graph.".concat(e,": provided attributes are not a plain object."));return u(a.attributes,c),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:c}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=H(this,e,n,t,r,i),a=o[0],c=o[1];if("function"!=typeof c)throw new B("Graph.".concat(e,": provided updater is not a function."));return a.attributes=c(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}}];var X=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=d(this,o,a,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes[r]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+t,o=""+arguments[1];if(!(r=d(this,i,o,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(i,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=d(this,o,a,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes.hasOwnProperty(r)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+t,c=""+r;if(r=arguments[2],i=arguments[3],!(o=d(this,a,c,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(c,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return o.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+t,c=""+r;if(r=arguments[2],i=arguments[3],!(o=d(this,a,c,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(c,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof i)throw new B("Graph.".concat(e,": updater should be a function."));return o.attributes[r]=i(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=d(this,o,a,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=d(this,o,a,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!s(r))throw new B("Graph.".concat(e,": provided attributes are not a plain object."));return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=d(this,o,a,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!s(r))throw new B("Graph.".concat(e,": provided attributes are not a plain object."));return u(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new I("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new I("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=d(this,o,a,n)))throw new F("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new I("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new F("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof r)throw new B("Graph.".concat(e,": provided updater is not a function."));return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}];var Z=O,$=P,tt=function(){var t=arguments,e=null,n=-1;return new Z((function(){for(var r=null;;){if(null===e){if(++n>=t.length)return{done:!0};e=$(t[n])}if(!0!==(r=e.next()).done)break;e=null}return r}))},et=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function nt(t,e,n,r){var i=!1;for(var o in e)if(o!==r){var a=e[o];if(i=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),t&&i)return a.key}}function rt(t,e,n,r){var i,o,a,c=!1;for(var u in e)if(u!==r){i=e[u];do{if(o=i.source,a=i.target,c=n(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected),t&&c)return i.key;i=i.next}while(void 0!==i)}}function it(t,e){var n,r=Object.keys(t),i=r.length,o=0;return new O((function(){do{if(n)n=n.next;else{if(o>=i)return{done:!0};var a=r[o++];if(a===e){n=void 0;continue}n=t[a]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function ot(t,e,n,r){var i=e[n];if(i){var o=i.source,a=i.target;return r(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected)&&t?i.key:void 0}}function at(t,e,n,r){var i=e[n];if(i){var o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&o)return i.key;i=i.next}while(void 0!==i)}}function ct(t,e){var n=t[e];return void 0!==n.next?new O((function(){if(!n)return{done:!0};var t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}})):O.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function ut(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return"function"==typeof Array.from?Array.from(t._edges.keys()):K(t._edges.keys(),t._edges.size);for(var n,r,i="undirected"===e?t.undirectedSize:t.directedSize,o=new Array(i),a="undirected"===e,c=t._edges.values(),u=0;!0!==(n=c.next()).done;)(r=n.value).undirected===a&&(o[u++]=r.key);return o}function dt(t,e,n,r){if(0!==e.size)for(var i,o,a="mixed"!==n&&n!==e.type,c="undirected"===n,u=!1,d=e._edges.values();!0!==(i=d.next()).done;)if(o=i.value,!a||o.undirected===c){var s=o,h=s.key,p=s.attributes,f=s.source,l=s.target;if(u=r(h,p,f.key,l.key,f.attributes,l.attributes,o.undirected),t&&u)return h}}function st(t,e){if(0===t.size)return O.empty();var n="mixed"!==e&&e!==t.type,r="undirected"===e,i=t._edges.values();return new O((function(){for(var t,e;;){if((t=i.next()).done)return t;if(e=t.value,!n||e.undirected===r)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}))}function ht(t,e,n,r,i,o){var a,c=e?rt:nt;if("undirected"!==n){if("out"!==r&&(a=c(t,i.in,o),t&&a))return a;if("in"!==r&&(a=c(t,i.out,o,r?void 0:i.key),t&&a))return a}if("directed"!==n&&(a=c(t,i.undirected,o),t&&a))return a}function pt(t,e,n,r){var i=[];return ht(!1,t,e,n,r,(function(t){i.push(t)})),i}function ft(t,e,n){var r=O.empty();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=tt(r,it(n.in))),"in"!==e&&void 0!==n.out&&(r=tt(r,it(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=tt(r,it(n.undirected))),r}function lt(t,e,n,r,i,o,a){var c,u=n?at:ot;if("undirected"!==e){if(void 0!==i.in&&"out"!==r&&(c=u(t,i.in,o,a),t&&c))return c;if(void 0!==i.out&&"in"!==r&&(r||i.key!==o)&&(c=u(t,i.out,o,a),t&&c))return c}if("directed"!==e&&void 0!==i.undirected&&(c=u(t,i.undirected,o,a),t&&c))return c}function gt(t,e,n,r,i){var o=[];return lt(!1,t,e,n,r,i,(function(t){o.push(t)})),o}function yt(t,e,n,r){var i=O.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=tt(i,ct(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=tt(i,ct(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=tt(i,ct(n.undirected,r))),i}var wt=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function vt(){this.A=null,this.B=null}function bt(t,e,n,r,i){for(var o in r){var a=r[o],c=a.source,u=a.target,d=c===n?u:c;if(!e||!e.has(d.key)){var s=i(d.key,d.attributes);if(t&&s)return d.key}}}function mt(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return bt(t,null,r,r.undirected,i);if("string"==typeof n)return bt(t,null,r,r[n],i)}var o,a=new vt;if("undirected"!==e){if("out"!==n){if(o=bt(t,null,r,r.in,i),t&&o)return o;a.wrap(r.in)}if("in"!==n){if(o=bt(t,a,r,r.out,i),t&&o)return o;a.wrap(r.out)}}if("directed"!==e&&(o=bt(t,a,r,r.undirected,i),t&&o))return o}function kt(t,e,n){var r=Object.keys(n),i=r.length,o=0;return new O((function(){var a=null;do{if(o>=i)return t&&t.wrap(n),{done:!0};var c=n[r[o++]],u=c.source,d=c.target;a=u===e?d:u,t&&t.has(a.key)&&(a=null)}while(null===a);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}))}function _t(t,e){var n=e.name,r=e.type,i=e.direction;t.prototype[n]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new F("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}var r=[];return mt(!1,t,e,n,(function(t){r.push(t)})),r}("mixed"===r?this.type:r,i,e)}}function Gt(t,e){var n=e.name,r=e.type,i=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return O.empty();t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return kt(null,n,n.undirected);if("string"==typeof e)return kt(null,n,n[e])}var r=O.empty(),i=new vt;return"undirected"!==t&&("out"!==e&&(r=tt(r,kt(i,n,n.in))),"in"!==e&&(r=tt(r,kt(i,n,n.out)))),"directed"!==t&&(r=tt(r,kt(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}function xt(t,e,n,r,i){for(var o,a,c,u,d,s,h,p=r._nodes.values(),f=r.type;!0!==(o=p.next()).done;){var l=!1;if(a=o.value,"undirected"!==f)for(c in u=a.out){d=u[c];do{if(s=d.target,l=!0,h=i(a.key,s.key,a.attributes,s.attributes,d.key,d.attributes,d.undirected),t&&h)return d;d=d.next}while(d)}if("directed"!==f)for(c in u=a.undirected)if(!(e&&a.key>c)){d=u[c];do{if((s=d.target).key!==c&&(s=d.source),l=!0,h=i(a.key,s.key,a.attributes,s.attributes,d.key,d.attributes,d.undirected),t&&h)return d;d=d.next}while(d)}if(n&&!l&&(h=i(a.key,null,a.attributes,null,null,null,null),t&&h))return null}}function Et(t){if(!s(t))throw new B('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new B("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!s(t.attributes)||null===t.attributes))throw new B("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function At(t){if(!s(t))throw new B('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new B("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new B("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!s(t.attributes)||null===t.attributes))throw new B("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new B("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}vt.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},vt.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};var Lt,St=(Lt=255&Math.floor(256*Math.random()),function(){return Lt++}),Dt=new Set(["directed","undirected","mixed"]),Ut=new Set(["domain","_events","_eventsCount","_maxListeners"]),Nt={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ot(t,e,n){var r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function jt(t,e,n,r,i,o,a,c){if(!r&&"undirected"===t.type)throw new I("Graph.".concat(e,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(r&&"directed"===t.type)throw new I("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(c&&!s(c))throw new B("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(c,'"'));if(o=""+o,a=""+a,c=c||{},!t.allowSelfLoops&&o===a)throw new I("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var u=t._nodes.get(o),d=t._nodes.get(a);if(!u)throw new F("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!d)throw new F("Graph.".concat(e,': target node "').concat(a,'" not found.'));var h={key:null,undirected:r,source:o,target:a,attributes:c};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new I("Graph.".concat(e,': the "').concat(i,'" edge already exists in the graph.'));if(!t.multi&&(r?void 0!==u.undirected[a]:void 0!==u.out[a]))throw new I("Graph.".concat(e,': an edge linking "').concat(o,'" to "').concat(a,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var p=new V(r,i,u,d,c);t._edges.set(i,p);var f=o===a;return r?(u.undirectedDegree++,d.undirectedDegree++,f&&(u.undirectedLoops++,t._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,f&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?p.attachMulti():p.attach(),r?t._undirectedSize++:t._directedSize++,h.key=i,t.emit("edgeAdded",h),i}function Ct(t,e,n,r,i,o,a,c,d){if(!r&&"undirected"===t.type)throw new I("Graph.".concat(e,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(r&&"directed"===t.type)throw new I("Graph.".concat(e,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(c)if(d){if("function"!=typeof c)throw new B("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(c,'"'))}else if(!s(c))throw new B("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(c,'"'));var h;if(o=""+o,a=""+a,d&&(h=c,c=void 0),!t.allowSelfLoops&&o===a)throw new I("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var p,f,l=t._nodes.get(o),g=t._nodes.get(a);if(!n&&(p=t._edges.get(i))){if(!(p.source.key===o&&p.target.key===a||r&&p.source.key===a&&p.target.key===o))throw new I("Graph.".concat(e,': inconsistency detected when attempting to merge the "').concat(i,'" edge with "').concat(o,'" source & "').concat(a,'" target vs. ("').concat(p.source.key,'", "').concat(p.target.key,'").'));f=p}if(f||t.multi||!l||(f=r?l.undirected[a]:l.out[a]),f){var y=[f.key,!1,!1,!1];if(d?!h:!c)return y;if(d){var w=f.attributes;f.attributes=h(w),t.emit("edgeAttributesUpdated",{type:"replace",key:f.key,attributes:f.attributes})}else u(f.attributes,c),t.emit("edgeAttributesUpdated",{type:"merge",key:f.key,attributes:f.attributes,data:c});return y}c=c||{},d&&h&&(c=h(c));var v={key:null,undirected:r,source:o,target:a,attributes:c};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new I("Graph.".concat(e,': the "').concat(i,'" edge already exists in the graph.'));var b=!1,m=!1;l||(l=Ot(t,o,{}),b=!0,o===a&&(g=l,m=!0)),g||(g=Ot(t,a,{}),m=!0),p=new V(r,i,l,g,c),t._edges.set(i,p);var k=o===a;return r?(l.undirectedDegree++,g.undirectedDegree++,k&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,g.inDegree++,k&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?p.attachMulti():p.attach(),r?t._undirectedSize++:t._directedSize++,v.key=i,t.emit("edgeAdded",v),[i,!0,b,m]}function Mt(t,e){t._edges.delete(e.key);var n=e.source,r=e.target,i=e.attributes,o=e.undirected,a=n===r;o?(n.undirectedDegree--,r.undirectedDegree--,a&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,a&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:o})}var zt=function(n){function r(t){var e;if(e=n.call(this)||this,"boolean"!=typeof(t=u({},Nt,t)).multi)throw new B("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(t.multi,'".'));if(!Dt.has(t.type))throw new B('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(t.type,'".'));if("boolean"!=typeof t.allowSelfLoops)throw new B("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(t.allowSelfLoops,'".'));var r="mixed"===t.type?Y:"directed"===t.type?q:J;p(c(e),"NodeDataClass",r);var i="geid_"+St()+"_",o=0;return p(c(e),"_attributes",{}),p(c(e),"_nodes",new Map),p(c(e),"_edges",new Map),p(c(e),"_directedSize",0),p(c(e),"_undirectedSize",0),p(c(e),"_directedSelfLoopCount",0),p(c(e),"_undirectedSelfLoopCount",0),p(c(e),"_edgeKeyGenerator",(function(){var t;do{t=i+o++}while(e._edges.has(t));return t})),p(c(e),"_options",t),Ut.forEach((function(t){return p(c(e),t,e[t])})),f(c(e),"order",(function(){return e._nodes.size})),f(c(e),"size",(function(){return e._edges.size})),f(c(e),"directedSize",(function(){return e._directedSize})),f(c(e),"undirectedSize",(function(){return e._undirectedSize})),f(c(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),f(c(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),f(c(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),f(c(e),"multi",e._options.multi),f(c(e),"type",e._options.type),f(c(e),"allowSelfLoops",e._options.allowSelfLoops),f(c(e),"implementation",(function(){return"graphology"})),e}e(r,n);var i=r.prototype;return i._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},i.hasNode=function(t){return this._nodes.has(""+t)},i.hasDirectedEdge=function(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+t,r=this._edges.get(n);return!!r&&!r.undirected}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&i.out.hasOwnProperty(e)}throw new B("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasUndirectedEdge=function(t,e){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+t,r=this._edges.get(n);return!!r&&r.undirected}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&i.undirected.hasOwnProperty(e)}throw new B("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasEdge=function(t,e){if(1===arguments.length){var n=""+t;return this._edges.has(n)}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&(void 0!==r.out&&r.out.hasOwnProperty(e)||void 0!==r.undirected&&r.undirected.hasOwnProperty(e))}throw new B("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.directedEdge=function(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new I("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(t);if(!n)throw new F('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new F('Graph.directedEdge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.out&&n.out[e]||void 0;return r?r.key:void 0}},i.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new I("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(t);if(!n)throw new F('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new F('Graph.undirectedEdge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.undirected&&n.undirected[e]||void 0;return r?r.key:void 0}},i.edge=function(t,e){if(this.multi)throw new I("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new F('Graph.edge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(r)return r.key},i.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},i.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},i.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},i.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},i.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.areNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected},i.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.areInboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected},i.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new F('Graph.areOutboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected},i.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},i.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},i.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},i.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},i.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.inboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n},i.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.outboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n},i.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.degree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n},i.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},i.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},i.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},i.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},i.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,r+=e.directedLoops),n-r},i.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,r+=e.directedLoops),n-r},i.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new F('Graph.degreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,r+=2*e.directedLoops),n-r},i.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new F('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},i.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new F('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},i.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new F('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},i.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new F('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var r=n.source.key,i=n.target.key;if(t===r)return i;if(t===i)return r;throw new F('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(r,", ").concat(i,")."))},i.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new F('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},i.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new F('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},i.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new F('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},i.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new F('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},i.addNode=function(t,e){var n=function(t,e,n){if(n&&!s(n))throw new B('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(e=""+e,n=n||{},t._nodes.has(e))throw new I('Graph.addNode: the "'.concat(e,'" node already exist in the graph.'));var r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}(this,t,e);return n.key},i.mergeNode=function(t,e){if(e&&!s(e))throw new B('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(e,'"'));t=""+t,e=e||{};var n=this._nodes.get(t);return n?(e&&(u(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])},i.updateNode=function(t,e){if(e&&"function"!=typeof e)throw new B('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(e,'"'));t=""+t;var n=this._nodes.get(t);if(n){if(e){var r=n.attributes;n.attributes=e(r),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}var i=e?e({}):{};return n=new this.NodeDataClass(t,i),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:i}),[t,!0]},i.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new F('Graph.dropNode: could not find the "'.concat(t,'" node in the graph.'));if("undirected"!==this.type){for(var r in n.out){e=n.out[r];do{Mt(this,e),e=e.next}while(e)}for(var i in n.in){e=n.in[i];do{Mt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{Mt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},i.dropEdge=function(t){var e;if(arguments.length>1){var n=""+arguments[0],r=""+arguments[1];if(!(e=d(this,n,r,this.type)))throw new F('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(r,'" edge in the graph.'))}else if(t=""+t,!(e=this._edges.get(t)))throw new F('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return Mt(this,e),this},i.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new I("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=d(this,t=""+t,e=""+e,"directed");if(!n)throw new F('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Mt(this,n),this},i.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new I("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=d(this,t,e,"undirected");if(!n)throw new F('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Mt(this,n),this},i.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},i.clearEdges=function(){for(var t,e=this._nodes.values();!0!==(t=e.next()).done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},i.getAttribute=function(t){return this._attributes[t]},i.getAttributes=function(){return this._attributes},i.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},i.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},i.updateAttribute=function(t,e){if("function"!=typeof e)throw new B("Graph.updateAttribute: updater should be a function.");var n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},i.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},i.replaceAttributes=function(t){if(!s(t))throw new B("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},i.mergeAttributes=function(t){if(!s(t))throw new B("Graph.mergeAttributes: provided attributes are not a plain object.");return u(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this},i.updateAttributes=function(t){if("function"!=typeof t)throw new B("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},i.updateEachNodeAttributes=function(t,e){if("function"!=typeof t)throw new B("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!l(e))throw new B("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i=this._nodes.values();!0!==(n=i.next()).done;)(r=n.value).attributes=t(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},i.updateEachEdgeAttributes=function(t,e){if("function"!=typeof t)throw new B("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!l(e))throw new B("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i,o,a=this._edges.values();!0!==(n=a.next()).done;)i=(r=n.value).source,o=r.target,r.attributes=t(r.key,r.attributes,i.key,o.key,i.attributes,o.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},i.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new B("Graph.forEachAdjacencyEntry: expecting a callback.");xt(!1,!1,!1,this,t)},i.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new B("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");xt(!1,!1,!0,this,t)},i.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new B("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");xt(!1,!0,!1,this,t)},i.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new B("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");xt(!1,!0,!0,this,t)},i.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):K(this._nodes.keys(),this._nodes.size)},i.forEachNode=function(t){if("function"!=typeof t)throw new B("Graph.forEachNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)t((n=e.value).key,n.attributes)},i.findNode=function(t){if("function"!=typeof t)throw new B("Graph.findNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(t((n=e.value).key,n.attributes))return n.key},i.mapNodes=function(t){if("function"!=typeof t)throw new B("Graph.mapNode: expecting a callback.");for(var e,n,r=this._nodes.values(),i=new Array(this.order),o=0;!0!==(e=r.next()).done;)n=e.value,i[o++]=t(n.key,n.attributes);return i},i.someNode=function(t){if("function"!=typeof t)throw new B("Graph.someNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(t((n=e.value).key,n.attributes))return!0;return!1},i.everyNode=function(t){if("function"!=typeof t)throw new B("Graph.everyNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(!t((n=e.value).key,n.attributes))return!1;return!0},i.filterNodes=function(t){if("function"!=typeof t)throw new B("Graph.filterNodes: expecting a callback.");for(var e,n,r=this._nodes.values(),i=[];!0!==(e=r.next()).done;)t((n=e.value).key,n.attributes)&&i.push(n.key);return i},i.reduceNodes=function(t,e){if("function"!=typeof t)throw new B("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new B("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,r,i=e,o=this._nodes.values();!0!==(n=o.next()).done;)i=t(i,(r=n.value).key,r.attributes);return i},i.nodeEntries=function(){var t=this._nodes.values();return new O((function(){var e=t.next();if(e.done)return e;var n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},i.export=function(){var t=this,e=new Array(this._nodes.size),n=0;this._nodes.forEach((function(t,r){e[n++]=function(t,e){var n={key:t};return h(e.attributes)||(n.attributes=u({},e.attributes)),n}(r,t)}));var r=new Array(this._edges.size);return n=0,this._edges.forEach((function(e,i){r[n++]=function(t,e,n){var r={key:e,source:n.source.key,target:n.target.key};return h(n.attributes)||(r.attributes=u({},n.attributes)),"mixed"===t&&n.undirected&&(r.undirected=!0),r}(t.type,i,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}},i.import=function(t){var e,n,i,o,a,c=this,u=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof r)return t.forEachNode((function(t,e){u?c.mergeNode(t,e):c.addNode(t,e)})),t.forEachEdge((function(t,e,n,r,i,o,a){u?a?c.mergeUndirectedEdgeWithKey(t,n,r,e):c.mergeDirectedEdgeWithKey(t,n,r,e):a?c.addUndirectedEdgeWithKey(t,n,r,e):c.addDirectedEdgeWithKey(t,n,r,e)})),this;if(!s(t))throw new B("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!s(t.attributes))throw new B("Graph.import: invalid attributes. Expecting a plain object.");u?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new B("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=i.length;e<n;e++){Et(o=i[e]);var d=o,h=d.key,p=d.attributes;u?this.mergeNode(h,p):this.addNode(h,p)}}if(t.edges){var f=!1;if("undirected"===this.type&&(f=!0),i=t.edges,!Array.isArray(i))throw new B("Graph.import: invalid edges. Expecting an array.");for(e=0,n=i.length;e<n;e++){At(a=i[e]);var l=a,g=l.source,y=l.target,w=l.attributes,v=l.undirected,b=void 0===v?f:v;"key"in a?(u?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,a.key,g,y,w):(u?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,g,y,w)}}return this},i.nullCopy=function(t){var e=new r(u({},this._options,t));return e.replaceAttributes(u({},this.getAttributes())),e},i.emptyCopy=function(t){var e=this.nullCopy(t);return this._nodes.forEach((function(t,n){var r=u({},t.attributes);t=new e.NodeDataClass(n,r),e._nodes.set(n,t)})),e},i.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new I('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(t.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new I("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new I("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var e,n,r=this.emptyCopy(t),i=this._edges.values();!0!==(e=i.next()).done;)jt(r,"copy",!1,(n=e.value).undirected,n.key,n.source.key,n.target.key,u({},n.attributes));return r},i.toJSON=function(){return this.export()},i.toString=function(){return"[object Graph]"},i.inspect=function(){var e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var r={},i={};this._edges.forEach((function(t,n){var o,a=t.undirected?"--":"->",c="",u=t.source.key,d=t.target.key;t.undirected&&u>d&&(o=u,u=d,d=o);var s="(".concat(u,")").concat(a,"(").concat(d,")");n.startsWith("geid_")?e.multi&&(void 0===i[s]?i[s]=0:i[s]++,c+="".concat(i[s],". ")):c+="[".concat(n,"]: "),r[c+=s]=t.attributes}));var o={};for(var a in this)this.hasOwnProperty(a)&&!Ut.has(a)&&"function"!=typeof this[a]&&"symbol"!==t(a)&&(o[a]=this[a]);return o.attributes=this._attributes,o.nodes=n,o.edges=r,p(o,"constructor",this.constructor),o},r}(y.exports.EventEmitter);"undefined"!=typeof Symbol&&(zt.prototype[Symbol.for("nodejs.util.inspect.custom")]=zt.prototype.inspect),[{name:function(t){return"".concat(t,"Edge")},generateKey:!0},{name:function(t){return"".concat(t,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(t){return"".concat(t,"EdgeWithKey")}},{name:function(t){return"".concat(t,"DirectedEdgeWithKey")},type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(t){["add","merge","update"].forEach((function(e){var n=t.name(e),r="add"===e?jt:Ct;t.generateKey?zt.prototype[n]=function(i,o,a){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,a,"update"===e)}:zt.prototype[n]=function(i,o,a,c){return r(this,n,!1,"undirected"===(t.type||this.type),i,o,a,c,"update"===e)}}))})),function(t){Q.forEach((function(e){var n=e.name,r=e.attacher;r(t,n("Node"),0),r(t,n("Source"),1),r(t,n("Target"),2),r(t,n("Opposite"),3)}))}(zt),function(t){X.forEach((function(e){var n=e.name,r=e.attacher;r(t,n("Edge"),"mixed"),r(t,n("DirectedEdge"),"directed"),r(t,n("UndirectedEdge"),"undirected")}))}(zt),function(t){et.forEach((function(e){!function(t,e){var n=e.name,r=e.type,i=e.direction;t.prototype[n]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return ut(this,r);if(1===arguments.length){t=""+t;var o=this._nodes.get(t);if(void 0===o)throw new F("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return pt(this.multi,"mixed"===r?this.type:r,i,o)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new F("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new F("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return gt(r,this.multi,i,a,e)}throw new B("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return dt(!1,this,r,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ht(!1,this.multi,"mixed"===r?this.type:r,i,a,n)}if(3===arguments.length){t=""+t,e=""+e;var c=this._nodes.get(t);if(!c)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new F("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return lt(!1,r,this.multi,i,c,e,n)}throw new B("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){var t,e=Array.prototype.slice.call(arguments),n=e.pop();if(0===e.length){var i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),t=new Array(i);var a=0;e.push((function(e,r,i,o,c,u,d){t[a++]=n(e,r,i,o,c,u,d)}))}else t=[],e.push((function(e,r,i,o,a,c,u){t.push(n(e,r,i,o,a,c,u))}));return this[o].apply(this,e),t};var c="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[c]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((function(t,r,i,o,a,c,u){e(t,r,i,o,a,c,u)&&n.push(t)})),this[o].apply(this,t),n};var u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(){var t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new B("Graph.".concat(u,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new B("Graph.".concat(u,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);var r=e;return n.push((function(e,n,i,o,a,c,u){r=t(r,e,n,i,o,a,c,u)})),this[o].apply(this,n),r}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return dt(!0,this,r,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ht(!0,this.multi,"mixed"===r?this.type:r,i,a,n)}if(3===arguments.length){t=""+t,e=""+e;var c=this._nodes.get(t);if(!c)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new F("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return lt(!0,r,this.multi,i,c,e,n)}throw new B("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var a="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,r,i,o,a,c){return e(t,n,r,i,o,a,c)})),!!this[o].apply(this,t)};var c="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[c]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,r,i,o,a,c){return!e(t,n,r,i,o,a,c)})),!this[o].apply(this,t)}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return O.empty();if(!arguments.length)return st(this,r);if(1===arguments.length){t=""+t;var n=this._nodes.get(t);if(!n)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ft(r,i,n)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new F("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return yt(r,i,a,e)}throw new B("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(zt),function(t){wt.forEach((function(e){_t(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"===r||"mixed"===this.type||r===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new F("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));mt(!1,"mixed"===r?this.type:r,i,n,e)}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){var n=[];return this[o](t,(function(t,r){n.push(e(t,r))})),n};var c="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[c]=function(t,e){var n=[];return this[o](t,(function(t,r){e(t,r)&&n.push(t)})),n};var u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(t,e,n){if(arguments.length<3)throw new B("Graph.".concat(u,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var r=n;return this[o](t,(function(t,n){r=e(r,t,n)})),r}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n[0].toUpperCase()+n.slice(1,-1),a="find"+o;t.prototype[a]=function(t,e){if("mixed"===r||"mixed"===this.type||r===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new F("Graph.".concat(a,': could not find the "').concat(t,'" node in the graph.'));return mt(!0,"mixed"===r?this.type:r,i,n,e)}};var c="some"+o;t.prototype[c]=function(t,e){return!!this[a](t,e)};var u="every"+o;t.prototype[u]=function(t,e){return!this[a](t,(function(t,n){return!e(t,n)}))}}(t,e),Gt(t,e)}))}(zt);var Wt=function(t){function n(e){var n=u({type:"directed"},e);if("multi"in n&&!1!==n.multi)throw new B("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new B('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(zt),Pt=function(t){function n(e){var n=u({type:"undirected"},e);if("multi"in n&&!1!==n.multi)throw new B("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new B('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(zt),Rt=function(t){function n(e){var n=u({multi:!0},e);if("multi"in n&&!0!==n.multi)throw new B("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return t.call(this,n)||this}return e(n,t),n}(zt),Kt=function(t){function n(e){var n=u({type:"directed",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new B("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new B('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(zt),Tt=function(t){function n(e){var n=u({type:"undirected",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new B("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new B('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(zt);function Bt(t){t.from=function(e,n){var r=u({},e.options,n),i=new t(r);return i.import(e),i}}return Bt(zt),Bt(Wt),Bt(Pt),Bt(Rt),Bt(Kt),Bt(Tt),zt.Graph=zt,zt.DirectedGraph=Wt,zt.UndirectedGraph=Pt,zt.MultiGraph=Rt,zt.MultiDirectedGraph=Kt,zt.MultiUndirectedGraph=Tt,zt.InvalidArgumentsGraphError=B,zt.NotFoundGraphError=F,zt.UsageGraphError=I,zt}));
2014
+ //# sourceMappingURL=graphology.umd.min.js.map
2015
+
2016
+
2017
+ /***/ })
2018
+
2019
+ /******/ });
2020
+ /************************************************************************/
2021
+ /******/ // The module cache
2022
+ /******/ var __webpack_module_cache__ = {};
2023
+ /******/
2024
+ /******/ // The require function
2025
+ /******/ function __webpack_require__(moduleId) {
2026
+ /******/ // Check if module is in cache
2027
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
2028
+ /******/ if (cachedModule !== undefined) {
2029
+ /******/ return cachedModule.exports;
2030
+ /******/ }
2031
+ /******/ // Create a new module (and put it into the cache)
2032
+ /******/ var module = __webpack_module_cache__[moduleId] = {
2033
+ /******/ // no module.id needed
2034
+ /******/ // no module.loaded needed
2035
+ /******/ exports: {}
2036
+ /******/ };
2037
+ /******/
2038
+ /******/ // Execute the module function
2039
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2040
+ /******/
2041
+ /******/ // Return the exports of the module
2042
+ /******/ return module.exports;
2043
+ /******/ }
2044
+ /******/
2045
+ /******/ // expose the modules object (__webpack_modules__)
2046
+ /******/ __webpack_require__.m = __webpack_modules__;
2047
+ /******/
2048
+ /******/ // the startup function
2049
+ /******/ __webpack_require__.x = () => {
2050
+ /******/ // Load entry module and return exports
2051
+ /******/ // This entry module depends on other loaded chunks and execution need to be delayed
2052
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendors-node_modules_datagrok-libraries_math_src_webGPU_sparse-matrix_webGPU-sparse-matrix_js-07693f"], () => (__webpack_require__("./node_modules/@datagrok-libraries/ml/src/MCL/mcl-worker.js")))
2053
+ /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
2054
+ /******/ return __webpack_exports__;
2055
+ /******/ };
2056
+ /******/
2057
+ /************************************************************************/
2058
+ /******/ /* webpack/runtime/chunk loaded */
2059
+ /******/ (() => {
2060
+ /******/ var deferred = [];
2061
+ /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
2062
+ /******/ if(chunkIds) {
2063
+ /******/ priority = priority || 0;
2064
+ /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
2065
+ /******/ deferred[i] = [chunkIds, fn, priority];
2066
+ /******/ return;
2067
+ /******/ }
2068
+ /******/ var notFulfilled = Infinity;
2069
+ /******/ for (var i = 0; i < deferred.length; i++) {
2070
+ /******/ var [chunkIds, fn, priority] = deferred[i];
2071
+ /******/ var fulfilled = true;
2072
+ /******/ for (var j = 0; j < chunkIds.length; j++) {
2073
+ /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
2074
+ /******/ chunkIds.splice(j--, 1);
2075
+ /******/ } else {
2076
+ /******/ fulfilled = false;
2077
+ /******/ if(priority < notFulfilled) notFulfilled = priority;
2078
+ /******/ }
2079
+ /******/ }
2080
+ /******/ if(fulfilled) {
2081
+ /******/ deferred.splice(i--, 1)
2082
+ /******/ var r = fn();
2083
+ /******/ if (r !== undefined) result = r;
2084
+ /******/ }
2085
+ /******/ }
2086
+ /******/ return result;
2087
+ /******/ };
2088
+ /******/ })();
2089
+ /******/
2090
+ /******/ /* webpack/runtime/compat get default export */
2091
+ /******/ (() => {
2092
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
2093
+ /******/ __webpack_require__.n = (module) => {
2094
+ /******/ var getter = module && module.__esModule ?
2095
+ /******/ () => (module['default']) :
2096
+ /******/ () => (module);
2097
+ /******/ __webpack_require__.d(getter, { a: getter });
2098
+ /******/ return getter;
2099
+ /******/ };
2100
+ /******/ })();
2101
+ /******/
2102
+ /******/ /* webpack/runtime/define property getters */
2103
+ /******/ (() => {
2104
+ /******/ // define getter functions for harmony exports
2105
+ /******/ __webpack_require__.d = (exports, definition) => {
2106
+ /******/ for(var key in definition) {
2107
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2108
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2109
+ /******/ }
2110
+ /******/ }
2111
+ /******/ };
2112
+ /******/ })();
2113
+ /******/
2114
+ /******/ /* webpack/runtime/ensure chunk */
2115
+ /******/ (() => {
2116
+ /******/ __webpack_require__.f = {};
2117
+ /******/ // This file contains only the entry chunk.
2118
+ /******/ // The chunk loading function for additional chunks
2119
+ /******/ __webpack_require__.e = (chunkId) => {
2120
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
2121
+ /******/ __webpack_require__.f[key](chunkId, promises);
2122
+ /******/ return promises;
2123
+ /******/ }, []));
2124
+ /******/ };
2125
+ /******/ })();
2126
+ /******/
2127
+ /******/ /* webpack/runtime/get javascript chunk filename */
2128
+ /******/ (() => {
2129
+ /******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
2130
+ /******/ __webpack_require__.u = (chunkId) => {
2131
+ /******/ // return url for filenames based on template
2132
+ /******/ return "" + chunkId + ".js";
2133
+ /******/ };
2134
+ /******/ })();
2135
+ /******/
2136
+ /******/ /* webpack/runtime/global */
2137
+ /******/ (() => {
2138
+ /******/ __webpack_require__.g = (function() {
2139
+ /******/ if (typeof globalThis === 'object') return globalThis;
2140
+ /******/ try {
2141
+ /******/ return this || new Function('return this')();
2142
+ /******/ } catch (e) {
2143
+ /******/ if (typeof window === 'object') return window;
2144
+ /******/ }
2145
+ /******/ })();
2146
+ /******/ })();
2147
+ /******/
2148
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
2149
+ /******/ (() => {
2150
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2151
+ /******/ })();
2152
+ /******/
2153
+ /******/ /* webpack/runtime/make namespace object */
2154
+ /******/ (() => {
2155
+ /******/ // define __esModule on exports
2156
+ /******/ __webpack_require__.r = (exports) => {
2157
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2158
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2159
+ /******/ }
2160
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
2161
+ /******/ };
2162
+ /******/ })();
2163
+ /******/
2164
+ /******/ /* webpack/runtime/publicPath */
2165
+ /******/ (() => {
2166
+ /******/ var scriptUrl;
2167
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
2168
+ /******/ var document = __webpack_require__.g.document;
2169
+ /******/ if (!scriptUrl && document) {
2170
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
2171
+ /******/ scriptUrl = document.currentScript.src;
2172
+ /******/ if (!scriptUrl) {
2173
+ /******/ var scripts = document.getElementsByTagName("script");
2174
+ /******/ if(scripts.length) {
2175
+ /******/ var i = scripts.length - 1;
2176
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
2177
+ /******/ }
2178
+ /******/ }
2179
+ /******/ }
2180
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
2181
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
2182
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
2183
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
2184
+ /******/ __webpack_require__.p = scriptUrl;
2185
+ /******/ })();
2186
+ /******/
2187
+ /******/ /* webpack/runtime/importScripts chunk loading */
2188
+ /******/ (() => {
2189
+ /******/ __webpack_require__.b = self.location + "";
2190
+ /******/
2191
+ /******/ // object to store loaded chunks
2192
+ /******/ // "1" means "already loaded"
2193
+ /******/ var installedChunks = {
2194
+ /******/ "vendors-node_modules_datagrok-libraries_ml_src_MCL_mcl-worker_js-node_modules_datagrok-librar-e4203d": 1
2195
+ /******/ };
2196
+ /******/
2197
+ /******/ // importScripts chunk loading
2198
+ /******/ var installChunk = (data) => {
2199
+ /******/ var [chunkIds, moreModules, runtime] = data;
2200
+ /******/ for(var moduleId in moreModules) {
2201
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
2202
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
2203
+ /******/ }
2204
+ /******/ }
2205
+ /******/ if(runtime) runtime(__webpack_require__);
2206
+ /******/ while(chunkIds.length)
2207
+ /******/ installedChunks[chunkIds.pop()] = 1;
2208
+ /******/ parentChunkLoadingFunction(data);
2209
+ /******/ };
2210
+ /******/ __webpack_require__.f.i = (chunkId, promises) => {
2211
+ /******/ // "1" is the signal for "already loaded"
2212
+ /******/ if(!installedChunks[chunkId]) {
2213
+ /******/ if(true) { // all chunks have JS
2214
+ /******/ importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
2215
+ /******/ }
2216
+ /******/ }
2217
+ /******/ };
2218
+ /******/
2219
+ /******/ var chunkLoadingGlobal = self["webpackChunkeda"] = self["webpackChunkeda"] || [];
2220
+ /******/ var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
2221
+ /******/ chunkLoadingGlobal.push = installChunk;
2222
+ /******/
2223
+ /******/ // no HMR
2224
+ /******/
2225
+ /******/ // no HMR manifest
2226
+ /******/ })();
2227
+ /******/
2228
+ /******/ /* webpack/runtime/startup chunk dependencies */
2229
+ /******/ (() => {
2230
+ /******/ var next = __webpack_require__.x;
2231
+ /******/ __webpack_require__.x = () => {
2232
+ /******/ return __webpack_require__.e("vendors-node_modules_datagrok-libraries_math_src_webGPU_sparse-matrix_webGPU-sparse-matrix_js-07693f").then(next);
2233
+ /******/ };
2234
+ /******/ })();
2235
+ /******/
2236
+ /************************************************************************/
2237
+ /******/
2238
+ /******/ // run startup
2239
+ /******/ var __webpack_exports__ = __webpack_require__.x();
2240
+ /******/ eda = __webpack_exports__;
2241
+ /******/
2242
+ /******/ })()
2243
+ ;
2244
+ //# sourceMappingURL=vendors-node_modules_datagrok-libraries_ml_src_MCL_mcl-worker_js-node_modules_datagrok-librar-e4203d.js.map