graph-typed 2.5.0 → 2.5.1

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 (75) hide show
  1. package/dist/cjs/index.cjs +1213 -268
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +1202 -257
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +1213 -268
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +1202 -257
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/base/index.d.ts +1 -0
  10. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  11. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  12. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +252 -0
  13. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +294 -0
  14. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +527 -2
  15. package/dist/types/data-structures/binary-tree/bst.d.ts +505 -1
  16. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +399 -0
  17. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +126 -1
  18. package/dist/types/data-structures/binary-tree/tree-map.d.ts +2881 -382
  19. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2867 -347
  20. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2328 -312
  21. package/dist/types/data-structures/binary-tree/tree-set.d.ts +2671 -277
  22. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  23. package/dist/types/data-structures/graph/directed-graph.d.ts +210 -0
  24. package/dist/types/data-structures/graph/undirected-graph.d.ts +189 -0
  25. package/dist/types/data-structures/hash/hash-map.d.ts +241 -10
  26. package/dist/types/data-structures/heap/heap.d.ts +294 -0
  27. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +360 -3
  28. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +318 -3
  29. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +380 -2
  30. package/dist/types/data-structures/matrix/matrix.d.ts +168 -0
  31. package/dist/types/data-structures/queue/deque.d.ts +319 -4
  32. package/dist/types/data-structures/queue/queue.d.ts +252 -0
  33. package/dist/types/data-structures/stack/stack.d.ts +210 -0
  34. package/dist/types/data-structures/trie/trie.d.ts +256 -4
  35. package/dist/types/interfaces/graph.d.ts +1 -1
  36. package/dist/types/types/common.d.ts +2 -2
  37. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  38. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  39. package/dist/types/types/utils/validate-type.d.ts +4 -4
  40. package/dist/umd/graph-typed.js +1204 -259
  41. package/dist/umd/graph-typed.js.map +1 -1
  42. package/dist/umd/graph-typed.min.js +3 -3
  43. package/dist/umd/graph-typed.min.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/data-structures/base/index.ts +1 -0
  46. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  47. package/src/data-structures/base/linear-base.ts +3 -3
  48. package/src/data-structures/binary-tree/avl-tree.ts +252 -0
  49. package/src/data-structures/binary-tree/binary-indexed-tree.ts +295 -1
  50. package/src/data-structures/binary-tree/binary-tree.ts +527 -2
  51. package/src/data-structures/binary-tree/bst.ts +505 -1
  52. package/src/data-structures/binary-tree/red-black-tree.ts +399 -0
  53. package/src/data-structures/binary-tree/segment-tree.ts +127 -2
  54. package/src/data-structures/binary-tree/tree-map.ts +2958 -459
  55. package/src/data-structures/binary-tree/tree-multi-map.ts +3069 -549
  56. package/src/data-structures/binary-tree/tree-multi-set.ts +2476 -460
  57. package/src/data-structures/binary-tree/tree-set.ts +2816 -422
  58. package/src/data-structures/graph/abstract-graph.ts +4 -4
  59. package/src/data-structures/graph/directed-graph.ts +210 -0
  60. package/src/data-structures/graph/undirected-graph.ts +189 -0
  61. package/src/data-structures/hash/hash-map.ts +246 -15
  62. package/src/data-structures/heap/heap.ts +294 -0
  63. package/src/data-structures/linked-list/doubly-linked-list.ts +360 -3
  64. package/src/data-structures/linked-list/singly-linked-list.ts +318 -3
  65. package/src/data-structures/linked-list/skip-linked-list.ts +380 -2
  66. package/src/data-structures/matrix/matrix.ts +169 -1
  67. package/src/data-structures/queue/deque.ts +320 -5
  68. package/src/data-structures/queue/queue.ts +252 -0
  69. package/src/data-structures/stack/stack.ts +210 -0
  70. package/src/data-structures/trie/trie.ts +257 -5
  71. package/src/interfaces/graph.ts +1 -1
  72. package/src/types/common.ts +2 -2
  73. package/src/types/data-structures/heap/heap.ts +1 -0
  74. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  75. package/src/types/utils/validate-type.ts +4 -4
@@ -477,6 +477,198 @@ var _IterableElementBase = class _IterableElementBase {
477
477
  __name(_IterableElementBase, "IterableElementBase");
478
478
  var IterableElementBase = _IterableElementBase;
479
479
 
480
+ // src/data-structures/base/linear-base.ts
481
+ var _LinearBase = class _LinearBase extends IterableElementBase {
482
+ /**
483
+ * Construct a linear container with runtime options.
484
+ * @param options - `{ maxLen?, ... }` bounds/behavior options.
485
+ * @remarks Time O(1), Space O(1)
486
+ */
487
+ constructor(options) {
488
+ super(options);
489
+ __publicField(this, "_maxLen", -1);
490
+ if (options) {
491
+ const { maxLen } = options;
492
+ if (typeof maxLen === "number" && maxLen > 0 && maxLen % 1 === 0) this._maxLen = maxLen;
493
+ }
494
+ }
495
+ /**
496
+ * Upper bound for length (if positive), or `-1` when unbounded.
497
+ * @returns Maximum allowed length.
498
+ * @remarks Time O(1), Space O(1)
499
+ */
500
+ get maxLen() {
501
+ return this._maxLen;
502
+ }
503
+ /**
504
+ * First index of a value from the left.
505
+ * @param searchElement - Value to match.
506
+ * @param fromIndex - Start position (supports negative index).
507
+ * @returns Index or `-1` if not found.
508
+ * @remarks Time O(n), Space O(1)
509
+ */
510
+ indexOf(searchElement, fromIndex = 0) {
511
+ if (this.length === 0) return -1;
512
+ if (fromIndex < 0) fromIndex = this.length + fromIndex;
513
+ if (fromIndex < 0) fromIndex = 0;
514
+ for (let i = fromIndex; i < this.length; i++) {
515
+ const element = this.at(i);
516
+ if (element === searchElement) return i;
517
+ }
518
+ return -1;
519
+ }
520
+ /**
521
+ * Last index of a value from the right.
522
+ * @param searchElement - Value to match.
523
+ * @param fromIndex - Start position (supports negative index).
524
+ * @returns Index or `-1` if not found.
525
+ * @remarks Time O(n), Space O(1)
526
+ */
527
+ lastIndexOf(searchElement, fromIndex = this.length - 1) {
528
+ if (this.length === 0) return -1;
529
+ if (fromIndex >= this.length) fromIndex = this.length - 1;
530
+ if (fromIndex < 0) fromIndex = this.length + fromIndex;
531
+ for (let i = fromIndex; i >= 0; i--) {
532
+ const element = this.at(i);
533
+ if (element === searchElement) return i;
534
+ }
535
+ return -1;
536
+ }
537
+ /**
538
+ * Find the first index matching a predicate.
539
+ * @param predicate - `(element, index, self) => boolean`.
540
+ * @param thisArg - Optional `this` for callback.
541
+ * @returns Index or `-1`.
542
+ * @remarks Time O(n), Space O(1)
543
+ */
544
+ findIndex(predicate, thisArg) {
545
+ for (let i = 0; i < this.length; i++) {
546
+ const item = this.at(i);
547
+ if (item !== void 0 && predicate.call(thisArg, item, i, this)) return i;
548
+ }
549
+ return -1;
550
+ }
551
+ /**
552
+ * Concatenate elements and/or containers.
553
+ * @param items - Elements or other containers.
554
+ * @returns New container with combined elements (`this` type).
555
+ * @remarks Time O(sum(length)), Space O(sum(length))
556
+ */
557
+ concat(...items) {
558
+ const newList = this.clone();
559
+ for (const item of items) {
560
+ if (item instanceof _LinearBase) {
561
+ newList.pushMany(item);
562
+ } else {
563
+ newList.push(item);
564
+ }
565
+ }
566
+ return newList;
567
+ }
568
+ /**
569
+ * In-place stable order via array sort semantics.
570
+ * @param compareFn - Comparator `(a, b) => number`.
571
+ * @returns This container.
572
+ * @remarks Time O(n log n), Space O(n) (materializes to array temporarily)
573
+ */
574
+ sort(compareFn) {
575
+ const arr = this.toArray();
576
+ arr.sort(compareFn);
577
+ this.clear();
578
+ for (const item of arr) this.push(item);
579
+ return this;
580
+ }
581
+ /**
582
+ * Remove and/or insert elements at a position (array-compatible).
583
+ * @param start - Start index (supports negative index).
584
+ * @param deleteCount - How many to remove.
585
+ * @param items - Elements to insert.
586
+ * @returns Removed elements as a new list (`this` type).
587
+ * @remarks Time O(n + m), Space O(min(n, m)) where `m = items.length`
588
+ */
589
+ splice(start, deleteCount = 0, ...items) {
590
+ const removedList = this._createInstance();
591
+ start = start < 0 ? this.length + start : start;
592
+ start = Math.max(0, Math.min(start, this.length));
593
+ deleteCount = Math.max(0, Math.min(deleteCount, this.length - start));
594
+ for (let i = 0; i < deleteCount; i++) {
595
+ const removed = this.deleteAt(start);
596
+ if (removed !== void 0) {
597
+ removedList.push(removed);
598
+ }
599
+ }
600
+ for (let i = 0; i < items.length; i++) {
601
+ this.addAt(start + i, items[i]);
602
+ }
603
+ return removedList;
604
+ }
605
+ /**
606
+ * Join all elements into a string.
607
+ * @param separator - Separator string.
608
+ * @returns Concatenated string.
609
+ * @remarks Time O(n), Space O(n)
610
+ */
611
+ join(separator = ",") {
612
+ return this.toArray().join(separator);
613
+ }
614
+ /**
615
+ * Snapshot elements into a reversed array.
616
+ * @returns New reversed array.
617
+ * @remarks Time O(n), Space O(n)
618
+ */
619
+ toReversedArray() {
620
+ const array = [];
621
+ for (let i = this.length - 1; i >= 0; i--) {
622
+ array.push(this.at(i));
623
+ }
624
+ return array;
625
+ }
626
+ reduceRight(callbackfn, initialValue) {
627
+ let accumulator = initialValue != null ? initialValue : 0;
628
+ for (let i = this.length - 1; i >= 0; i--) {
629
+ accumulator = callbackfn(accumulator, this.at(i), i, this);
630
+ }
631
+ return accumulator;
632
+ }
633
+ /**
634
+ * Create a shallow copy of a subrange.
635
+ * @param start - Inclusive start (supports negative index).
636
+ * @param end - Exclusive end (supports negative index).
637
+ * @returns New list with the range (`this` type).
638
+ * @remarks Time O(n), Space O(n)
639
+ */
640
+ slice(start = 0, end = this.length) {
641
+ start = start < 0 ? this.length + start : start;
642
+ end = end < 0 ? this.length + end : end;
643
+ const newList = this._createInstance();
644
+ for (let i = start; i < end; i++) {
645
+ newList.push(this.at(i));
646
+ }
647
+ return newList;
648
+ }
649
+ /**
650
+ * Fill a range with a value.
651
+ * @param value - Value to set.
652
+ * @param start - Inclusive start.
653
+ * @param end - Exclusive end.
654
+ * @returns This list.
655
+ * @remarks Time O(n), Space O(1)
656
+ */
657
+ fill(value, start = 0, end = this.length) {
658
+ start = start < 0 ? this.length + start : start;
659
+ end = end < 0 ? this.length + end : end;
660
+ if (start < 0) start = 0;
661
+ if (end > this.length) end = this.length;
662
+ if (start >= end) return this;
663
+ for (let i = start; i < end; i++) {
664
+ this.setAt(i, value);
665
+ }
666
+ return this;
667
+ }
668
+ };
669
+ __name(_LinearBase, "LinearBase");
670
+ var LinearBase = _LinearBase;
671
+
480
672
  // src/data-structures/heap/heap.ts
481
673
  var _Heap = class _Heap extends IterableElementBase {
482
674
  /**
@@ -528,6 +720,27 @@ var _Heap = class _Heap extends IterableElementBase {
528
720
 
529
721
 
530
722
 
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
531
744
  * @example
532
745
  * // Track heap capacity
533
746
  * const heap = new Heap<number>();
@@ -591,6 +804,27 @@ var _Heap = class _Heap extends IterableElementBase {
591
804
 
592
805
 
593
806
 
807
+
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+
822
+
823
+
824
+
825
+
826
+
827
+
594
828
  * @example
595
829
  * // basic Heap creation and add operation
596
830
  * // Create a min heap (default)
@@ -624,6 +858,27 @@ var _Heap = class _Heap extends IterableElementBase {
624
858
 
625
859
 
626
860
 
861
+
862
+
863
+
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+
873
+
874
+
875
+
876
+
877
+
878
+
879
+
880
+
881
+
627
882
  * @example
628
883
  * // Add multiple elements
629
884
  * const heap = new Heap<number>([], { comparator: (a, b) => a - b });
@@ -659,7 +914,28 @@ var _Heap = class _Heap extends IterableElementBase {
659
914
 
660
915
 
661
916
 
662
- * @example
917
+
918
+
919
+
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+ * @example
663
939
  * // Heap with custom comparator (MaxHeap behavior)
664
940
  * interface Task {
665
941
  * id: number;
@@ -710,6 +986,27 @@ var _Heap = class _Heap extends IterableElementBase {
710
986
 
711
987
 
712
988
 
989
+
990
+
991
+
992
+
993
+
994
+
995
+
996
+
997
+
998
+
999
+
1000
+
1001
+
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+
1008
+
1009
+
713
1010
  * @example
714
1011
  * // Heap for event processing with priority
715
1012
  * interface Event {
@@ -786,6 +1083,27 @@ var _Heap = class _Heap extends IterableElementBase {
786
1083
 
787
1084
 
788
1085
 
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
789
1107
  * @example
790
1108
  * // Check if heap is empty
791
1109
  * const heap = new Heap<number>([], { comparator: (a, b) => a - b });
@@ -809,6 +1127,27 @@ var _Heap = class _Heap extends IterableElementBase {
809
1127
 
810
1128
 
811
1129
 
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+
1148
+
1149
+
1150
+
812
1151
  * @example
813
1152
  * // Remove all elements
814
1153
  * const heap = new Heap<number>([1, 2, 3], { comparator: (a, b) => a - b });
@@ -835,6 +1174,27 @@ var _Heap = class _Heap extends IterableElementBase {
835
1174
  * @returns True if found.
836
1175
 
837
1176
 
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+
838
1198
  * @example
839
1199
  * // Check element existence
840
1200
  * const heap = new Heap<number>([3, 1, 2], { comparator: (a, b) => a - b });
@@ -858,6 +1218,27 @@ var _Heap = class _Heap extends IterableElementBase {
858
1218
 
859
1219
 
860
1220
 
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+
1232
+
1233
+
1234
+
1235
+
1236
+
1237
+
1238
+
1239
+
1240
+
1241
+
861
1242
  * @example
862
1243
  * // Remove specific element
863
1244
  * const heap = new Heap<number>([3, 1, 4, 1, 5], { comparator: (a, b) => a - b });
@@ -927,6 +1308,27 @@ var _Heap = class _Heap extends IterableElementBase {
927
1308
  * @returns Array of visited elements.
928
1309
 
929
1310
 
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
930
1332
  * @example
931
1333
  * // Depth-first traversal
932
1334
  * const heap = new Heap<number>([3, 1, 2], { comparator: (a, b) => a - b });
@@ -983,6 +1385,27 @@ var _Heap = class _Heap extends IterableElementBase {
983
1385
 
984
1386
 
985
1387
 
1388
+
1389
+
1390
+
1391
+
1392
+
1393
+
1394
+
1395
+
1396
+
1397
+
1398
+
1399
+
1400
+
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
986
1409
  * @example
987
1410
  * // Sort elements using heap
988
1411
  * const heap = new Heap<number>([5, 1, 3, 2, 4]);
@@ -1012,6 +1435,27 @@ var _Heap = class _Heap extends IterableElementBase {
1012
1435
 
1013
1436
 
1014
1437
 
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+
1457
+
1458
+
1015
1459
  * @example
1016
1460
  * // Create independent copy
1017
1461
  * const heap = new Heap<number>([3, 1, 4], { comparator: (a, b) => a - b });
@@ -1040,6 +1484,27 @@ var _Heap = class _Heap extends IterableElementBase {
1040
1484
 
1041
1485
 
1042
1486
 
1487
+
1488
+
1489
+
1490
+
1491
+
1492
+
1493
+
1494
+
1495
+
1496
+
1497
+
1498
+
1499
+
1500
+
1501
+
1502
+
1503
+
1504
+
1505
+
1506
+
1507
+
1043
1508
  * @example
1044
1509
  * // Filter elements
1045
1510
  * const heap = new Heap<number>([1, 2, 3, 4, 5], { comparator: (a, b) => a - b });
@@ -1075,6 +1540,27 @@ var _Heap = class _Heap extends IterableElementBase {
1075
1540
 
1076
1541
 
1077
1542
 
1543
+
1544
+
1545
+
1546
+
1547
+
1548
+
1549
+
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+
1561
+
1562
+
1563
+
1078
1564
  * @example
1079
1565
  * // Transform elements
1080
1566
  * const heap = new Heap<number>([1, 2, 3], { comparator: (a, b) => a - b });
@@ -1106,277 +1592,85 @@ var _Heap = class _Heap extends IterableElementBase {
1106
1592
  const v = thisArg === void 0 ? callback(x, i++, this) : callback.call(thisArg, x, i++, this);
1107
1593
  out.add(v);
1108
1594
  }
1109
- return out;
1110
- }
1111
- /**
1112
- * Get the comparator used to order elements.
1113
- * @remarks Time O(1), Space O(1)
1114
- * @returns Comparator function.
1115
- */
1116
- get comparator() {
1117
- return this._comparator;
1118
- }
1119
- *_getIterator() {
1120
- for (const element of this.elements) yield element;
1121
- }
1122
- _bubbleUp(index) {
1123
- const element = this.elements[index];
1124
- while (index > 0) {
1125
- const parent = index - 1 >> 1;
1126
- const parentItem = this.elements[parent];
1127
- if (this.comparator(parentItem, element) <= 0) break;
1128
- this.elements[index] = parentItem;
1129
- index = parent;
1130
- }
1131
- this.elements[index] = element;
1132
- return true;
1133
- }
1134
- _sinkDown(index, halfLength) {
1135
- const element = this.elements[index];
1136
- while (index < halfLength) {
1137
- let left = index << 1 | 1;
1138
- const right = left + 1;
1139
- let minItem = this.elements[left];
1140
- if (right < this.elements.length && this.comparator(minItem, this.elements[right]) > 0) {
1141
- left = right;
1142
- minItem = this.elements[right];
1143
- }
1144
- if (this.comparator(minItem, element) >= 0) break;
1145
- this.elements[index] = minItem;
1146
- index = left;
1147
- }
1148
- this.elements[index] = element;
1149
- return true;
1150
- }
1151
- /**
1152
- * (Protected) Create an empty instance of the same concrete class.
1153
- * @remarks Time O(1), Space O(1)
1154
- * @param [options] - Options to override comparator or toElementFn.
1155
- * @returns A like-kind empty heap instance.
1156
- */
1157
- _createInstance(options) {
1158
- const Ctor = this.constructor;
1159
- return new Ctor([], { comparator: this.comparator, toElementFn: this.toElementFn, ...options != null ? options : {} });
1160
- }
1161
- /**
1162
- * (Protected) Create a like-kind instance seeded by elements.
1163
- * @remarks Time O(N log N), Space O(N)
1164
- * @template EM
1165
- * @template RM
1166
- * @param [elements] - Iterable of elements or raw values to seed.
1167
- * @param [options] - Options forwarded to the constructor.
1168
- * @returns A like-kind heap instance.
1169
- */
1170
- _createLike(elements = [], options) {
1171
- const Ctor = this.constructor;
1172
- return new Ctor(elements, options);
1173
- }
1174
- /**
1175
- * (Protected) Spawn an empty like-kind heap instance.
1176
- * @remarks Time O(1), Space O(1)
1177
- * @template EM
1178
- * @template RM
1179
- * @param [options] - Options forwarded to the constructor.
1180
- * @returns An empty like-kind heap instance.
1181
- */
1182
- _spawnLike(options) {
1183
- return this._createLike([], options);
1184
- }
1185
- };
1186
- __name(_Heap, "Heap");
1187
- var Heap = _Heap;
1188
-
1189
- // src/data-structures/base/linear-base.ts
1190
- var _LinearBase = class _LinearBase extends IterableElementBase {
1191
- /**
1192
- * Construct a linear container with runtime options.
1193
- * @param options - `{ maxLen?, ... }` bounds/behavior options.
1194
- * @remarks Time O(1), Space O(1)
1195
- */
1196
- constructor(options) {
1197
- super(options);
1198
- __publicField(this, "_maxLen", -1);
1199
- if (options) {
1200
- const { maxLen } = options;
1201
- if (typeof maxLen === "number" && maxLen > 0 && maxLen % 1 === 0) this._maxLen = maxLen;
1202
- }
1203
- }
1204
- /**
1205
- * Upper bound for length (if positive), or `-1` when unbounded.
1206
- * @returns Maximum allowed length.
1207
- * @remarks Time O(1), Space O(1)
1208
- */
1209
- get maxLen() {
1210
- return this._maxLen;
1211
- }
1212
- /**
1213
- * First index of a value from the left.
1214
- * @param searchElement - Value to match.
1215
- * @param fromIndex - Start position (supports negative index).
1216
- * @returns Index or `-1` if not found.
1217
- * @remarks Time O(n), Space O(1)
1218
- */
1219
- indexOf(searchElement, fromIndex = 0) {
1220
- if (this.length === 0) return -1;
1221
- if (fromIndex < 0) fromIndex = this.length + fromIndex;
1222
- if (fromIndex < 0) fromIndex = 0;
1223
- for (let i = fromIndex; i < this.length; i++) {
1224
- const element = this.at(i);
1225
- if (element === searchElement) return i;
1226
- }
1227
- return -1;
1228
- }
1229
- /**
1230
- * Last index of a value from the right.
1231
- * @param searchElement - Value to match.
1232
- * @param fromIndex - Start position (supports negative index).
1233
- * @returns Index or `-1` if not found.
1234
- * @remarks Time O(n), Space O(1)
1235
- */
1236
- lastIndexOf(searchElement, fromIndex = this.length - 1) {
1237
- if (this.length === 0) return -1;
1238
- if (fromIndex >= this.length) fromIndex = this.length - 1;
1239
- if (fromIndex < 0) fromIndex = this.length + fromIndex;
1240
- for (let i = fromIndex; i >= 0; i--) {
1241
- const element = this.at(i);
1242
- if (element === searchElement) return i;
1243
- }
1244
- return -1;
1245
- }
1246
- /**
1247
- * Find the first index matching a predicate.
1248
- * @param predicate - `(element, index, self) => boolean`.
1249
- * @param thisArg - Optional `this` for callback.
1250
- * @returns Index or `-1`.
1251
- * @remarks Time O(n), Space O(1)
1252
- */
1253
- findIndex(predicate, thisArg) {
1254
- for (let i = 0; i < this.length; i++) {
1255
- const item = this.at(i);
1256
- if (item !== void 0 && predicate.call(thisArg, item, i, this)) return i;
1257
- }
1258
- return -1;
1259
- }
1260
- /**
1261
- * Concatenate elements and/or containers.
1262
- * @param items - Elements or other containers.
1263
- * @returns New container with combined elements (`this` type).
1264
- * @remarks Time O(sum(length)), Space O(sum(length))
1265
- */
1266
- concat(...items) {
1267
- const newList = this.clone();
1268
- for (const item of items) {
1269
- if (item instanceof _LinearBase) {
1270
- newList.pushMany(item);
1271
- } else {
1272
- newList.push(item);
1273
- }
1274
- }
1275
- return newList;
1276
- }
1277
- /**
1278
- * In-place stable order via array sort semantics.
1279
- * @param compareFn - Comparator `(a, b) => number`.
1280
- * @returns This container.
1281
- * @remarks Time O(n log n), Space O(n) (materializes to array temporarily)
1282
- */
1283
- sort(compareFn) {
1284
- const arr = this.toArray();
1285
- arr.sort(compareFn);
1286
- this.clear();
1287
- for (const item of arr) this.push(item);
1288
- return this;
1289
- }
1290
- /**
1291
- * Remove and/or insert elements at a position (array-compatible).
1292
- * @param start - Start index (supports negative index).
1293
- * @param deleteCount - How many to remove.
1294
- * @param items - Elements to insert.
1295
- * @returns Removed elements as a new list (`this` type).
1296
- * @remarks Time O(n + m), Space O(min(n, m)) where `m = items.length`
1297
- */
1298
- splice(start, deleteCount = 0, ...items) {
1299
- const removedList = this._createInstance();
1300
- start = start < 0 ? this.length + start : start;
1301
- start = Math.max(0, Math.min(start, this.length));
1302
- deleteCount = Math.max(0, Math.min(deleteCount, this.length - start));
1303
- for (let i = 0; i < deleteCount; i++) {
1304
- const removed = this.deleteAt(start);
1305
- if (removed !== void 0) {
1306
- removedList.push(removed);
1307
- }
1308
- }
1309
- for (let i = 0; i < items.length; i++) {
1310
- this.addAt(start + i, items[i]);
1311
- }
1312
- return removedList;
1595
+ return out;
1313
1596
  }
1314
1597
  /**
1315
- * Join all elements into a string.
1316
- * @param separator - Separator string.
1317
- * @returns Concatenated string.
1318
- * @remarks Time O(n), Space O(n)
1598
+ * Get the comparator used to order elements.
1599
+ * @remarks Time O(1), Space O(1)
1600
+ * @returns Comparator function.
1319
1601
  */
1320
- join(separator = ",") {
1321
- return this.toArray().join(separator);
1602
+ get comparator() {
1603
+ return this._comparator;
1322
1604
  }
1323
- /**
1324
- * Snapshot elements into a reversed array.
1325
- * @returns New reversed array.
1326
- * @remarks Time O(n), Space O(n)
1327
- */
1328
- toReversedArray() {
1329
- const array = [];
1330
- for (let i = this.length - 1; i >= 0; i--) {
1331
- array.push(this.at(i));
1605
+ *_getIterator() {
1606
+ for (const element of this.elements) yield element;
1607
+ }
1608
+ _bubbleUp(index) {
1609
+ const element = this.elements[index];
1610
+ while (index > 0) {
1611
+ const parent = index - 1 >> 1;
1612
+ const parentItem = this.elements[parent];
1613
+ if (this.comparator(parentItem, element) <= 0) break;
1614
+ this.elements[index] = parentItem;
1615
+ index = parent;
1332
1616
  }
1333
- return array;
1617
+ this.elements[index] = element;
1618
+ return true;
1334
1619
  }
1335
- reduceRight(callbackfn, initialValue) {
1336
- let accumulator = initialValue != null ? initialValue : 0;
1337
- for (let i = this.length - 1; i >= 0; i--) {
1338
- accumulator = callbackfn(accumulator, this.at(i), i, this);
1620
+ _sinkDown(index, halfLength) {
1621
+ const element = this.elements[index];
1622
+ while (index < halfLength) {
1623
+ let left = index << 1 | 1;
1624
+ const right = left + 1;
1625
+ let minItem = this.elements[left];
1626
+ if (right < this.elements.length && this.comparator(minItem, this.elements[right]) > 0) {
1627
+ left = right;
1628
+ minItem = this.elements[right];
1629
+ }
1630
+ if (this.comparator(minItem, element) >= 0) break;
1631
+ this.elements[index] = minItem;
1632
+ index = left;
1339
1633
  }
1340
- return accumulator;
1634
+ this.elements[index] = element;
1635
+ return true;
1341
1636
  }
1342
1637
  /**
1343
- * Create a shallow copy of a subrange.
1344
- * @param start - Inclusive start (supports negative index).
1345
- * @param end - Exclusive end (supports negative index).
1346
- * @returns New list with the range (`this` type).
1347
- * @remarks Time O(n), Space O(n)
1638
+ * (Protected) Create an empty instance of the same concrete class.
1639
+ * @remarks Time O(1), Space O(1)
1640
+ * @param [options] - Options to override comparator or toElementFn.
1641
+ * @returns A like-kind empty heap instance.
1348
1642
  */
1349
- slice(start = 0, end = this.length) {
1350
- start = start < 0 ? this.length + start : start;
1351
- end = end < 0 ? this.length + end : end;
1352
- const newList = this._createInstance();
1353
- for (let i = start; i < end; i++) {
1354
- newList.push(this.at(i));
1355
- }
1356
- return newList;
1643
+ _createInstance(options) {
1644
+ const Ctor = this.constructor;
1645
+ return new Ctor([], { comparator: this.comparator, toElementFn: this.toElementFn, ...options != null ? options : {} });
1357
1646
  }
1358
1647
  /**
1359
- * Fill a range with a value.
1360
- * @param value - Value to set.
1361
- * @param start - Inclusive start.
1362
- * @param end - Exclusive end.
1363
- * @returns This list.
1364
- * @remarks Time O(n), Space O(1)
1648
+ * (Protected) Create a like-kind instance seeded by elements.
1649
+ * @remarks Time O(N log N), Space O(N)
1650
+ * @template EM
1651
+ * @template RM
1652
+ * @param [elements] - Iterable of elements or raw values to seed.
1653
+ * @param [options] - Options forwarded to the constructor.
1654
+ * @returns A like-kind heap instance.
1365
1655
  */
1366
- fill(value, start = 0, end = this.length) {
1367
- start = start < 0 ? this.length + start : start;
1368
- end = end < 0 ? this.length + end : end;
1369
- if (start < 0) start = 0;
1370
- if (end > this.length) end = this.length;
1371
- if (start >= end) return this;
1372
- for (let i = start; i < end; i++) {
1373
- this.setAt(i, value);
1374
- }
1375
- return this;
1656
+ _createLike(elements = [], options) {
1657
+ const Ctor = this.constructor;
1658
+ return new Ctor(elements, options);
1659
+ }
1660
+ /**
1661
+ * (Protected) Spawn an empty like-kind heap instance.
1662
+ * @remarks Time O(1), Space O(1)
1663
+ * @template EM
1664
+ * @template RM
1665
+ * @param [options] - Options forwarded to the constructor.
1666
+ * @returns An empty like-kind heap instance.
1667
+ */
1668
+ _spawnLike(options) {
1669
+ return this._createLike([], options);
1376
1670
  }
1377
1671
  };
1378
- __name(_LinearBase, "LinearBase");
1379
- var LinearBase = _LinearBase;
1672
+ __name(_Heap, "Heap");
1673
+ var Heap = _Heap;
1380
1674
 
1381
1675
  // src/data-structures/queue/queue.ts
1382
1676
  var _Queue = class _Queue extends LinearBase {
@@ -1446,6 +1740,27 @@ var _Queue = class _Queue extends LinearBase {
1446
1740
 
1447
1741
 
1448
1742
 
1743
+
1744
+
1745
+
1746
+
1747
+
1748
+
1749
+
1750
+
1751
+
1752
+
1753
+
1754
+
1755
+
1756
+
1757
+
1758
+
1759
+
1760
+
1761
+
1762
+
1763
+
1449
1764
  * @example
1450
1765
  * // Track queue length
1451
1766
  * const q = new Queue<number>();
@@ -1472,6 +1787,27 @@ var _Queue = class _Queue extends LinearBase {
1472
1787
 
1473
1788
 
1474
1789
 
1790
+
1791
+
1792
+
1793
+
1794
+
1795
+
1796
+
1797
+
1798
+
1799
+
1800
+
1801
+
1802
+
1803
+
1804
+
1805
+
1806
+
1807
+
1808
+
1809
+
1810
+
1475
1811
  * @example
1476
1812
  * // View the front element
1477
1813
  * const q = new Queue<string>(['first', 'second', 'third']);
@@ -1514,6 +1850,27 @@ var _Queue = class _Queue extends LinearBase {
1514
1850
 
1515
1851
 
1516
1852
 
1853
+
1854
+
1855
+
1856
+
1857
+
1858
+
1859
+
1860
+
1861
+
1862
+
1863
+
1864
+
1865
+
1866
+
1867
+
1868
+
1869
+
1870
+
1871
+
1872
+
1873
+
1517
1874
  * @example
1518
1875
  * // Queue for...of iteration and isEmpty check
1519
1876
  * const queue = new Queue<string>(['A', 'B', 'C', 'D']);
@@ -1552,6 +1909,27 @@ var _Queue = class _Queue extends LinearBase {
1552
1909
 
1553
1910
 
1554
1911
 
1912
+
1913
+
1914
+
1915
+
1916
+
1917
+
1918
+
1919
+
1920
+
1921
+
1922
+
1923
+
1924
+
1925
+
1926
+
1927
+
1928
+
1929
+
1930
+
1931
+
1932
+
1555
1933
  * @example
1556
1934
  * // basic Queue creation and push operation
1557
1935
  * // Create a simple Queue with initial values
@@ -1597,6 +1975,27 @@ var _Queue = class _Queue extends LinearBase {
1597
1975
 
1598
1976
 
1599
1977
 
1978
+
1979
+
1980
+
1981
+
1982
+
1983
+
1984
+
1985
+
1986
+
1987
+
1988
+
1989
+
1990
+
1991
+
1992
+
1993
+
1994
+
1995
+
1996
+
1997
+
1998
+
1600
1999
  * @example
1601
2000
  * // Queue shift and peek operations
1602
2001
  * const queue = new Queue<number>([10, 20, 30, 40]);
@@ -1632,6 +2031,27 @@ var _Queue = class _Queue extends LinearBase {
1632
2031
 
1633
2032
 
1634
2033
 
2034
+
2035
+
2036
+
2037
+
2038
+
2039
+
2040
+
2041
+
2042
+
2043
+
2044
+
2045
+
2046
+
2047
+
2048
+
2049
+
2050
+
2051
+
2052
+
2053
+
2054
+
1635
2055
  * @example
1636
2056
  * // Remove specific element
1637
2057
  * const q = new Queue<number>([1, 2, 3, 2]);
@@ -1660,6 +2080,27 @@ var _Queue = class _Queue extends LinearBase {
1660
2080
 
1661
2081
 
1662
2082
 
2083
+
2084
+
2085
+
2086
+
2087
+
2088
+
2089
+
2090
+
2091
+
2092
+
2093
+
2094
+
2095
+
2096
+
2097
+
2098
+
2099
+
2100
+
2101
+
2102
+
2103
+
1663
2104
  * @example
1664
2105
  * // Access element by index
1665
2106
  * const q = new Queue<string>(['a', 'b', 'c']);
@@ -1729,6 +2170,27 @@ var _Queue = class _Queue extends LinearBase {
1729
2170
 
1730
2171
 
1731
2172
 
2173
+
2174
+
2175
+
2176
+
2177
+
2178
+
2179
+
2180
+
2181
+
2182
+
2183
+
2184
+
2185
+
2186
+
2187
+
2188
+
2189
+
2190
+
2191
+
2192
+
2193
+
1732
2194
  * @example
1733
2195
  * // Remove all elements
1734
2196
  * const q = new Queue<number>([1, 2, 3]);
@@ -1751,6 +2213,27 @@ var _Queue = class _Queue extends LinearBase {
1751
2213
 
1752
2214
 
1753
2215
 
2216
+
2217
+
2218
+
2219
+
2220
+
2221
+
2222
+
2223
+
2224
+
2225
+
2226
+
2227
+
2228
+
2229
+
2230
+
2231
+
2232
+
2233
+
2234
+
2235
+
2236
+
1754
2237
  * @example
1755
2238
  * // Reclaim unused memory
1756
2239
  * const q = new Queue<number>([1, 2, 3, 4, 5]);
@@ -1796,6 +2279,27 @@ var _Queue = class _Queue extends LinearBase {
1796
2279
 
1797
2280
 
1798
2281
 
2282
+
2283
+
2284
+
2285
+
2286
+
2287
+
2288
+
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+
2295
+
2296
+
2297
+
2298
+
2299
+
2300
+
2301
+
2302
+
1799
2303
  * @example
1800
2304
  * // Create independent copy
1801
2305
  * const q = new Queue<number>([1, 2, 3]);
@@ -1825,6 +2329,27 @@ var _Queue = class _Queue extends LinearBase {
1825
2329
 
1826
2330
 
1827
2331
 
2332
+
2333
+
2334
+
2335
+
2336
+
2337
+
2338
+
2339
+
2340
+
2341
+
2342
+
2343
+
2344
+
2345
+
2346
+
2347
+
2348
+
2349
+
2350
+
2351
+
2352
+
1828
2353
  * @example
1829
2354
  * // Filter elements
1830
2355
  * const q = new Queue<number>([1, 2, 3, 4, 5]);
@@ -1858,6 +2383,27 @@ var _Queue = class _Queue extends LinearBase {
1858
2383
 
1859
2384
 
1860
2385
 
2386
+
2387
+
2388
+
2389
+
2390
+
2391
+
2392
+
2393
+
2394
+
2395
+
2396
+
2397
+
2398
+
2399
+
2400
+
2401
+
2402
+
2403
+
2404
+
2405
+
2406
+
1861
2407
  * @example
1862
2408
  * // Transform elements
1863
2409
  * const q = new Queue<number>([1, 2, 3]);
@@ -2976,6 +3522,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
2976
3522
 
2977
3523
 
2978
3524
 
3525
+
3526
+
3527
+
3528
+
3529
+
3530
+
3531
+
3532
+
3533
+
3534
+
3535
+
3536
+
3537
+
3538
+
3539
+
3540
+
3541
+
3542
+
3543
+
3544
+
3545
+
2979
3546
  * @example
2980
3547
  * // Get edge between vertices
2981
3548
  * const g = new DirectedGraph();
@@ -3040,6 +3607,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3040
3607
 
3041
3608
 
3042
3609
 
3610
+
3611
+
3612
+
3613
+
3614
+
3615
+
3616
+
3617
+
3618
+
3619
+
3620
+
3621
+
3622
+
3623
+
3624
+
3625
+
3626
+
3627
+
3628
+
3629
+
3630
+
3043
3631
  * @example
3044
3632
  * // DirectedGraph deleteEdge and vertex operations
3045
3633
  * const graph = new DirectedGraph<string>();
@@ -3102,6 +3690,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3102
3690
 
3103
3691
 
3104
3692
 
3693
+
3694
+
3695
+
3696
+
3697
+
3698
+
3699
+
3700
+
3701
+
3702
+
3703
+
3704
+
3705
+
3706
+
3707
+
3708
+
3709
+
3710
+
3711
+
3712
+
3713
+
3105
3714
  * @example
3106
3715
  * // Remove a vertex
3107
3716
  * const g = new DirectedGraph();
@@ -3155,6 +3764,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3155
3764
 
3156
3765
 
3157
3766
 
3767
+
3768
+
3769
+
3770
+
3771
+
3772
+
3773
+
3774
+
3775
+
3776
+
3777
+
3778
+
3779
+
3780
+
3781
+
3782
+
3783
+
3784
+
3785
+
3786
+
3787
+
3158
3788
  * @example
3159
3789
  * // Get incoming edges
3160
3790
  * const g = new DirectedGraph();
@@ -3185,6 +3815,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3185
3815
 
3186
3816
 
3187
3817
 
3818
+
3819
+
3820
+
3821
+
3822
+
3823
+
3824
+
3825
+
3826
+
3827
+
3828
+
3829
+
3830
+
3831
+
3832
+
3833
+
3834
+
3835
+
3836
+
3837
+
3838
+
3188
3839
  * @example
3189
3840
  * // Get outgoing edges
3190
3841
  * const g = new DirectedGraph();
@@ -3268,6 +3919,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3268
3919
 
3269
3920
 
3270
3921
 
3922
+
3923
+
3924
+
3925
+
3926
+
3927
+
3928
+
3929
+
3930
+
3931
+
3932
+
3933
+
3934
+
3935
+
3936
+
3937
+
3938
+
3939
+
3940
+
3941
+
3942
+
3271
3943
  * @example
3272
3944
  * // DirectedGraph topologicalSort for task scheduling
3273
3945
  * const graph = new DirectedGraph<string>();
@@ -3332,6 +4004,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3332
4004
 
3333
4005
 
3334
4006
 
4007
+
4008
+
4009
+
4010
+
4011
+
4012
+
4013
+
4014
+
4015
+
4016
+
4017
+
4018
+
4019
+
4020
+
4021
+
4022
+
4023
+
4024
+
4025
+
4026
+
4027
+
3335
4028
  * @example
3336
4029
  * // Get all edges
3337
4030
  * const g = new DirectedGraph();
@@ -3358,6 +4051,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3358
4051
 
3359
4052
 
3360
4053
 
4054
+
4055
+
4056
+
4057
+
4058
+
4059
+
4060
+
4061
+
4062
+
4063
+
4064
+
4065
+
4066
+
4067
+
4068
+
4069
+
4070
+
4071
+
4072
+
4073
+
4074
+
3361
4075
  * @example
3362
4076
  * // Get outgoing neighbors
3363
4077
  * const g = new DirectedGraph();
@@ -3437,6 +4151,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3437
4151
 
3438
4152
 
3439
4153
 
4154
+
4155
+
4156
+
4157
+
4158
+
4159
+
4160
+
4161
+
4162
+
4163
+
4164
+
4165
+
4166
+
4167
+
4168
+
4169
+
4170
+
4171
+
4172
+
4173
+
4174
+
3440
4175
  * @example
3441
4176
  * // Find strongly connected components
3442
4177
  * const g = new DirectedGraph();
@@ -3519,6 +4254,27 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
3519
4254
 
3520
4255
 
3521
4256
 
4257
+
4258
+
4259
+
4260
+
4261
+
4262
+
4263
+
4264
+
4265
+
4266
+
4267
+
4268
+
4269
+
4270
+
4271
+
4272
+
4273
+
4274
+
4275
+
4276
+
4277
+
3522
4278
  * @example
3523
4279
  * // Get strongly connected components
3524
4280
  * const g = new DirectedGraph();
@@ -3665,6 +4421,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
3665
4421
 
3666
4422
 
3667
4423
 
4424
+
4425
+
4426
+
4427
+
4428
+
4429
+
4430
+
4431
+
4432
+
4433
+
4434
+
4435
+
4436
+
4437
+
4438
+
4439
+
4440
+
4441
+
4442
+
4443
+
4444
+
3668
4445
  * @example
3669
4446
  * // Get edge between vertices
3670
4447
  * const g = new UndirectedGraph();
@@ -3726,6 +4503,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
3726
4503
 
3727
4504
 
3728
4505
 
4506
+
4507
+
4508
+
4509
+
4510
+
4511
+
4512
+
4513
+
4514
+
4515
+
4516
+
4517
+
4518
+
4519
+
4520
+
4521
+
4522
+
4523
+
4524
+
4525
+
4526
+
3729
4527
  * @example
3730
4528
  * // UndirectedGraph deleteEdge and vertex operations
3731
4529
  * const graph = new UndirectedGraph<string>();
@@ -3786,6 +4584,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
3786
4584
 
3787
4585
 
3788
4586
 
4587
+
4588
+
4589
+
4590
+
4591
+
4592
+
4593
+
4594
+
4595
+
4596
+
4597
+
4598
+
4599
+
4600
+
4601
+
4602
+
4603
+
4604
+
4605
+
4606
+
4607
+
3789
4608
  * @example
3790
4609
  * // Remove vertex and edges
3791
4610
  * const g = new UndirectedGraph();
@@ -3861,6 +4680,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
3861
4680
 
3862
4681
 
3863
4682
 
4683
+
4684
+
4685
+
4686
+
4687
+
4688
+
4689
+
4690
+
4691
+
4692
+
4693
+
4694
+
4695
+
4696
+
4697
+
4698
+
4699
+
4700
+
4701
+
4702
+
4703
+
3864
4704
  * @example
3865
4705
  * // Get all edges
3866
4706
  * const g = new UndirectedGraph();
@@ -3891,6 +4731,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
3891
4731
 
3892
4732
 
3893
4733
 
4734
+
4735
+
4736
+
4737
+
4738
+
4739
+
4740
+
4741
+
4742
+
4743
+
4744
+
4745
+
4746
+
4747
+
4748
+
4749
+
4750
+
4751
+
4752
+
4753
+
4754
+
3894
4755
  * @example
3895
4756
  * // UndirectedGraph connectivity and neighbors
3896
4757
  * const graph = new UndirectedGraph<string>();
@@ -3991,6 +4852,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
3991
4852
 
3992
4853
 
3993
4854
 
4855
+
4856
+
4857
+
4858
+
4859
+
4860
+
4861
+
4862
+
4863
+
4864
+
4865
+
4866
+
4867
+
4868
+
4869
+
4870
+
4871
+
4872
+
4873
+
4874
+
4875
+
3994
4876
  * @example
3995
4877
  * // Find articulation points and bridges
3996
4878
  * const g = new UndirectedGraph();
@@ -4113,6 +4995,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
4113
4995
 
4114
4996
 
4115
4997
 
4998
+
4999
+
5000
+
5001
+
5002
+
5003
+
5004
+
5005
+
5006
+
5007
+
5008
+
5009
+
5010
+
5011
+
5012
+
5013
+
5014
+
5015
+
5016
+
5017
+
5018
+
4116
5019
  * @example
4117
5020
  * // Detect cycle
4118
5021
  * const g = new UndirectedGraph();
@@ -4157,6 +5060,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
4157
5060
 
4158
5061
 
4159
5062
 
5063
+
5064
+
5065
+
5066
+
5067
+
5068
+
5069
+
5070
+
5071
+
5072
+
5073
+
5074
+
5075
+
5076
+
5077
+
5078
+
5079
+
5080
+
5081
+
5082
+
5083
+
4160
5084
  * @example
4161
5085
  * // Find bridge edges
4162
5086
  * const g = new UndirectedGraph();
@@ -4183,6 +5107,27 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
4183
5107
 
4184
5108
 
4185
5109
 
5110
+
5111
+
5112
+
5113
+
5114
+
5115
+
5116
+
5117
+
5118
+
5119
+
5120
+
5121
+
5122
+
5123
+
5124
+
5125
+
5126
+
5127
+
5128
+
5129
+
5130
+
4186
5131
  * @example
4187
5132
  * // Find articulation points
4188
5133
  * const g = new UndirectedGraph();