directed-graph-typed 2.5.3 → 2.6.0
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/dist/cjs/index.cjs +147 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +147 -0
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +147 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +147 -0
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
- package/dist/types/data-structures/heap/heap.d.ts +42 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
- package/dist/types/data-structures/queue/deque.d.ts +90 -1
- package/dist/types/data-structures/queue/queue.d.ts +36 -0
- package/dist/types/data-structures/stack/stack.d.ts +30 -0
- package/dist/types/data-structures/trie/trie.d.ts +36 -0
- package/dist/umd/directed-graph-typed.js +147 -0
- package/dist/umd/directed-graph-typed.js.map +1 -1
- package/dist/umd/directed-graph-typed.min.js +1 -1
- package/dist/umd/directed-graph-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +36 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +42 -0
- package/src/data-structures/binary-tree/binary-tree.ts +75 -0
- package/src/data-structures/binary-tree/bst.ts +72 -0
- package/src/data-structures/binary-tree/red-black-tree.ts +57 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +375 -0
- package/src/data-structures/binary-tree/tree-multi-map.ts +392 -0
- package/src/data-structures/binary-tree/tree-multi-set.ts +336 -0
- package/src/data-structures/binary-tree/tree-set.ts +492 -0
- 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 +33 -0
- package/src/data-structures/heap/heap.ts +42 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +90 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +54 -0
- package/src/data-structures/matrix/matrix.ts +24 -0
- package/src/data-structures/queue/deque.ts +103 -1
- 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 +36 -0
|
@@ -253,6 +253,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
253
253
|
|
|
254
254
|
|
|
255
255
|
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
256
259
|
|
|
257
260
|
|
|
258
261
|
|
|
@@ -311,6 +314,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
311
314
|
|
|
312
315
|
|
|
313
316
|
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
314
320
|
|
|
315
321
|
|
|
316
322
|
|
|
@@ -364,6 +370,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
364
370
|
|
|
365
371
|
|
|
366
372
|
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
367
376
|
|
|
368
377
|
|
|
369
378
|
|
|
@@ -413,6 +422,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
413
422
|
|
|
414
423
|
|
|
415
424
|
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
416
428
|
|
|
417
429
|
|
|
418
430
|
|
|
@@ -461,6 +473,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
461
473
|
|
|
462
474
|
|
|
463
475
|
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
464
479
|
|
|
465
480
|
|
|
466
481
|
|
|
@@ -512,6 +527,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
512
527
|
|
|
513
528
|
|
|
514
529
|
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
515
533
|
|
|
516
534
|
|
|
517
535
|
|
|
@@ -588,6 +606,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
588
606
|
|
|
589
607
|
|
|
590
608
|
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
591
612
|
|
|
592
613
|
|
|
593
614
|
|
|
@@ -647,6 +668,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
647
668
|
|
|
648
669
|
|
|
649
670
|
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
650
674
|
|
|
651
675
|
|
|
652
676
|
|
|
@@ -700,6 +724,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
700
724
|
|
|
701
725
|
|
|
702
726
|
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
703
730
|
|
|
704
731
|
|
|
705
732
|
|
|
@@ -753,6 +780,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
753
780
|
|
|
754
781
|
|
|
755
782
|
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
756
786
|
|
|
757
787
|
|
|
758
788
|
|
|
@@ -803,6 +833,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
803
833
|
|
|
804
834
|
|
|
805
835
|
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
806
839
|
|
|
807
840
|
|
|
808
841
|
|
|
@@ -848,6 +881,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
848
881
|
|
|
849
882
|
|
|
850
883
|
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
851
887
|
|
|
852
888
|
|
|
853
889
|
|
|
@@ -435,6 +435,35 @@ var directedGraphTyped = (() => {
|
|
|
435
435
|
for (const ele of this) if (ele === element) return true;
|
|
436
436
|
return false;
|
|
437
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* Check whether a value exists (Array-compatible alias for `has`).
|
|
440
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
441
|
+
* @param element - Element to search for (uses `===`).
|
|
442
|
+
* @returns `true` if found.
|
|
443
|
+
*/
|
|
444
|
+
includes(element) {
|
|
445
|
+
return this.has(element);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
449
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
450
|
+
*/
|
|
451
|
+
*entries() {
|
|
452
|
+
let index = 0;
|
|
453
|
+
for (const value of this) {
|
|
454
|
+
yield [index++, value];
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Return an iterator of numeric indices (Array-compatible).
|
|
459
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
460
|
+
*/
|
|
461
|
+
*keys() {
|
|
462
|
+
let index = 0;
|
|
463
|
+
for (const _ of this) {
|
|
464
|
+
yield index++;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
438
467
|
/**
|
|
439
468
|
* Reduces all elements to a single accumulated value.
|
|
440
469
|
*
|
|
@@ -694,6 +723,16 @@ var directedGraphTyped = (() => {
|
|
|
694
723
|
}
|
|
695
724
|
return this;
|
|
696
725
|
}
|
|
726
|
+
/**
|
|
727
|
+
* Return a new instance of the same type with elements in reverse order (non-mutating).
|
|
728
|
+
* @remarks Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O(n), Space O(n).
|
|
729
|
+
* @returns A new reversed instance.
|
|
730
|
+
*/
|
|
731
|
+
toReversed() {
|
|
732
|
+
const cloned = this.clone();
|
|
733
|
+
cloned.reverse();
|
|
734
|
+
return cloned;
|
|
735
|
+
}
|
|
697
736
|
};
|
|
698
737
|
|
|
699
738
|
// src/data-structures/heap/heap.ts
|
|
@@ -771,6 +810,9 @@ var directedGraphTyped = (() => {
|
|
|
771
810
|
|
|
772
811
|
|
|
773
812
|
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
774
816
|
|
|
775
817
|
|
|
776
818
|
|
|
@@ -862,6 +904,9 @@ var directedGraphTyped = (() => {
|
|
|
862
904
|
|
|
863
905
|
|
|
864
906
|
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
865
910
|
|
|
866
911
|
|
|
867
912
|
|
|
@@ -923,6 +968,9 @@ var directedGraphTyped = (() => {
|
|
|
923
968
|
|
|
924
969
|
|
|
925
970
|
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
926
974
|
|
|
927
975
|
|
|
928
976
|
|
|
@@ -1017,6 +1065,9 @@ var directedGraphTyped = (() => {
|
|
|
1017
1065
|
*/
|
|
1018
1066
|
/**
|
|
1019
1067
|
* @deprecated Use `pop` instead. Will be removed in a future major version.
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
|
|
1020
1071
|
* @example
|
|
1021
1072
|
* // Heap with custom comparator (MaxHeap behavior)
|
|
1022
1073
|
* interface Task {
|
|
@@ -1100,6 +1151,9 @@ var directedGraphTyped = (() => {
|
|
|
1100
1151
|
|
|
1101
1152
|
|
|
1102
1153
|
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1103
1157
|
|
|
1104
1158
|
|
|
1105
1159
|
|
|
@@ -1204,6 +1258,9 @@ var directedGraphTyped = (() => {
|
|
|
1204
1258
|
|
|
1205
1259
|
|
|
1206
1260
|
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1207
1264
|
|
|
1208
1265
|
|
|
1209
1266
|
|
|
@@ -1255,6 +1312,9 @@ var directedGraphTyped = (() => {
|
|
|
1255
1312
|
|
|
1256
1313
|
|
|
1257
1314
|
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1258
1318
|
|
|
1259
1319
|
|
|
1260
1320
|
|
|
@@ -1299,6 +1359,9 @@ var directedGraphTyped = (() => {
|
|
|
1299
1359
|
|
|
1300
1360
|
|
|
1301
1361
|
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1302
1365
|
|
|
1303
1366
|
|
|
1304
1367
|
|
|
@@ -1350,6 +1413,9 @@ var directedGraphTyped = (() => {
|
|
|
1350
1413
|
|
|
1351
1414
|
|
|
1352
1415
|
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1353
1419
|
|
|
1354
1420
|
|
|
1355
1421
|
|
|
@@ -1453,6 +1519,9 @@ var directedGraphTyped = (() => {
|
|
|
1453
1519
|
|
|
1454
1520
|
|
|
1455
1521
|
|
|
1522
|
+
|
|
1523
|
+
|
|
1524
|
+
|
|
1456
1525
|
|
|
1457
1526
|
|
|
1458
1527
|
|
|
@@ -1537,6 +1606,9 @@ var directedGraphTyped = (() => {
|
|
|
1537
1606
|
|
|
1538
1607
|
|
|
1539
1608
|
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
|
|
1540
1612
|
|
|
1541
1613
|
|
|
1542
1614
|
|
|
@@ -1594,6 +1666,9 @@ var directedGraphTyped = (() => {
|
|
|
1594
1666
|
|
|
1595
1667
|
|
|
1596
1668
|
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
|
|
1597
1672
|
|
|
1598
1673
|
|
|
1599
1674
|
|
|
@@ -1650,6 +1725,9 @@ var directedGraphTyped = (() => {
|
|
|
1650
1725
|
|
|
1651
1726
|
|
|
1652
1727
|
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
|
|
1653
1731
|
|
|
1654
1732
|
|
|
1655
1733
|
|
|
@@ -1713,6 +1791,9 @@ var directedGraphTyped = (() => {
|
|
|
1713
1791
|
|
|
1714
1792
|
|
|
1715
1793
|
|
|
1794
|
+
|
|
1795
|
+
|
|
1796
|
+
|
|
1716
1797
|
|
|
1717
1798
|
|
|
1718
1799
|
|
|
@@ -1918,6 +1999,9 @@ var directedGraphTyped = (() => {
|
|
|
1918
1999
|
|
|
1919
2000
|
|
|
1920
2001
|
|
|
2002
|
+
|
|
2003
|
+
|
|
2004
|
+
|
|
1921
2005
|
|
|
1922
2006
|
|
|
1923
2007
|
|
|
@@ -1972,6 +2056,9 @@ var directedGraphTyped = (() => {
|
|
|
1972
2056
|
|
|
1973
2057
|
|
|
1974
2058
|
|
|
2059
|
+
|
|
2060
|
+
|
|
2061
|
+
|
|
1975
2062
|
|
|
1976
2063
|
|
|
1977
2064
|
|
|
@@ -2050,6 +2137,9 @@ var directedGraphTyped = (() => {
|
|
|
2050
2137
|
|
|
2051
2138
|
|
|
2052
2139
|
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
|
|
2053
2143
|
|
|
2054
2144
|
|
|
2055
2145
|
|
|
@@ -2116,6 +2206,9 @@ var directedGraphTyped = (() => {
|
|
|
2116
2206
|
|
|
2117
2207
|
|
|
2118
2208
|
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
|
|
2119
2212
|
|
|
2120
2213
|
|
|
2121
2214
|
|
|
@@ -2189,6 +2282,9 @@ var directedGraphTyped = (() => {
|
|
|
2189
2282
|
|
|
2190
2283
|
|
|
2191
2284
|
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
|
|
2192
2288
|
|
|
2193
2289
|
|
|
2194
2290
|
|
|
@@ -2252,6 +2348,9 @@ var directedGraphTyped = (() => {
|
|
|
2252
2348
|
|
|
2253
2349
|
|
|
2254
2350
|
|
|
2351
|
+
|
|
2352
|
+
|
|
2353
|
+
|
|
2255
2354
|
|
|
2256
2355
|
|
|
2257
2356
|
|
|
@@ -2308,6 +2407,9 @@ var directedGraphTyped = (() => {
|
|
|
2308
2407
|
|
|
2309
2408
|
|
|
2310
2409
|
|
|
2410
|
+
|
|
2411
|
+
|
|
2412
|
+
|
|
2311
2413
|
|
|
2312
2414
|
|
|
2313
2415
|
|
|
@@ -2420,6 +2522,9 @@ var directedGraphTyped = (() => {
|
|
|
2420
2522
|
|
|
2421
2523
|
|
|
2422
2524
|
|
|
2525
|
+
|
|
2526
|
+
|
|
2527
|
+
|
|
2423
2528
|
|
|
2424
2529
|
|
|
2425
2530
|
|
|
@@ -2470,6 +2575,9 @@ var directedGraphTyped = (() => {
|
|
|
2470
2575
|
|
|
2471
2576
|
|
|
2472
2577
|
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
|
|
2473
2581
|
|
|
2474
2582
|
|
|
2475
2583
|
|
|
@@ -2543,6 +2651,9 @@ var directedGraphTyped = (() => {
|
|
|
2543
2651
|
|
|
2544
2652
|
|
|
2545
2653
|
|
|
2654
|
+
|
|
2655
|
+
|
|
2656
|
+
|
|
2546
2657
|
|
|
2547
2658
|
|
|
2548
2659
|
|
|
@@ -2600,6 +2711,9 @@ var directedGraphTyped = (() => {
|
|
|
2600
2711
|
|
|
2601
2712
|
|
|
2602
2713
|
|
|
2714
|
+
|
|
2715
|
+
|
|
2716
|
+
|
|
2603
2717
|
|
|
2604
2718
|
|
|
2605
2719
|
|
|
@@ -2661,6 +2775,9 @@ var directedGraphTyped = (() => {
|
|
|
2661
2775
|
|
|
2662
2776
|
|
|
2663
2777
|
|
|
2778
|
+
|
|
2779
|
+
|
|
2780
|
+
|
|
2664
2781
|
|
|
2665
2782
|
|
|
2666
2783
|
|
|
@@ -3795,6 +3912,9 @@ var directedGraphTyped = (() => {
|
|
|
3795
3912
|
|
|
3796
3913
|
|
|
3797
3914
|
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
|
|
3798
3918
|
|
|
3799
3919
|
|
|
3800
3920
|
|
|
@@ -3887,6 +4007,9 @@ var directedGraphTyped = (() => {
|
|
|
3887
4007
|
|
|
3888
4008
|
|
|
3889
4009
|
|
|
4010
|
+
|
|
4011
|
+
|
|
4012
|
+
|
|
3890
4013
|
|
|
3891
4014
|
|
|
3892
4015
|
|
|
@@ -3977,6 +4100,9 @@ var directedGraphTyped = (() => {
|
|
|
3977
4100
|
|
|
3978
4101
|
|
|
3979
4102
|
|
|
4103
|
+
|
|
4104
|
+
|
|
4105
|
+
|
|
3980
4106
|
|
|
3981
4107
|
|
|
3982
4108
|
|
|
@@ -4058,6 +4184,9 @@ var directedGraphTyped = (() => {
|
|
|
4058
4184
|
|
|
4059
4185
|
|
|
4060
4186
|
|
|
4187
|
+
|
|
4188
|
+
|
|
4189
|
+
|
|
4061
4190
|
|
|
4062
4191
|
|
|
4063
4192
|
|
|
@@ -4116,6 +4245,9 @@ var directedGraphTyped = (() => {
|
|
|
4116
4245
|
|
|
4117
4246
|
|
|
4118
4247
|
|
|
4248
|
+
|
|
4249
|
+
|
|
4250
|
+
|
|
4119
4251
|
|
|
4120
4252
|
|
|
4121
4253
|
|
|
@@ -4227,6 +4359,9 @@ var directedGraphTyped = (() => {
|
|
|
4227
4359
|
|
|
4228
4360
|
|
|
4229
4361
|
|
|
4362
|
+
|
|
4363
|
+
|
|
4364
|
+
|
|
4230
4365
|
|
|
4231
4366
|
|
|
4232
4367
|
|
|
@@ -4319,6 +4454,9 @@ var directedGraphTyped = (() => {
|
|
|
4319
4454
|
|
|
4320
4455
|
|
|
4321
4456
|
|
|
4457
|
+
|
|
4458
|
+
|
|
4459
|
+
|
|
4322
4460
|
|
|
4323
4461
|
|
|
4324
4462
|
|
|
@@ -4373,6 +4511,9 @@ var directedGraphTyped = (() => {
|
|
|
4373
4511
|
|
|
4374
4512
|
|
|
4375
4513
|
|
|
4514
|
+
|
|
4515
|
+
|
|
4516
|
+
|
|
4376
4517
|
|
|
4377
4518
|
|
|
4378
4519
|
|
|
@@ -4480,6 +4621,9 @@ var directedGraphTyped = (() => {
|
|
|
4480
4621
|
|
|
4481
4622
|
|
|
4482
4623
|
|
|
4624
|
+
|
|
4625
|
+
|
|
4626
|
+
|
|
4483
4627
|
|
|
4484
4628
|
|
|
4485
4629
|
|
|
@@ -4590,6 +4734,9 @@ var directedGraphTyped = (() => {
|
|
|
4590
4734
|
|
|
4591
4735
|
|
|
4592
4736
|
|
|
4737
|
+
|
|
4738
|
+
|
|
4739
|
+
|
|
4593
4740
|
|
|
4594
4741
|
|
|
4595
4742
|
|