data-structure-typed 2.5.1 → 2.5.2
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.
- package/CHANGELOG.md +3 -1
- package/README.md +75 -17
- package/dist/cjs/binary-tree.cjs +2723 -139
- package/dist/cjs/graph.cjs +192 -6
- package/dist/cjs/hash.cjs +63 -15
- package/dist/cjs/heap.cjs +93 -31
- package/dist/cjs/index.cjs +3514 -379
- package/dist/cjs/linked-list.cjs +237 -31
- package/dist/cjs/matrix.cjs +47 -9
- package/dist/cjs/priority-queue.cjs +92 -30
- package/dist/cjs/queue.cjs +176 -2
- package/dist/cjs/stack.cjs +48 -2
- package/dist/cjs/trie.cjs +78 -28
- package/dist/cjs-legacy/binary-tree.cjs +2725 -136
- package/dist/cjs-legacy/graph.cjs +192 -6
- package/dist/cjs-legacy/hash.cjs +63 -15
- package/dist/cjs-legacy/heap.cjs +93 -31
- package/dist/cjs-legacy/index.cjs +3389 -249
- package/dist/cjs-legacy/linked-list.cjs +237 -31
- package/dist/cjs-legacy/matrix.cjs +47 -9
- package/dist/cjs-legacy/priority-queue.cjs +92 -30
- package/dist/cjs-legacy/queue.cjs +176 -2
- package/dist/cjs-legacy/stack.cjs +48 -2
- package/dist/cjs-legacy/trie.cjs +78 -28
- package/dist/esm/binary-tree.mjs +2723 -139
- package/dist/esm/graph.mjs +192 -6
- package/dist/esm/hash.mjs +63 -15
- package/dist/esm/heap.mjs +93 -31
- package/dist/esm/index.mjs +3514 -380
- package/dist/esm/linked-list.mjs +237 -31
- package/dist/esm/matrix.mjs +47 -9
- package/dist/esm/priority-queue.mjs +92 -30
- package/dist/esm/queue.mjs +176 -2
- package/dist/esm/stack.mjs +48 -2
- package/dist/esm/trie.mjs +78 -28
- package/dist/esm-legacy/binary-tree.mjs +2725 -136
- package/dist/esm-legacy/graph.mjs +192 -6
- package/dist/esm-legacy/hash.mjs +63 -15
- package/dist/esm-legacy/heap.mjs +93 -31
- package/dist/esm-legacy/index.mjs +3389 -250
- package/dist/esm-legacy/linked-list.mjs +237 -31
- package/dist/esm-legacy/matrix.mjs +47 -9
- package/dist/esm-legacy/priority-queue.mjs +92 -30
- package/dist/esm-legacy/queue.mjs +176 -2
- package/dist/esm-legacy/stack.mjs +48 -2
- package/dist/esm-legacy/trie.mjs +78 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
- package/dist/types/data-structures/heap/heap.d.ts +56 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +60 -0
- package/dist/types/data-structures/queue/queue.d.ts +48 -0
- package/dist/types/data-structures/stack/stack.d.ts +40 -0
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/data-structure-typed.js +3404 -265
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +40 -54
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
- package/docs-site-docusaurus/docs/guide/overview.md +7 -0
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +51 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/llms.txt +37 -0
- package/package.json +64 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
|
@@ -25,6 +25,10 @@ var arrayRemove = /* @__PURE__ */ __name(function(array, predicate) {
|
|
|
25
25
|
}, "arrayRemove");
|
|
26
26
|
|
|
27
27
|
// src/common/error.ts
|
|
28
|
+
function raise(ErrorClass, message) {
|
|
29
|
+
throw new ErrorClass(message);
|
|
30
|
+
}
|
|
31
|
+
__name(raise, "raise");
|
|
28
32
|
var ERR = {
|
|
29
33
|
// Range / index
|
|
30
34
|
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
@@ -46,7 +50,9 @@ var ERR = {
|
|
|
46
50
|
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
47
51
|
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
48
52
|
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
49
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
53
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
54
|
+
// Order statistic
|
|
55
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
// src/data-structures/base/iterable-entry-base.ts
|
|
@@ -252,7 +258,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
252
258
|
if (options) {
|
|
253
259
|
const { toElementFn } = options;
|
|
254
260
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
255
|
-
else if (toElementFn)
|
|
261
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
256
262
|
}
|
|
257
263
|
}
|
|
258
264
|
/**
|
|
@@ -408,7 +414,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
408
414
|
acc = initialValue;
|
|
409
415
|
} else {
|
|
410
416
|
const first = iter.next();
|
|
411
|
-
if (first.done)
|
|
417
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
412
418
|
acc = first.value;
|
|
413
419
|
index = 1;
|
|
414
420
|
}
|
|
@@ -659,7 +665,7 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
659
665
|
__publicField(this, "_elements", []);
|
|
660
666
|
__publicField(this, "_DEFAULT_COMPARATOR", /* @__PURE__ */ __name((a, b) => {
|
|
661
667
|
if (typeof a === "object" || typeof b === "object") {
|
|
662
|
-
|
|
668
|
+
raise(TypeError, ERR.comparatorRequired("Heap"));
|
|
663
669
|
}
|
|
664
670
|
if (a > b) return 1;
|
|
665
671
|
if (a < b) return -1;
|
|
@@ -710,6 +716,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
710
716
|
|
|
711
717
|
|
|
712
718
|
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
713
723
|
|
|
714
724
|
|
|
715
725
|
|
|
@@ -793,6 +803,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
793
803
|
|
|
794
804
|
|
|
795
805
|
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
796
810
|
|
|
797
811
|
|
|
798
812
|
|
|
@@ -846,6 +860,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
846
860
|
|
|
847
861
|
|
|
848
862
|
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
849
867
|
|
|
850
868
|
|
|
851
869
|
|
|
@@ -901,6 +919,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
901
919
|
|
|
902
920
|
|
|
903
921
|
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
904
926
|
|
|
905
927
|
|
|
906
928
|
|
|
@@ -972,6 +994,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
972
994
|
|
|
973
995
|
|
|
974
996
|
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
975
1001
|
|
|
976
1002
|
|
|
977
1003
|
|
|
@@ -1068,6 +1094,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1068
1094
|
|
|
1069
1095
|
|
|
1070
1096
|
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1071
1101
|
|
|
1072
1102
|
|
|
1073
1103
|
|
|
@@ -1111,6 +1141,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1111
1141
|
|
|
1112
1142
|
|
|
1113
1143
|
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1114
1148
|
|
|
1115
1149
|
|
|
1116
1150
|
|
|
@@ -1157,6 +1191,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1157
1191
|
|
|
1158
1192
|
|
|
1159
1193
|
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1160
1198
|
|
|
1161
1199
|
|
|
1162
1200
|
|
|
@@ -1200,6 +1238,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1200
1238
|
|
|
1201
1239
|
|
|
1202
1240
|
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1203
1245
|
|
|
1204
1246
|
|
|
1205
1247
|
|
|
@@ -1289,6 +1331,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1289
1331
|
|
|
1290
1332
|
|
|
1291
1333
|
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
|
|
1292
1338
|
|
|
1293
1339
|
|
|
1294
1340
|
|
|
@@ -1365,6 +1411,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1365
1411
|
|
|
1366
1412
|
|
|
1367
1413
|
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1368
1418
|
|
|
1369
1419
|
|
|
1370
1420
|
|
|
@@ -1414,6 +1464,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1414
1464
|
|
|
1415
1465
|
|
|
1416
1466
|
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
|
|
1417
1471
|
|
|
1418
1472
|
|
|
1419
1473
|
|
|
@@ -1462,6 +1516,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1462
1516
|
|
|
1463
1517
|
|
|
1464
1518
|
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
|
|
1465
1523
|
|
|
1466
1524
|
|
|
1467
1525
|
|
|
@@ -1517,6 +1575,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1517
1575
|
|
|
1518
1576
|
|
|
1519
1577
|
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
|
|
1520
1582
|
|
|
1521
1583
|
|
|
1522
1584
|
|
|
@@ -1530,7 +1592,7 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1530
1592
|
*/
|
|
1531
1593
|
map(callback, options, thisArg) {
|
|
1532
1594
|
const { comparator, toElementFn, ...rest } = options != null ? options : {};
|
|
1533
|
-
if (!comparator)
|
|
1595
|
+
if (!comparator) raise(TypeError, ERR.comparatorRequired("Heap.map"));
|
|
1534
1596
|
const out = this._createLike([], { ...rest, comparator, toElementFn });
|
|
1535
1597
|
let i = 0;
|
|
1536
1598
|
for (const x of this) {
|
|
@@ -1716,6 +1778,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1716
1778
|
|
|
1717
1779
|
|
|
1718
1780
|
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
|
|
1719
1785
|
|
|
1720
1786
|
|
|
1721
1787
|
|
|
@@ -1762,6 +1828,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1762
1828
|
|
|
1763
1829
|
|
|
1764
1830
|
|
|
1831
|
+
|
|
1832
|
+
|
|
1833
|
+
|
|
1834
|
+
|
|
1765
1835
|
|
|
1766
1836
|
|
|
1767
1837
|
|
|
@@ -1824,6 +1894,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1824
1894
|
|
|
1825
1895
|
|
|
1826
1896
|
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
1827
1901
|
|
|
1828
1902
|
|
|
1829
1903
|
|
|
@@ -1882,6 +1956,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1882
1956
|
|
|
1883
1957
|
|
|
1884
1958
|
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
|
|
1962
|
+
|
|
1885
1963
|
|
|
1886
1964
|
|
|
1887
1965
|
|
|
@@ -1947,6 +2025,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1947
2025
|
|
|
1948
2026
|
|
|
1949
2027
|
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
1950
2032
|
|
|
1951
2033
|
|
|
1952
2034
|
|
|
@@ -2002,6 +2084,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2002
2084
|
|
|
2003
2085
|
|
|
2004
2086
|
|
|
2087
|
+
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
|
|
2005
2091
|
|
|
2006
2092
|
|
|
2007
2093
|
|
|
@@ -2050,6 +2136,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2050
2136
|
|
|
2051
2137
|
|
|
2052
2138
|
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
|
|
2053
2143
|
|
|
2054
2144
|
|
|
2055
2145
|
|
|
@@ -2139,6 +2229,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2139
2229
|
|
|
2140
2230
|
|
|
2141
2231
|
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2142
2236
|
|
|
2143
2237
|
|
|
2144
2238
|
|
|
@@ -2181,6 +2275,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2181
2275
|
|
|
2182
2276
|
|
|
2183
2277
|
|
|
2278
|
+
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
|
|
2184
2282
|
|
|
2185
2283
|
|
|
2186
2284
|
|
|
@@ -2246,6 +2344,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2246
2344
|
|
|
2247
2345
|
|
|
2248
2346
|
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
|
|
2249
2351
|
|
|
2250
2352
|
|
|
2251
2353
|
|
|
@@ -2295,6 +2397,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2295
2397
|
|
|
2296
2398
|
|
|
2297
2399
|
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
|
|
2298
2404
|
|
|
2299
2405
|
|
|
2300
2406
|
|
|
@@ -2348,6 +2454,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2348
2454
|
|
|
2349
2455
|
|
|
2350
2456
|
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2351
2461
|
|
|
2352
2462
|
|
|
2353
2463
|
|
|
@@ -2587,7 +2697,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
|
|
|
2587
2697
|
const newEdge = this.createEdge(srcOrEdge, dest, weight, value);
|
|
2588
2698
|
return this._addEdge(newEdge);
|
|
2589
2699
|
} else {
|
|
2590
|
-
|
|
2700
|
+
raise(TypeError, ERR.invalidArgument("dest must be a Vertex or vertex key when srcOrEdge is an Edge.", "Graph"));
|
|
2591
2701
|
}
|
|
2592
2702
|
}
|
|
2593
2703
|
}
|
|
@@ -3486,6 +3596,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3486
3596
|
|
|
3487
3597
|
|
|
3488
3598
|
|
|
3599
|
+
|
|
3600
|
+
|
|
3601
|
+
|
|
3602
|
+
|
|
3489
3603
|
|
|
3490
3604
|
|
|
3491
3605
|
|
|
@@ -3570,6 +3684,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3570
3684
|
|
|
3571
3685
|
|
|
3572
3686
|
|
|
3687
|
+
|
|
3688
|
+
|
|
3689
|
+
|
|
3690
|
+
|
|
3573
3691
|
|
|
3574
3692
|
|
|
3575
3693
|
|
|
@@ -3652,6 +3770,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3652
3770
|
|
|
3653
3771
|
|
|
3654
3772
|
|
|
3773
|
+
|
|
3774
|
+
|
|
3775
|
+
|
|
3776
|
+
|
|
3655
3777
|
|
|
3656
3778
|
|
|
3657
3779
|
|
|
@@ -3725,6 +3847,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3725
3847
|
|
|
3726
3848
|
|
|
3727
3849
|
|
|
3850
|
+
|
|
3851
|
+
|
|
3852
|
+
|
|
3853
|
+
|
|
3728
3854
|
|
|
3729
3855
|
|
|
3730
3856
|
|
|
@@ -3775,6 +3901,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3775
3901
|
|
|
3776
3902
|
|
|
3777
3903
|
|
|
3904
|
+
|
|
3905
|
+
|
|
3906
|
+
|
|
3907
|
+
|
|
3778
3908
|
|
|
3779
3909
|
|
|
3780
3910
|
|
|
@@ -3878,6 +4008,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3878
4008
|
|
|
3879
4009
|
|
|
3880
4010
|
|
|
4011
|
+
|
|
4012
|
+
|
|
4013
|
+
|
|
4014
|
+
|
|
3881
4015
|
|
|
3882
4016
|
|
|
3883
4017
|
|
|
@@ -3962,6 +4096,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3962
4096
|
|
|
3963
4097
|
|
|
3964
4098
|
|
|
4099
|
+
|
|
4100
|
+
|
|
4101
|
+
|
|
4102
|
+
|
|
3965
4103
|
|
|
3966
4104
|
|
|
3967
4105
|
|
|
@@ -4008,6 +4146,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
4008
4146
|
|
|
4009
4147
|
|
|
4010
4148
|
|
|
4149
|
+
|
|
4150
|
+
|
|
4151
|
+
|
|
4152
|
+
|
|
4011
4153
|
|
|
4012
4154
|
|
|
4013
4155
|
|
|
@@ -4107,6 +4249,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
4107
4249
|
|
|
4108
4250
|
|
|
4109
4251
|
|
|
4252
|
+
|
|
4253
|
+
|
|
4254
|
+
|
|
4255
|
+
|
|
4110
4256
|
|
|
4111
4257
|
|
|
4112
4258
|
|
|
@@ -4209,6 +4355,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
4209
4355
|
|
|
4210
4356
|
|
|
4211
4357
|
|
|
4358
|
+
|
|
4359
|
+
|
|
4360
|
+
|
|
4361
|
+
|
|
4212
4362
|
|
|
4213
4363
|
|
|
4214
4364
|
|
|
@@ -4375,6 +4525,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4375
4525
|
|
|
4376
4526
|
|
|
4377
4527
|
|
|
4528
|
+
|
|
4529
|
+
|
|
4530
|
+
|
|
4531
|
+
|
|
4378
4532
|
|
|
4379
4533
|
|
|
4380
4534
|
|
|
@@ -4456,6 +4610,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4456
4610
|
|
|
4457
4611
|
|
|
4458
4612
|
|
|
4613
|
+
|
|
4614
|
+
|
|
4615
|
+
|
|
4616
|
+
|
|
4459
4617
|
|
|
4460
4618
|
|
|
4461
4619
|
|
|
@@ -4536,6 +4694,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4536
4694
|
|
|
4537
4695
|
|
|
4538
4696
|
|
|
4697
|
+
|
|
4698
|
+
|
|
4699
|
+
|
|
4700
|
+
|
|
4539
4701
|
|
|
4540
4702
|
|
|
4541
4703
|
|
|
@@ -4631,6 +4793,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4631
4793
|
|
|
4632
4794
|
|
|
4633
4795
|
|
|
4796
|
+
|
|
4797
|
+
|
|
4798
|
+
|
|
4799
|
+
|
|
4634
4800
|
|
|
4635
4801
|
|
|
4636
4802
|
|
|
@@ -4681,6 +4847,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4681
4847
|
|
|
4682
4848
|
|
|
4683
4849
|
|
|
4850
|
+
|
|
4851
|
+
|
|
4852
|
+
|
|
4853
|
+
|
|
4684
4854
|
|
|
4685
4855
|
|
|
4686
4856
|
|
|
@@ -4801,6 +4971,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4801
4971
|
|
|
4802
4972
|
|
|
4803
4973
|
|
|
4974
|
+
|
|
4975
|
+
|
|
4976
|
+
|
|
4977
|
+
|
|
4804
4978
|
|
|
4805
4979
|
|
|
4806
4980
|
|
|
@@ -4943,6 +5117,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4943
5117
|
|
|
4944
5118
|
|
|
4945
5119
|
|
|
5120
|
+
|
|
5121
|
+
|
|
5122
|
+
|
|
5123
|
+
|
|
4946
5124
|
|
|
4947
5125
|
|
|
4948
5126
|
|
|
@@ -5007,6 +5185,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
5007
5185
|
|
|
5008
5186
|
|
|
5009
5187
|
|
|
5188
|
+
|
|
5189
|
+
|
|
5190
|
+
|
|
5191
|
+
|
|
5010
5192
|
|
|
5011
5193
|
|
|
5012
5194
|
|
|
@@ -5053,6 +5235,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
5053
5235
|
|
|
5054
5236
|
|
|
5055
5237
|
|
|
5238
|
+
|
|
5239
|
+
|
|
5240
|
+
|
|
5241
|
+
|
|
5056
5242
|
|
|
5057
5243
|
|
|
5058
5244
|
|
package/dist/esm-legacy/hash.mjs
CHANGED
|
@@ -184,18 +184,11 @@ var _IterableEntryBase = class _IterableEntryBase {
|
|
|
184
184
|
__name(_IterableEntryBase, "IterableEntryBase");
|
|
185
185
|
var IterableEntryBase = _IterableEntryBase;
|
|
186
186
|
|
|
187
|
-
// src/utils/utils.ts
|
|
188
|
-
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
189
|
-
if (index < min || index > max) {
|
|
190
|
-
throw new RangeError(message != null ? message : `Index ${index} is out of range [${min}, ${max}].`);
|
|
191
|
-
}
|
|
192
|
-
}, "rangeCheck");
|
|
193
|
-
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
194
|
-
const inputType = typeof input;
|
|
195
|
-
return inputType === "object" && input !== null || inputType === "function";
|
|
196
|
-
}, "isWeakKey");
|
|
197
|
-
|
|
198
187
|
// src/common/error.ts
|
|
188
|
+
function raise(ErrorClass, message) {
|
|
189
|
+
throw new ErrorClass(message);
|
|
190
|
+
}
|
|
191
|
+
__name(raise, "raise");
|
|
199
192
|
var ERR = {
|
|
200
193
|
// Range / index
|
|
201
194
|
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
@@ -217,9 +210,22 @@ var ERR = {
|
|
|
217
210
|
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
218
211
|
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
219
212
|
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
220
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
213
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
214
|
+
// Order statistic
|
|
215
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
221
216
|
};
|
|
222
217
|
|
|
218
|
+
// src/utils/utils.ts
|
|
219
|
+
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
220
|
+
if (index < min || index > max) {
|
|
221
|
+
throw new RangeError(message != null ? message : `Index ${index} is out of range [${min}, ${max}].`);
|
|
222
|
+
}
|
|
223
|
+
}, "rangeCheck");
|
|
224
|
+
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
225
|
+
const inputType = typeof input;
|
|
226
|
+
return inputType === "object" && input !== null || inputType === "function";
|
|
227
|
+
}, "isWeakKey");
|
|
228
|
+
|
|
223
229
|
// src/data-structures/hash/hash-map.ts
|
|
224
230
|
var _HashMap = class _HashMap extends IterableEntryBase {
|
|
225
231
|
/**
|
|
@@ -311,6 +317,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
311
317
|
|
|
312
318
|
|
|
313
319
|
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
314
324
|
|
|
315
325
|
|
|
316
326
|
|
|
@@ -352,6 +362,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
352
362
|
|
|
353
363
|
|
|
354
364
|
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
355
369
|
|
|
356
370
|
|
|
357
371
|
|
|
@@ -435,6 +449,14 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
435
449
|
|
|
436
450
|
|
|
437
451
|
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
438
460
|
|
|
439
461
|
|
|
440
462
|
|
|
@@ -503,6 +525,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
503
525
|
|
|
504
526
|
|
|
505
527
|
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
506
532
|
|
|
507
533
|
|
|
508
534
|
|
|
@@ -555,6 +581,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
555
581
|
|
|
556
582
|
|
|
557
583
|
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
558
588
|
|
|
559
589
|
|
|
560
590
|
|
|
@@ -619,6 +649,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
619
649
|
|
|
620
650
|
|
|
621
651
|
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
622
656
|
|
|
623
657
|
|
|
624
658
|
|
|
@@ -667,6 +701,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
667
701
|
|
|
668
702
|
|
|
669
703
|
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
670
708
|
|
|
671
709
|
|
|
672
710
|
|
|
@@ -733,6 +771,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
733
771
|
|
|
734
772
|
|
|
735
773
|
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
736
778
|
|
|
737
779
|
|
|
738
780
|
|
|
@@ -782,6 +824,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
782
824
|
|
|
783
825
|
|
|
784
826
|
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
785
831
|
|
|
786
832
|
|
|
787
833
|
|
|
@@ -833,6 +879,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
833
879
|
|
|
834
880
|
|
|
835
881
|
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
836
886
|
|
|
837
887
|
|
|
838
888
|
|
|
@@ -938,9 +988,7 @@ var _LinkedHashMap = class _LinkedHashMap extends IterableEntryBase {
|
|
|
938
988
|
if (this.isEntry(rawElement)) {
|
|
939
989
|
return rawElement;
|
|
940
990
|
}
|
|
941
|
-
|
|
942
|
-
ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap")
|
|
943
|
-
);
|
|
991
|
+
raise(TypeError, ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap"));
|
|
944
992
|
}, "_toEntryFn"));
|
|
945
993
|
__publicField(this, "_size", 0);
|
|
946
994
|
this._sentinel = {};
|