data-structure-typed 1.21.2 → 1.21.3
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/README.md +10 -13
- package/dist/bundle.js +1 -1
- package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +3 -3
- package/dist/data-structures/binary-tree/abstract-binary-tree.js +1 -1
- package/dist/data-structures/binary-tree/avl-tree.d.ts +2 -2
- package/dist/data-structures/binary-tree/binary-tree.d.ts +2 -2
- package/dist/data-structures/binary-tree/bst.d.ts +3 -3
- package/dist/data-structures/binary-tree/bst.js +1 -1
- package/dist/data-structures/binary-tree/rb-tree.d.ts +2 -2
- package/dist/data-structures/binary-tree/rb-tree.js +1 -1
- package/dist/data-structures/binary-tree/segment-tree.d.ts +1 -1
- package/dist/data-structures/binary-tree/tree-multiset.d.ts +3 -3
- package/dist/data-structures/binary-tree/tree-multiset.js +1 -1
- package/dist/data-structures/graph/abstract-graph.d.ts +8 -8
- package/dist/data-structures/graph/abstract-graph.js +6 -6
- package/dist/data-structures/graph/directed-graph.d.ts +2 -2
- package/dist/data-structures/graph/map-graph.d.ts +1 -1
- package/dist/data-structures/graph/undirected-graph.d.ts +2 -2
- package/dist/data-structures/heap/heap.d.ts +1 -1
- package/dist/data-structures/heap/heap.js +1 -1
- package/dist/data-structures/heap/max-heap.d.ts +1 -1
- package/dist/data-structures/heap/min-heap.d.ts +1 -1
- package/dist/data-structures/index.d.ts +0 -2
- package/dist/data-structures/index.js +0 -2
- package/dist/data-structures/matrix/navigator.d.ts +1 -1
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +1 -1
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +1 -1
- package/dist/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/{data-structures/interfaces → interfaces}/abstract-binary-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/avl-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/binary-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/bst.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/rb-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/tree-multiset.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/abstract-binary-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/avl-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/binary-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/bst.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/index.d.ts +0 -1
- package/dist/{data-structures/types → types/data-structures}/index.js +0 -1
- package/dist/{data-structures/types → types/data-structures}/rb-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/tree-multiset.d.ts +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +19 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/utils/utils.d.ts +1 -1
- package/package.json +21 -24
- package/.dependency-cruiser.js +0 -449
- package/dist/utils/validate-type.d.ts +0 -45
- package/dist/utils/validate-type.js +0 -58
- package/jest.config.js +0 -5
- package/rename_clear_files.sh +0 -29
- package/tsconfig.json +0 -38
- package/webpack.config.js +0 -27
- /package/dist/{data-structures/interfaces → interfaces}/abstract-binary-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/abstract-graph.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/abstract-graph.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/avl-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/binary-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/bst.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/directed-graph.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/directed-graph.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/doubly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/doubly-linked-list.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/heap.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/heap.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/index.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/index.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/navigator.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/navigator.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/priority-queue.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/priority-queue.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/rb-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/segment-tree.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/segment-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/singly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/singly-linked-list.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/tree-multiset.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/undirected-graph.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/undirected-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/abstract-binary-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/abstract-graph.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/abstract-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/avl-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/binary-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/bst.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/directed-graph.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/directed-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/doubly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/doubly-linked-list.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/heap.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/heap.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/map-graph.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/map-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/navigator.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/navigator.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/priority-queue.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/priority-queue.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/rb-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/segment-tree.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/segment-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/singly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/singly-linked-list.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/tree-multiset.js +0 -0
- /package/dist/{data-structures/types → types}/helpers.d.ts +0 -0
- /package/dist/{data-structures/types → types}/helpers.js +0 -0
- /package/dist/{utils/types → types/utils}/index.d.ts +0 -0
- /package/dist/{utils/types → types/utils}/index.js +0 -0
- /package/dist/{utils/types → types/utils}/utils.d.ts +0 -0
- /package/dist/{utils/types → types/utils}/utils.js +0 -0
- /package/dist/{utils/types → types/utils}/validate-type.d.ts +0 -0
- /package/dist/{utils/types → types/utils}/validate-type.js +0 -0
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { BinaryTreeNodeId, BinaryTreeNodeNested, BinaryTreeOptions } from '
|
|
8
|
+
import type { BinaryTreeNodeId, BinaryTreeNodeNested, BinaryTreeOptions } from '../../types';
|
|
9
9
|
import { AbstractBinaryTree, AbstractBinaryTreeNode } from './abstract-binary-tree';
|
|
10
|
-
import { IBinaryTree, IBinaryTreeNode } from '
|
|
10
|
+
import { IBinaryTree, IBinaryTreeNode } from '../../interfaces';
|
|
11
11
|
export declare class BinaryTreeNode<T = any, NEIGHBOR extends BinaryTreeNode<T, NEIGHBOR> = BinaryTreeNodeNested<T>> extends AbstractBinaryTreeNode<T, NEIGHBOR> implements IBinaryTreeNode<T, NEIGHBOR> {
|
|
12
12
|
constructor(id: BinaryTreeNodeId, val?: T);
|
|
13
13
|
}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { BinaryTreeNodeId, BinaryTreeNodePropertyName, BSTComparator, BSTNodeNested, BSTOptions } from '
|
|
9
|
-
import { CP } from '
|
|
8
|
+
import type { BinaryTreeNodeId, BinaryTreeNodePropertyName, BSTComparator, BSTNodeNested, BSTOptions } from '../../types';
|
|
9
|
+
import { CP } from '../../types';
|
|
10
10
|
import { BinaryTree, BinaryTreeNode } from './binary-tree';
|
|
11
|
-
import { IBST, IBSTNode } from '
|
|
11
|
+
import { IBST, IBSTNode } from '../../interfaces';
|
|
12
12
|
export declare class BSTNode<T = any, NEIGHBOR extends BSTNode<T, NEIGHBOR> = BSTNodeNested<T>> extends BinaryTreeNode<T, NEIGHBOR> implements IBSTNode<T, NEIGHBOR> {
|
|
13
13
|
constructor(id: BinaryTreeNodeId, val?: T);
|
|
14
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BST = exports.BSTNode = void 0;
|
|
4
|
-
const types_1 = require("
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
5
|
const binary_tree_1 = require("./binary-tree");
|
|
6
6
|
class BSTNode extends binary_tree_1.BinaryTreeNode {
|
|
7
7
|
constructor(id, val) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BinaryTreeNodeId, RBColor, RBTreeNodeNested, RBTreeOptions } from '
|
|
2
|
-
import { IRBTree, IRBTreeNode } from '
|
|
1
|
+
import { BinaryTreeNodeId, RBColor, RBTreeNodeNested, RBTreeOptions } from '../../types';
|
|
2
|
+
import { IRBTree, IRBTreeNode } from '../../interfaces/rb-tree';
|
|
3
3
|
import { BST, BSTNode } from './bst';
|
|
4
4
|
export declare class RBTreeNode<T = any, NEIGHBOR extends RBTreeNode<T, NEIGHBOR> = RBTreeNodeNested<T>> extends BSTNode<T, NEIGHBOR> implements IRBTreeNode<T, NEIGHBOR> {
|
|
5
5
|
constructor(id: BinaryTreeNodeId, val?: T, color?: RBColor);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RBTree = exports.RBTreeNode = void 0;
|
|
4
|
-
const types_1 = require("
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
5
|
const bst_1 = require("./bst");
|
|
6
6
|
class RBTreeNode extends bst_1.BSTNode {
|
|
7
7
|
constructor(id, val, color = types_1.RBColor.RED) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { SegmentTreeNodeVal } from '
|
|
8
|
+
import type { SegmentTreeNodeVal } from '../../types';
|
|
9
9
|
export declare class SegmentTreeNode {
|
|
10
10
|
constructor(start: number, end: number, sum: number, val?: SegmentTreeNodeVal | null);
|
|
11
11
|
private _start;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { BinaryTreeNodeId, TreeMultisetNodeNested, TreeMultisetOptions } from '
|
|
9
|
-
import { BinaryTreeDeletedResult, DFSOrderPattern, NodeOrPropertyName } from '
|
|
10
|
-
import { ITreeMultiset, ITreeMultisetNode } from '
|
|
8
|
+
import type { BinaryTreeNodeId, TreeMultisetNodeNested, TreeMultisetOptions } from '../../types';
|
|
9
|
+
import { BinaryTreeDeletedResult, DFSOrderPattern, NodeOrPropertyName } from '../../types';
|
|
10
|
+
import { ITreeMultiset, ITreeMultisetNode } from '../../interfaces';
|
|
11
11
|
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
12
12
|
export declare class TreeMultisetNode<T = any, NEIGHBOR extends TreeMultisetNode<T, NEIGHBOR> = TreeMultisetNodeNested<T>> extends AVLTreeNode<T, NEIGHBOR> implements ITreeMultisetNode<T, NEIGHBOR> {
|
|
13
13
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TreeMultiset = exports.TreeMultisetNode = void 0;
|
|
4
|
-
const types_1 = require("
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
5
|
const avl_tree_1 = require("./avl-tree");
|
|
6
6
|
class TreeMultisetNode extends avl_tree_1.AVLTreeNode {
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DijkstraResult, VertexId } from '
|
|
2
|
-
import { IAbstractGraph } from '
|
|
1
|
+
import type { DijkstraResult, VertexId } from '../../types';
|
|
2
|
+
import { IAbstractGraph } from '../../interfaces';
|
|
3
3
|
export declare abstract class AbstractVertex<T = any> {
|
|
4
4
|
/**
|
|
5
5
|
* The function is a protected constructor that takes an id and an optional value as parameters.
|
|
@@ -173,7 +173,7 @@ export declare abstract class AbstractGraph<V extends AbstractVertex<any> = Abst
|
|
|
173
173
|
/**
|
|
174
174
|
* Dijkstra algorithm time: O(VE) space: O(V + E)
|
|
175
175
|
* /
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
/**
|
|
178
178
|
* Dijkstra algorithm time: O(VE) space: O(V + E)
|
|
179
179
|
* The function `dijkstraWithoutHeap` implements Dijkstra's algorithm to find the shortest path between two vertices in
|
|
@@ -200,7 +200,7 @@ export declare abstract class AbstractGraph<V extends AbstractVertex<any> = Abst
|
|
|
200
200
|
* The time complexity of Dijkstra's algorithm and the Bellman-Ford algorithm depends on the size of the graph, while the time complexity of the Floyd-Warshall algorithm is O(V^3), where V is the number of nodes. For dense graphs, Floyd-Warshall might become slower.
|
|
201
201
|
*
|
|
202
202
|
* /
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
/**
|
|
205
205
|
* Dijkstra's algorithm is used to find the shortest paths from a source node to all other nodes in a graph. Its basic idea is to repeatedly choose the node closest to the source node and update the distances of other nodes using this node as an intermediary. Dijkstra's algorithm requires that the edge weights in the graph are non-negative.
|
|
206
206
|
* The `dijkstra` function implements Dijkstra's algorithm to find the shortest path between a source vertex and an
|
|
@@ -223,7 +223,7 @@ export declare abstract class AbstractGraph<V extends AbstractVertex<any> = Abst
|
|
|
223
223
|
* BellmanFord time:O(VE) space:O(V)
|
|
224
224
|
* one to rest pairs
|
|
225
225
|
* /
|
|
226
|
-
|
|
226
|
+
|
|
227
227
|
/**
|
|
228
228
|
* BellmanFord time:O(VE) space:O(V)
|
|
229
229
|
* one to rest pairs
|
|
@@ -251,7 +251,7 @@ export declare abstract class AbstractGraph<V extends AbstractVertex<any> = Abst
|
|
|
251
251
|
/**
|
|
252
252
|
* Dijkstra algorithm time: O(logVE) space: O(V + E)
|
|
253
253
|
* /
|
|
254
|
-
|
|
254
|
+
|
|
255
255
|
/**
|
|
256
256
|
* Dijkstra algorithm time: O(logVE) space: O(V + E)
|
|
257
257
|
* Dijkstra's algorithm is used to find the shortest paths from a source node to all other nodes in a graph. Its basic idea is to repeatedly choose the node closest to the source node and update the distances of other nodes using this node as an intermediary. Dijkstra's algorithm requires that the edge weights in the graph are non-negative.
|
|
@@ -271,7 +271,7 @@ export declare abstract class AbstractGraph<V extends AbstractVertex<any> = Abst
|
|
|
271
271
|
* Floyd algorithm time: O(V^3) space: O(V^2), not support graph with negative weight cycle
|
|
272
272
|
* all pairs
|
|
273
273
|
* /
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
/**
|
|
276
276
|
* Floyd algorithm time: O(V^3) space: O(V^2), not support graph with negative weight cycle
|
|
277
277
|
* all pairs
|
|
@@ -294,7 +294,7 @@ export declare abstract class AbstractGraph<V extends AbstractVertex<any> = Abst
|
|
|
294
294
|
* Tarjan solve the bi-connected components of undirected graphs;
|
|
295
295
|
* Tarjan can find the SSC(strongly connected components), articulation points, and bridges of directed graphs.
|
|
296
296
|
* /
|
|
297
|
-
|
|
297
|
+
|
|
298
298
|
/**
|
|
299
299
|
* Tarjan is an algorithm based on DFS,which is used to solve the connectivity problem of graphs.
|
|
300
300
|
* Tarjan can find cycles in directed or undirected graph
|
|
@@ -357,7 +357,7 @@ class AbstractGraph {
|
|
|
357
357
|
/**
|
|
358
358
|
* Dijkstra algorithm time: O(VE) space: O(V + E)
|
|
359
359
|
* /
|
|
360
|
-
|
|
360
|
+
|
|
361
361
|
/**
|
|
362
362
|
* Dijkstra algorithm time: O(VE) space: O(V + E)
|
|
363
363
|
* The function `dijkstraWithoutHeap` implements Dijkstra's algorithm to find the shortest path between two vertices in
|
|
@@ -484,7 +484,7 @@ class AbstractGraph {
|
|
|
484
484
|
* The time complexity of Dijkstra's algorithm and the Bellman-Ford algorithm depends on the size of the graph, while the time complexity of the Floyd-Warshall algorithm is O(V^3), where V is the number of nodes. For dense graphs, Floyd-Warshall might become slower.
|
|
485
485
|
*
|
|
486
486
|
* /
|
|
487
|
-
|
|
487
|
+
|
|
488
488
|
/**
|
|
489
489
|
* Dijkstra's algorithm is used to find the shortest paths from a source node to all other nodes in a graph. Its basic idea is to repeatedly choose the node closest to the source node and update the distances of other nodes using this node as an intermediary. Dijkstra's algorithm requires that the edge weights in the graph are non-negative.
|
|
490
490
|
* The `dijkstra` function implements Dijkstra's algorithm to find the shortest path between a source vertex and an
|
|
@@ -608,7 +608,7 @@ class AbstractGraph {
|
|
|
608
608
|
* BellmanFord time:O(VE) space:O(V)
|
|
609
609
|
* one to rest pairs
|
|
610
610
|
* /
|
|
611
|
-
|
|
611
|
+
|
|
612
612
|
/**
|
|
613
613
|
* BellmanFord time:O(VE) space:O(V)
|
|
614
614
|
* one to rest pairs
|
|
@@ -713,7 +713,7 @@ class AbstractGraph {
|
|
|
713
713
|
/**
|
|
714
714
|
* Dijkstra algorithm time: O(logVE) space: O(V + E)
|
|
715
715
|
* /
|
|
716
|
-
|
|
716
|
+
|
|
717
717
|
/**
|
|
718
718
|
* Dijkstra algorithm time: O(logVE) space: O(V + E)
|
|
719
719
|
* Dijkstra's algorithm is used to find the shortest paths from a source node to all other nodes in a graph. Its basic idea is to repeatedly choose the node closest to the source node and update the distances of other nodes using this node as an intermediary. Dijkstra's algorithm requires that the edge weights in the graph are non-negative.
|
|
@@ -733,7 +733,7 @@ class AbstractGraph {
|
|
|
733
733
|
* Floyd algorithm time: O(V^3) space: O(V^2), not support graph with negative weight cycle
|
|
734
734
|
* all pairs
|
|
735
735
|
* /
|
|
736
|
-
|
|
736
|
+
|
|
737
737
|
/**
|
|
738
738
|
* Floyd algorithm time: O(V^3) space: O(V^2), not support graph with negative weight cycle
|
|
739
739
|
* all pairs
|
|
@@ -783,7 +783,7 @@ class AbstractGraph {
|
|
|
783
783
|
* Tarjan solve the bi-connected components of undirected graphs;
|
|
784
784
|
* Tarjan can find the SSC(strongly connected components), articulation points, and bridges of directed graphs.
|
|
785
785
|
* /
|
|
786
|
-
|
|
786
|
+
|
|
787
787
|
/**
|
|
788
788
|
* Tarjan is an algorithm based on DFS,which is used to solve the connectivity problem of graphs.
|
|
789
789
|
* Tarjan can find cycles in directed or undirected graph
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractEdge, AbstractGraph, AbstractVertex } from './abstract-graph';
|
|
2
|
-
import type { VertexId } from '
|
|
3
|
-
import { IDirectedGraph } from '
|
|
2
|
+
import type { VertexId } from '../../types';
|
|
3
|
+
import { IDirectedGraph } from '../../interfaces';
|
|
4
4
|
export declare class DirectedVertex<T = number> extends AbstractVertex<T> {
|
|
5
5
|
/**
|
|
6
6
|
* The constructor function initializes a vertex with an optional value.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MapGraphCoordinate, VertexId } from '
|
|
1
|
+
import { MapGraphCoordinate, VertexId } from '../../types';
|
|
2
2
|
import { DirectedEdge, DirectedGraph, DirectedVertex } from './directed-graph';
|
|
3
3
|
export declare class MapVertex<T = any> extends DirectedVertex<T> {
|
|
4
4
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractEdge, AbstractGraph, AbstractVertex } from './abstract-graph';
|
|
2
|
-
import type { VertexId } from '
|
|
3
|
-
import { IUNDirectedGraph } from '
|
|
2
|
+
import type { VertexId } from '../../types';
|
|
3
|
+
import { IUNDirectedGraph } from '../../interfaces';
|
|
4
4
|
export declare class UndirectedVertex<T = number> extends AbstractVertex<T> {
|
|
5
5
|
/**
|
|
6
6
|
* The constructor function initializes a vertex with an optional value.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
import { PriorityQueue } from '../priority-queue';
|
|
9
|
-
import type { HeapOptions } from '
|
|
9
|
+
import type { HeapOptions } from '../../types';
|
|
10
10
|
export declare class HeapItem<T = number> {
|
|
11
11
|
/**
|
|
12
12
|
* The constructor function initializes an instance of a class with a priority and a value.
|
|
@@ -9,7 +9,7 @@ class HeapItem {
|
|
|
9
9
|
* @param {T | null} [val=null] - The `val` parameter is of type `T | null`, which means it can accept a value of type
|
|
10
10
|
* `T` or `null`.
|
|
11
11
|
*/
|
|
12
|
-
constructor(priority =
|
|
12
|
+
constructor(priority = Number.MAX_SAFE_INTEGER, val = null) {
|
|
13
13
|
this._val = val;
|
|
14
14
|
this._priority = priority;
|
|
15
15
|
}
|
|
@@ -25,5 +25,3 @@ __exportStar(require("./heap"), exports);
|
|
|
25
25
|
__exportStar(require("./priority-queue"), exports);
|
|
26
26
|
__exportStar(require("./matrix"), exports);
|
|
27
27
|
__exportStar(require("./trie"), exports);
|
|
28
|
-
__exportStar(require("./interfaces"), exports);
|
|
29
|
-
__exportStar(require("./types"), exports);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { Direction, NavigatorParams, Turning } from '
|
|
8
|
+
import type { Direction, NavigatorParams, Turning } from '../../types';
|
|
9
9
|
export declare class Character {
|
|
10
10
|
direction: Direction;
|
|
11
11
|
turn: () => Character;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
import { PriorityQueue } from './priority-queue';
|
|
9
|
-
import type { PriorityQueueOptions } from '
|
|
9
|
+
import type { PriorityQueueOptions } from '../../types';
|
|
10
10
|
export declare class MaxPriorityQueue<T = number> extends PriorityQueue<T> {
|
|
11
11
|
constructor(options?: Omit<PriorityQueueOptions<number>, 'comparator'>);
|
|
12
12
|
constructor(options: PriorityQueueOptions<T>);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
import { PriorityQueue } from './priority-queue';
|
|
9
|
-
import type { PriorityQueueOptions } from '
|
|
9
|
+
import type { PriorityQueueOptions } from '../../types';
|
|
10
10
|
export declare class MinPriorityQueue<T = number> extends PriorityQueue<T> {
|
|
11
11
|
constructor(options?: Omit<PriorityQueueOptions<number>, 'comparator'>);
|
|
12
12
|
constructor(options: PriorityQueueOptions<T>);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { PriorityQueueComparator, PriorityQueueDFSOrderPattern, PriorityQueueOptions } from '
|
|
8
|
+
import type { PriorityQueueComparator, PriorityQueueDFSOrderPattern, PriorityQueueOptions } from '../../types';
|
|
9
9
|
export declare class PriorityQueue<T = number> {
|
|
10
10
|
/**
|
|
11
11
|
* The constructor initializes a priority queue with the given options, including an array of nodes and a comparator
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./data-structures"), exports);
|
|
18
18
|
__exportStar(require("./utils"), exports);
|
|
19
|
+
__exportStar(require("./interfaces"), exports);
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractBinaryTreeNodeProperties, AbstractBinaryTreeNodeProperty, BinaryTreeDeletedResult, BinaryTreeNodeId, BinaryTreeNodePropertyName, DFSOrderPattern, FamilyPosition, LoopType, NodeOrPropertyName } from '../types';
|
|
2
|
-
import { AbstractBinaryTreeNode } from '../
|
|
2
|
+
import { AbstractBinaryTreeNode } from '../data-structures';
|
|
3
3
|
export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {
|
|
4
4
|
get id(): BinaryTreeNodeId;
|
|
5
5
|
set id(v: BinaryTreeNodeId);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AVLTreeNode } from '../
|
|
1
|
+
import { AVLTreeNode } from '../data-structures';
|
|
2
2
|
import { IBST, IBSTNode } from './bst';
|
|
3
3
|
import { BinaryTreeDeletedResult, BinaryTreeNodeId } from '../types';
|
|
4
4
|
export interface IAVLTreeNode<T, NEIGHBOR extends IAVLTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BinaryTreeNode } from '../
|
|
1
|
+
import { BinaryTreeNode } from '../data-structures';
|
|
2
2
|
import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from './abstract-binary-tree';
|
|
3
3
|
export interface IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> extends IAbstractBinaryTreeNode<T, NEIGHBOR> {
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BSTNode } from '../
|
|
1
|
+
import { BSTNode } from '../data-structures';
|
|
2
2
|
import { IBinaryTree, IBinaryTreeNode } from './binary-tree';
|
|
3
3
|
import { BinaryTreeDeletedResult, BinaryTreeNodeId, BinaryTreeNodePropertyName } from '../types';
|
|
4
4
|
export interface IBSTNode<T, NEIGHBOR extends IBSTNode<T, NEIGHBOR>> extends IBinaryTreeNode<T, NEIGHBOR> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RBTreeNode } from '../
|
|
1
|
+
import { RBTreeNode } from '../data-structures';
|
|
2
2
|
import { IBST, IBSTNode } from './bst';
|
|
3
3
|
import { BinaryTreeNodeId } from '../types';
|
|
4
4
|
export interface IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TreeMultisetNode } from '../
|
|
1
|
+
import { TreeMultisetNode } from '../data-structures';
|
|
2
2
|
import { IBSTNode } from './bst';
|
|
3
3
|
import { IAVLTree } from './avl-tree';
|
|
4
4
|
export interface ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AVLTreeNode } from '
|
|
1
|
+
import { AVLTreeNode } from '../../data-structures/binary-tree';
|
|
2
2
|
import { BSTOptions } from './bst';
|
|
3
3
|
export type AVLTreeNodeNested<T> = AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
4
|
export type AVLTreeOptions = BSTOptions & {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BinaryTreeNode } from '
|
|
1
|
+
import { BinaryTreeNode } from '../../data-structures/binary-tree';
|
|
2
2
|
import { AbstractBinaryTreeOptions } from './abstract-binary-tree';
|
|
3
3
|
export type BinaryTreeNodeNested<T> = BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
4
|
export type BinaryTreeOptions = AbstractBinaryTreeOptions & {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BSTNode } from '
|
|
1
|
+
import { BSTNode } from '../../data-structures/binary-tree';
|
|
2
2
|
import type { BinaryTreeOptions } from './binary-tree';
|
|
3
3
|
import { BinaryTreeNodeId } from './abstract-binary-tree';
|
|
4
4
|
export type BSTComparator = (a: BinaryTreeNodeId, b: BinaryTreeNodeId) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TreeMultisetNode } from '
|
|
1
|
+
import { TreeMultisetNode } from '../../data-structures/binary-tree';
|
|
2
2
|
import { AVLTreeOptions } from './avl-tree';
|
|
3
3
|
export type TreeMultisetNodeNested<T> = TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
4
|
export type TreeMultisetOptions = Omit<AVLTreeOptions, 'isMergeDuplicatedNodeById'> & {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./data-structures"), exports);
|
|
18
|
+
__exportStar(require("./helpers"), exports);
|
|
19
|
+
__exportStar(require("./utils"), exports);
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -15,5 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./utils"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
__exportStar(require("./validate-type"), exports);
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { Thunk, ToThunkFn, TrlAsyncFn, TrlFn } from '
|
|
8
|
+
import type { Thunk, ToThunkFn, TrlAsyncFn, TrlFn } from '../types';
|
|
9
9
|
export declare const uuidV4: () => string;
|
|
10
10
|
export declare const arrayRemove: <T>(array: T[], predicate: (item: T, index: number, array: T[]) => boolean) => T[];
|
|
11
11
|
export declare const THUNK_SYMBOL: unique symbol;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-structure-typed",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.3",
|
|
4
4
|
"description": "Javascript & TypeScript Data Structure Library, meticulously crafted to empower developers with a versatile set of essential data structures. Our library includes a wide range of data structures, such as Binary Tree, AVL Tree, Binary Search Tree (BST), Tree Multiset, Segment Tree, Binary Indexed Tree, Graph, Directed Graph, Undirected Graph, Singly Linked List, Hash, CoordinateSet, CoordinateMap, Heap, Doubly Linked List, Priority Queue, Max Priority Queue, Min Priority Queue, Queue, ObjectDeque, ArrayDeque, Stack, and Trie. Each data structure is thoughtfully designed and implemented using TypeScript to provide efficient, reliable, and easy-to-use solutions for your programming needs. Whether you're optimizing algorithms, managing data, or enhancing performance, our TypeScript Data Structure Library is your go-to resource. Elevate your coding experience with these fundamental building blocks for software development.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "rm -rf dist && npx tsc && npm run build:browser",
|
|
10
10
|
"build:browser": "webpack",
|
|
11
|
+
"build:docs": "typedoc --out docs ./src",
|
|
11
12
|
"test": "jest",
|
|
12
13
|
"update:test-deps": "npm i avl-tree-typed binary-tree-typed bst-typed deque-typed directed-graph-typed doubly-linked-list-typed graph-typed heap-typed linked-list-typed max-heap-typed max-priority-queue-typed min-heap-typed min-priority-queue-typed priority-queue-typed singly-linked-list-typed stack-typed tree-multiset-typed trie-typed undirected-graph-typed --save-dev",
|
|
13
|
-
"build:docs": "typedoc --out docs ./src",
|
|
14
14
|
"deps:check": "dependency-cruiser src",
|
|
15
15
|
"build:publish": "npm run test && npm run build && npm run build:docs && npm publish"
|
|
16
16
|
},
|
|
@@ -61,35 +61,32 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/jest": "^29.5.3",
|
|
63
63
|
"@types/node": "^20.4.9",
|
|
64
|
-
"avl-tree-typed": "^1.21.
|
|
65
|
-
"binary-tree-typed": "^1.21.
|
|
66
|
-
"bst-typed": "^1.21.
|
|
64
|
+
"avl-tree-typed": "^1.21.2",
|
|
65
|
+
"binary-tree-typed": "^1.21.2",
|
|
66
|
+
"bst-typed": "^1.21.2",
|
|
67
67
|
"dependency-cruiser": "^13.1.2",
|
|
68
|
-
"deque-typed": "^1.21.
|
|
69
|
-
"directed-graph-typed": "^1.21.
|
|
70
|
-
"doubly-linked-list-typed": "^1.21.
|
|
71
|
-
"graph-typed": "^1.21.
|
|
72
|
-
"heap-typed": "^1.21.
|
|
68
|
+
"deque-typed": "^1.21.2",
|
|
69
|
+
"directed-graph-typed": "^1.21.2",
|
|
70
|
+
"doubly-linked-list-typed": "^1.21.2",
|
|
71
|
+
"graph-typed": "^1.21.2",
|
|
72
|
+
"heap-typed": "^1.21.2",
|
|
73
73
|
"jest": "^29.6.2",
|
|
74
|
-
"linked-list-typed": "^1.21.
|
|
75
|
-
"max-heap-typed": "^1.21.
|
|
76
|
-
"max-priority-queue-typed": "^1.21.
|
|
77
|
-
"min-heap-typed": "^1.21.
|
|
78
|
-
"min-priority-queue-typed": "^1.21.
|
|
79
|
-
"priority-queue-typed": "^1.21.
|
|
80
|
-
"singly-linked-list-typed": "^1.21.
|
|
81
|
-
"stack-typed": "^1.21.
|
|
82
|
-
"tree-multiset-typed": "^1.21.
|
|
83
|
-
"trie-typed": "^1.21.
|
|
74
|
+
"linked-list-typed": "^1.21.2",
|
|
75
|
+
"max-heap-typed": "^1.21.2",
|
|
76
|
+
"max-priority-queue-typed": "^1.21.2",
|
|
77
|
+
"min-heap-typed": "^1.21.2",
|
|
78
|
+
"min-priority-queue-typed": "^1.21.2",
|
|
79
|
+
"priority-queue-typed": "^1.21.2",
|
|
80
|
+
"singly-linked-list-typed": "^1.21.2",
|
|
81
|
+
"stack-typed": "^1.21.2",
|
|
82
|
+
"tree-multiset-typed": "^1.21.2",
|
|
83
|
+
"trie-typed": "^1.21.2",
|
|
84
84
|
"ts-jest": "^29.1.1",
|
|
85
85
|
"ts-loader": "^9.4.4",
|
|
86
86
|
"typedoc": "^0.24.8",
|
|
87
87
|
"typescript": "^4.9.5",
|
|
88
|
-
"undirected-graph-typed": "^1.21.
|
|
88
|
+
"undirected-graph-typed": "^1.21.2",
|
|
89
89
|
"webpack": "^5.88.2",
|
|
90
90
|
"webpack-cli": "^5.1.4"
|
|
91
|
-
},
|
|
92
|
-
"dependencies": {
|
|
93
|
-
"zod": "^3.22.2"
|
|
94
91
|
}
|
|
95
92
|
}
|