data-structure-typed 1.52.4 → 1.52.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +13 -13
- package/README_zh-CN.md +216 -26
- package/benchmark/report.html +13 -13
- package/benchmark/report.json +158 -158
- package/dist/cjs/data-structures/base/iterable-element-base.d.ts +1 -37
- package/dist/cjs/data-structures/base/iterable-element-base.js +1 -37
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
- package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/cjs/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +299 -331
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/cjs/data-structures/binary-tree/bst.js +12 -44
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/cjs/data-structures/graph/abstract-graph.js +0 -75
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/cjs/data-structures/graph/directed-graph.js +0 -98
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/cjs/data-structures/graph/undirected-graph.js +0 -50
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/cjs/data-structures/hash/hash-map.js +27 -111
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +0 -32
- package/dist/cjs/data-structures/heap/heap.js +0 -32
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +1 -98
- package/dist/cjs/data-structures/queue/deque.js +3 -99
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +1 -54
- package/dist/cjs/data-structures/queue/queue.js +0 -53
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +1 -34
- package/dist/cjs/data-structures/stack/stack.js +1 -34
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/tree/tree.js +0 -1
- package/dist/cjs/data-structures/tree/tree.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +0 -64
- package/dist/cjs/data-structures/trie/trie.js +0 -64
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +6 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/types/utils/utils.d.ts +13 -12
- package/dist/cjs/utils/number.d.ts +13 -0
- package/dist/cjs/utils/number.js +13 -0
- package/dist/cjs/utils/number.js.map +1 -1
- package/dist/cjs/utils/utils.d.ts +125 -3
- package/dist/cjs/utils/utils.js +177 -21
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/mjs/data-structures/base/iterable-element-base.d.ts +1 -37
- package/dist/mjs/data-structures/base/iterable-element-base.js +1 -37
- package/dist/mjs/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/mjs/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +298 -332
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/mjs/data-structures/binary-tree/bst.js +12 -44
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/mjs/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/mjs/data-structures/graph/abstract-graph.js +0 -75
- package/dist/mjs/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/mjs/data-structures/graph/directed-graph.js +0 -98
- package/dist/mjs/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/mjs/data-structures/graph/undirected-graph.js +0 -50
- package/dist/mjs/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/mjs/data-structures/hash/hash-map.js +27 -111
- package/dist/mjs/data-structures/heap/heap.d.ts +0 -32
- package/dist/mjs/data-structures/heap/heap.js +0 -32
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/mjs/data-structures/queue/deque.d.ts +1 -98
- package/dist/mjs/data-structures/queue/deque.js +3 -99
- package/dist/mjs/data-structures/queue/queue.d.ts +1 -54
- package/dist/mjs/data-structures/queue/queue.js +0 -53
- package/dist/mjs/data-structures/stack/stack.d.ts +1 -34
- package/dist/mjs/data-structures/stack/stack.js +1 -34
- package/dist/mjs/data-structures/tree/tree.js +0 -1
- package/dist/mjs/data-structures/trie/trie.d.ts +0 -64
- package/dist/mjs/data-structures/trie/trie.js +0 -64
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +5 -1
- package/dist/mjs/types/utils/utils.d.ts +13 -12
- package/dist/mjs/utils/number.d.ts +13 -0
- package/dist/mjs/utils/number.js +13 -0
- package/dist/mjs/utils/utils.d.ts +125 -3
- package/dist/mjs/utils/utils.js +177 -21
- package/dist/umd/data-structure-typed.js +408 -1474
- package/dist/umd/data-structure-typed.min.js +5 -4
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +6 -6
- package/src/data-structures/base/iterable-element-base.ts +2 -42
- package/src/data-structures/base/iterable-entry-base.ts +3 -62
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +8 -48
- package/src/data-structures/binary-tree/avl-tree.ts +0 -57
- package/src/data-structures/binary-tree/binary-tree.ts +329 -358
- package/src/data-structures/binary-tree/bst.ts +11 -54
- package/src/data-structures/binary-tree/rb-tree.ts +2 -62
- package/src/data-structures/binary-tree/tree-multi-map.ts +8 -48
- package/src/data-structures/graph/abstract-graph.ts +0 -92
- package/src/data-structures/graph/directed-graph.ts +0 -122
- package/src/data-structures/graph/undirected-graph.ts +0 -62
- package/src/data-structures/hash/hash-map.ts +29 -133
- package/src/data-structures/heap/heap.ts +0 -40
- package/src/data-structures/linked-list/doubly-linked-list.ts +5 -112
- package/src/data-structures/linked-list/singly-linked-list.ts +2 -104
- package/src/data-structures/linked-list/skip-linked-list.ts +1 -44
- package/src/data-structures/queue/deque.ts +2 -125
- package/src/data-structures/queue/queue.ts +1 -68
- package/src/data-structures/stack/stack.ts +1 -43
- package/src/data-structures/tree/tree.ts +1 -1
- package/src/data-structures/trie/trie.ts +0 -80
- package/src/types/data-structures/binary-tree/binary-tree.ts +8 -1
- package/src/types/utils/utils.ts +17 -15
- package/src/utils/number.ts +13 -0
- package/src/utils/utils.ts +174 -18
- package/test/config.ts +8 -0
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +13 -13
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +18 -13
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +471 -64
- package/test/unit/data-structures/binary-tree/bst.test.ts +167 -23
- package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +136 -13
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +18 -13
- package/test/unit/data-structures/graph/directed-graph.test.ts +46 -32
- package/test/unit/data-structures/graph/map-graph.test.ts +24 -2
- package/test/unit/data-structures/graph/undirected-graph.test.ts +24 -24
- package/test/unit/data-structures/hash/hash-map.test.ts +225 -35
- package/test/unit/data-structures/heap/heap.test.ts +47 -39
- package/test/unit/data-structures/heap/min-heap.test.ts +5 -5
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +34 -4
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +32 -0
- package/test/unit/data-structures/matrix/matrix.test.ts +35 -5
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +31 -0
- package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +18 -0
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +17 -0
- package/test/unit/data-structures/queue/deque.test.ts +288 -47
- package/test/unit/data-structures/queue/queue.test.ts +62 -37
- package/test/unit/data-structures/stack/stack.test.ts +30 -5
- package/test/unit/data-structures/tree/tree.test.ts +58 -0
- package/test/unit/data-structures/trie/trie.test.ts +46 -5
- package/test/unit/utils/utils.test.ts +169 -0
|
@@ -61,10 +61,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
61
61
|
* @returns a new instance of the `UndirectedEdge` class, which is casted as type `EO`.
|
|
62
62
|
*/
|
|
63
63
|
createEdge(v1: VertexKey, v2: VertexKey, weight?: number, value?: EO['value']): EO;
|
|
64
|
-
/**
|
|
65
|
-
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
66
|
-
* Space Complexity: O(1)
|
|
67
|
-
*/
|
|
68
64
|
/**
|
|
69
65
|
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
70
66
|
* Space Complexity: O(1)
|
|
@@ -77,10 +73,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
77
73
|
* @returns an edge (EO) or undefined.
|
|
78
74
|
*/
|
|
79
75
|
getEdge(v1: VO | VertexKey | undefined, v2: VO | VertexKey | undefined): EO | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
82
|
-
* Space Complexity: O(1)
|
|
83
|
-
*/
|
|
84
76
|
/**
|
|
85
77
|
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
86
78
|
* Space Complexity: O(1)
|
|
@@ -92,10 +84,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
92
84
|
* @returns the removed edge (EO) if it exists, or undefined if either of the endpoints (VO) does not exist.
|
|
93
85
|
*/
|
|
94
86
|
deleteEdgeBetween(v1: VO | VertexKey, v2: VO | VertexKey): EO | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* Time Complexity: O(E), where E is the number of edgeMap incident to the given vertex.
|
|
97
|
-
* Space Complexity: O(1)
|
|
98
|
-
*/
|
|
99
87
|
/**
|
|
100
88
|
* Time Complexity: O(E), where E is the number of edgeMap incident to the given vertex.
|
|
101
89
|
* Space Complexity: O(1)
|
|
@@ -110,10 +98,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
110
98
|
* @returns The `deleteEdge` function returns either the deleted edge object (EO) or `undefined`.
|
|
111
99
|
*/
|
|
112
100
|
deleteEdge(edgeOrOneSideVertexKey: EO | VertexKey, otherSideVertexKey?: VertexKey): EO | undefined;
|
|
113
|
-
/**
|
|
114
|
-
* Time Complexity: O(1) - Constant time for Map operations.
|
|
115
|
-
* Space Complexity: O(1) - Constant space, as it creates only a few variables.
|
|
116
|
-
*/
|
|
117
101
|
/**
|
|
118
102
|
* Time Complexity: O(1) - Constant time for Map operations.
|
|
119
103
|
* Space Complexity: O(1) - Constant space, as it creates only a few variables.
|
|
@@ -124,10 +108,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
124
108
|
* @returns The method is returning a boolean value.
|
|
125
109
|
*/
|
|
126
110
|
deleteVertex(vertexOrKey: VO | VertexKey): boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Time Complexity: O(1)
|
|
129
|
-
* Space Complexity: O(1)
|
|
130
|
-
*/
|
|
131
111
|
/**
|
|
132
112
|
* Time Complexity: O(1)
|
|
133
113
|
* Space Complexity: O(1)
|
|
@@ -139,10 +119,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
139
119
|
* edgeMap connected to that vertex.
|
|
140
120
|
*/
|
|
141
121
|
degreeOf(vertexOrKey: VertexKey | VO): number;
|
|
142
|
-
/**
|
|
143
|
-
* Time Complexity: O(1)
|
|
144
|
-
* Space Complexity: O(1)
|
|
145
|
-
*/
|
|
146
122
|
/**
|
|
147
123
|
* Time Complexity: O(1)
|
|
148
124
|
* Space Complexity: O(1)
|
|
@@ -153,10 +129,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
153
129
|
* @returns an array of edgeMap.
|
|
154
130
|
*/
|
|
155
131
|
edgesOf(vertexOrKey: VertexKey | VO): EO[];
|
|
156
|
-
/**
|
|
157
|
-
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
158
|
-
* Space Complexity: O(|E|)
|
|
159
|
-
*/
|
|
160
132
|
/**
|
|
161
133
|
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
162
134
|
* Space Complexity: O(|E|)
|
|
@@ -165,10 +137,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
165
137
|
* @returns The method `edgeSet()` returns an array of type `EO[]`.
|
|
166
138
|
*/
|
|
167
139
|
edgeSet(): EO[];
|
|
168
|
-
/**
|
|
169
|
-
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
170
|
-
* Space Complexity: O(|E|)
|
|
171
|
-
*/
|
|
172
140
|
/**
|
|
173
141
|
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
174
142
|
* Space Complexity: O(|E|)
|
|
@@ -179,10 +147,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
179
147
|
* @returns an array of vertexMap (VO[]).
|
|
180
148
|
*/
|
|
181
149
|
getNeighbors(vertexOrKey: VO | VertexKey): VO[];
|
|
182
|
-
/**
|
|
183
|
-
* Time Complexity: O(1)
|
|
184
|
-
* Space Complexity: O(1)
|
|
185
|
-
*/
|
|
186
150
|
/**
|
|
187
151
|
* Time Complexity: O(1)
|
|
188
152
|
* Space Complexity: O(1)
|
|
@@ -199,10 +163,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
199
163
|
* @return True if the graph is empty and false otherwise
|
|
200
164
|
*/
|
|
201
165
|
isEmpty(): boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Time Complexity: O(1)
|
|
204
|
-
* Space Complexity: O(1)
|
|
205
|
-
*/
|
|
206
166
|
/**
|
|
207
167
|
* Time Complexity: O(1)
|
|
208
168
|
* Space Complexity: O(1)
|
|
@@ -220,10 +180,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
220
180
|
* @return A new instance of the undirectedgraph class
|
|
221
181
|
*/
|
|
222
182
|
clone(): UndirectedGraph<V, E, VO, EO>;
|
|
223
|
-
/**
|
|
224
|
-
* Time Complexity: O(1)
|
|
225
|
-
* Space Complexity: O(1)
|
|
226
|
-
*/
|
|
227
183
|
/**
|
|
228
184
|
* Time Complexity: O(V + E)
|
|
229
185
|
* Space Complexity: O(V)
|
|
@@ -240,12 +196,6 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
|
|
|
240
196
|
bridges: EO[];
|
|
241
197
|
cutVertices: VO[];
|
|
242
198
|
};
|
|
243
|
-
/**
|
|
244
|
-
* Time Complexity: O(V + E)
|
|
245
|
-
* Space Complexity: O(V)
|
|
246
|
-
* Tarjan is an algorithm based on dfs,which is used to solve the connectivity problem of graphs.
|
|
247
|
-
* 1. Tarjan can find the articulation points and bridges(critical edgeMap) of undirected graphs in linear time
|
|
248
|
-
*/
|
|
249
199
|
/**
|
|
250
200
|
* The function "getBridges" returns an array of bridges in a graph using the Tarjan's algorithm.
|
|
251
201
|
* @returns The function `getBridges()` is returning the bridges found using the Tarjan's algorithm.
|
|
@@ -72,10 +72,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
72
72
|
createEdge(v1, v2, weight, value) {
|
|
73
73
|
return new UndirectedEdge(v1, v2, weight !== null && weight !== void 0 ? weight : 1, value);
|
|
74
74
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
77
|
-
* Space Complexity: O(1)
|
|
78
|
-
*/
|
|
79
75
|
/**
|
|
80
76
|
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
81
77
|
* Space Complexity: O(1)
|
|
@@ -99,10 +95,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
99
95
|
}
|
|
100
96
|
return edgeMap ? edgeMap[0] || undefined : undefined;
|
|
101
97
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
104
|
-
* Space Complexity: O(1)
|
|
105
|
-
*/
|
|
106
98
|
/**
|
|
107
99
|
* Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
|
|
108
100
|
* Space Complexity: O(1)
|
|
@@ -130,10 +122,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
130
122
|
}
|
|
131
123
|
return removed;
|
|
132
124
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Time Complexity: O(E), where E is the number of edgeMap incident to the given vertex.
|
|
135
|
-
* Space Complexity: O(1)
|
|
136
|
-
*/
|
|
137
125
|
/**
|
|
138
126
|
* Time Complexity: O(E), where E is the number of edgeMap incident to the given vertex.
|
|
139
127
|
* Space Complexity: O(1)
|
|
@@ -169,10 +157,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
169
157
|
return;
|
|
170
158
|
}
|
|
171
159
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Time Complexity: O(1) - Constant time for Map operations.
|
|
174
|
-
* Space Complexity: O(1) - Constant space, as it creates only a few variables.
|
|
175
|
-
*/
|
|
176
160
|
/**
|
|
177
161
|
* Time Complexity: O(1) - Constant time for Map operations.
|
|
178
162
|
* Space Complexity: O(1) - Constant space, as it creates only a few variables.
|
|
@@ -208,10 +192,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
208
192
|
}
|
|
209
193
|
return this._vertexMap.delete(vertexKey);
|
|
210
194
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Time Complexity: O(1)
|
|
213
|
-
* Space Complexity: O(1)
|
|
214
|
-
*/
|
|
215
195
|
/**
|
|
216
196
|
* Time Complexity: O(1)
|
|
217
197
|
* Space Complexity: O(1)
|
|
@@ -232,10 +212,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
232
212
|
return 0;
|
|
233
213
|
}
|
|
234
214
|
}
|
|
235
|
-
/**
|
|
236
|
-
* Time Complexity: O(1)
|
|
237
|
-
* Space Complexity: O(1)
|
|
238
|
-
*/
|
|
239
215
|
/**
|
|
240
216
|
* Time Complexity: O(1)
|
|
241
217
|
* Space Complexity: O(1)
|
|
@@ -254,10 +230,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
254
230
|
return [];
|
|
255
231
|
}
|
|
256
232
|
}
|
|
257
|
-
/**
|
|
258
|
-
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
259
|
-
* Space Complexity: O(|E|)
|
|
260
|
-
*/
|
|
261
233
|
/**
|
|
262
234
|
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
263
235
|
* Space Complexity: O(|E|)
|
|
@@ -274,10 +246,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
274
246
|
});
|
|
275
247
|
return [...edgeSet];
|
|
276
248
|
}
|
|
277
|
-
/**
|
|
278
|
-
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
279
|
-
* Space Complexity: O(|E|)
|
|
280
|
-
*/
|
|
281
249
|
/**
|
|
282
250
|
* Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
|
|
283
251
|
* Space Complexity: O(|E|)
|
|
@@ -301,10 +269,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
301
269
|
}
|
|
302
270
|
return neighbors;
|
|
303
271
|
}
|
|
304
|
-
/**
|
|
305
|
-
* Time Complexity: O(1)
|
|
306
|
-
* Space Complexity: O(1)
|
|
307
|
-
*/
|
|
308
272
|
/**
|
|
309
273
|
* Time Complexity: O(1)
|
|
310
274
|
* Space Complexity: O(1)
|
|
@@ -335,10 +299,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
335
299
|
isEmpty() {
|
|
336
300
|
return this.vertexMap.size === 0 && this.edgeMap.size === 0;
|
|
337
301
|
}
|
|
338
|
-
/**
|
|
339
|
-
* Time Complexity: O(1)
|
|
340
|
-
* Space Complexity: O(1)
|
|
341
|
-
*/
|
|
342
302
|
/**
|
|
343
303
|
* Time Complexity: O(1)
|
|
344
304
|
* Space Complexity: O(1)
|
|
@@ -364,10 +324,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
364
324
|
cloned.edgeMap = new Map(this.edgeMap);
|
|
365
325
|
return cloned;
|
|
366
326
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Time Complexity: O(1)
|
|
369
|
-
* Space Complexity: O(1)
|
|
370
|
-
*/
|
|
371
327
|
/**
|
|
372
328
|
* Time Complexity: O(V + E)
|
|
373
329
|
* Space Complexity: O(V)
|
|
@@ -428,12 +384,6 @@ class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
|
428
384
|
cutVertices
|
|
429
385
|
};
|
|
430
386
|
}
|
|
431
|
-
/**
|
|
432
|
-
* Time Complexity: O(V + E)
|
|
433
|
-
* Space Complexity: O(V)
|
|
434
|
-
* Tarjan is an algorithm based on dfs,which is used to solve the connectivity problem of graphs.
|
|
435
|
-
* 1. Tarjan can find the articulation points and bridges(critical edgeMap) of undirected graphs in linear time
|
|
436
|
-
*/
|
|
437
387
|
/**
|
|
438
388
|
* The function "getBridges" returns an array of bridges in a graph using the Tarjan's algorithm.
|
|
439
389
|
* @returns The function `getBridges()` is returning the bridges found using the Tarjan's algorithm.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undirected-graph.js","sourceRoot":"","sources":["../../../../src/data-structures/graph/undirected-graph.ts"],"names":[],"mappings":";;;AASA,qDAA+E;AAC/E,uCAA0C;AAE1C,MAAa,gBAA0B,SAAQ,+BAAiB;IAC9D;;;;;;OAMG;IACH,YAAY,GAAc,EAAE,KAAS;QACnC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpB,CAAC;CACF;AAXD,4CAWC;AAED,MAAa,cAA2B,SAAQ,6BAAe;IAG7D;;;;;;;;;OASG;IACH,YAAY,EAAa,EAAE,EAAa,EAAE,MAAe,EAAE,KAAS;QAClE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5B,CAAC;CACF;AAjBD,wCAiBC;AAED,MAAa,eAMX,SAAQ,8BAA2B;IAGnC;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAY,CAAC;IACtC,CAAC;IAID,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,CAAC,CAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC;IAED;;;;;;;;OAQG;IACM,YAAY,CAAC,GAAc,EAAE,KAAmB;QACvD,OAAO,IAAI,gBAAgB,CAAC,GAAG,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAO,CAAC;IACvD,CAAC;IAED;;;;;;;;;OASG;IACM,UAAU,CAAC,EAAa,EAAE,EAAa,EAAE,MAAe,EAAE,KAAmB;QACpF,OAAO,IAAI,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,CAAC,EAAE,KAAK,CAAO,CAAC;IAC9D,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"undirected-graph.js","sourceRoot":"","sources":["../../../../src/data-structures/graph/undirected-graph.ts"],"names":[],"mappings":";;;AASA,qDAA+E;AAC/E,uCAA0C;AAE1C,MAAa,gBAA0B,SAAQ,+BAAiB;IAC9D;;;;;;OAMG;IACH,YAAY,GAAc,EAAE,KAAS;QACnC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpB,CAAC;CACF;AAXD,4CAWC;AAED,MAAa,cAA2B,SAAQ,6BAAe;IAG7D;;;;;;;;;OASG;IACH,YAAY,EAAa,EAAE,EAAa,EAAE,MAAe,EAAE,KAAS;QAClE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5B,CAAC;CACF;AAjBD,wCAiBC;AAED,MAAa,eAMX,SAAQ,8BAA2B;IAGnC;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAY,CAAC;IAC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ntry
|
|
|
123
123
|
/**
|
|
124
124
|
* Time Complexity: O(n)
|
|
125
125
|
* Space Complexity: O(n)
|
|
126
|
-
|
|
127
|
-
/**
|
|
126
|
+
*
|
|
128
127
|
* The clone function creates a new HashMap with the same key-value pairs as
|
|
129
128
|
* this one. The clone function is useful for creating a copy of an existing
|
|
130
129
|
* HashMap, and then modifying that copy without affecting the original.
|
|
@@ -132,10 +131,6 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
132
131
|
* @return A new hashmap with the same values as this one
|
|
133
132
|
*/
|
|
134
133
|
clone(): HashMap<K, V, R>;
|
|
135
|
-
/**
|
|
136
|
-
* Time Complexity: O(n)
|
|
137
|
-
* Space Complexity: O(n)
|
|
138
|
-
*/
|
|
139
134
|
/**
|
|
140
135
|
* Time Complexity: O(n)
|
|
141
136
|
* Space Complexity: O(n)
|
|
@@ -168,15 +163,6 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
168
163
|
* from the original `HashMap` that pass the provided `predicate` function.
|
|
169
164
|
*/
|
|
170
165
|
filter(predicate: EntryCallback<K, V, boolean>, thisArg?: any): HashMap<K, V>;
|
|
171
|
-
/**
|
|
172
|
-
* The put function sets a value in a data structure using a specified key.
|
|
173
|
-
* @param {K} key - The key parameter is of type K, which represents the type of the key being passed
|
|
174
|
-
* to the function.
|
|
175
|
-
* @param {V} value - The value parameter represents the value that you want to associate with the
|
|
176
|
-
* specified key in the data structure.
|
|
177
|
-
* @returns The method is returning a boolean value.
|
|
178
|
-
*/
|
|
179
|
-
put(key: K, value: V): boolean;
|
|
180
166
|
/**
|
|
181
167
|
* The function returns an iterator that yields key-value pairs from both an object store and an
|
|
182
168
|
* object map.
|
|
@@ -213,7 +199,7 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
213
199
|
* @param [options] - The `options` parameter is an optional object that can contain the following
|
|
214
200
|
* properties:
|
|
215
201
|
*/
|
|
216
|
-
constructor(entryOrRawElements?: Iterable<R>, options?: LinkedHashMapOptions<K, V, R>);
|
|
202
|
+
constructor(entryOrRawElements?: Iterable<R | [K, V]>, options?: LinkedHashMapOptions<K, V, R>);
|
|
217
203
|
protected _hashFn: (key: K) => string;
|
|
218
204
|
/**
|
|
219
205
|
* The function returns the hash function used for generating a hash value for a given key.
|
|
@@ -253,22 +239,18 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
253
239
|
* @returns The `_tail` property of type `HashMapLinkedNode<K, V | undefined>` is being returned.
|
|
254
240
|
*/
|
|
255
241
|
get tail(): HashMapLinkedNode<K, V | undefined>;
|
|
256
|
-
protected _toEntryFn
|
|
242
|
+
protected _toEntryFn?: (rawElement: R) => [K, V];
|
|
257
243
|
/**
|
|
258
244
|
* The function returns the value of the _toEntryFn property.
|
|
259
245
|
* @returns The function being returned is `this._toEntryFn`.
|
|
260
246
|
*/
|
|
261
|
-
get toEntryFn(): (rawElement: R) => [K, V];
|
|
247
|
+
get toEntryFn(): ((rawElement: R) => [K, V]) | undefined;
|
|
262
248
|
protected _size: number;
|
|
263
249
|
/**
|
|
264
250
|
* The function returns the size of an object.
|
|
265
251
|
* @returns The size of the object.
|
|
266
252
|
*/
|
|
267
253
|
get size(): number;
|
|
268
|
-
/**
|
|
269
|
-
* Time Complexity: O(1)
|
|
270
|
-
* Space Complexity: O(1)
|
|
271
|
-
*/
|
|
272
254
|
/**
|
|
273
255
|
* Time Complexity: O(1)
|
|
274
256
|
* Space Complexity: O(1)
|
|
@@ -278,10 +260,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
278
260
|
* value (V).
|
|
279
261
|
*/
|
|
280
262
|
get first(): [K, V] | undefined;
|
|
281
|
-
/**
|
|
282
|
-
* Time Complexity: O(1)
|
|
283
|
-
* Space Complexity: O(1)
|
|
284
|
-
*/
|
|
285
263
|
/**
|
|
286
264
|
* Time Complexity: O(1)
|
|
287
265
|
* Space Complexity: O(1)
|
|
@@ -300,10 +278,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
300
278
|
* key and value.
|
|
301
279
|
*/
|
|
302
280
|
reverseBegin(): Generator<(K | V | undefined)[], void, unknown>;
|
|
303
|
-
/**
|
|
304
|
-
* Time Complexity: O(1)
|
|
305
|
-
* Space Complexity: O(1)
|
|
306
|
-
*/
|
|
307
281
|
/**
|
|
308
282
|
* Time Complexity: O(1)
|
|
309
283
|
* Space Complexity: O(1)
|
|
@@ -325,7 +299,7 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
325
299
|
* R.
|
|
326
300
|
* @returns The `setMany` function returns an array of booleans.
|
|
327
301
|
*/
|
|
328
|
-
setMany(entryOrRawElements: Iterable<R>): boolean[];
|
|
302
|
+
setMany(entryOrRawElements: Iterable<R | [K, V]>): boolean[];
|
|
329
303
|
/**
|
|
330
304
|
* The function checks if a given key exists in a map, using different logic depending on whether the
|
|
331
305
|
* key is a weak key or not.
|
|
@@ -333,10 +307,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
333
307
|
* @returns The method `has` is returning a boolean value.
|
|
334
308
|
*/
|
|
335
309
|
has(key: K): boolean;
|
|
336
|
-
/**
|
|
337
|
-
* Time Complexity: O(1)
|
|
338
|
-
* Space Complexity: O(1)
|
|
339
|
-
*/
|
|
340
310
|
/**
|
|
341
311
|
* Time Complexity: O(1)
|
|
342
312
|
* Space Complexity: O(1)
|
|
@@ -351,10 +321,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
351
321
|
* using the key itself. If the key is not found, `undefined` is
|
|
352
322
|
*/
|
|
353
323
|
get(key: K): V | undefined;
|
|
354
|
-
/**
|
|
355
|
-
* Time Complexity: O(n)
|
|
356
|
-
* Space Complexity: O(1)
|
|
357
|
-
*/
|
|
358
324
|
/**
|
|
359
325
|
* Time Complexity: O(n)
|
|
360
326
|
* Space Complexity: O(1)
|
|
@@ -367,10 +333,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
367
333
|
* where `K` is the key and `V` is the value.
|
|
368
334
|
*/
|
|
369
335
|
at(index: number): V | undefined;
|
|
370
|
-
/**
|
|
371
|
-
* Time Complexity: O(1)
|
|
372
|
-
* Space Complexity: O(1)
|
|
373
|
-
*/
|
|
374
336
|
/**
|
|
375
337
|
* Time Complexity: O(1)
|
|
376
338
|
* Space Complexity: O(1)
|
|
@@ -382,10 +344,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
382
344
|
* was not found.
|
|
383
345
|
*/
|
|
384
346
|
delete(key: K): boolean;
|
|
385
|
-
/**
|
|
386
|
-
* Time Complexity: O(n)
|
|
387
|
-
* Space Complexity: O(1)
|
|
388
|
-
*/
|
|
389
347
|
/**
|
|
390
348
|
* Time Complexity: O(n)
|
|
391
349
|
* Space Complexity: O(1)
|
|
@@ -396,10 +354,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
396
354
|
* @returns The size of the list after deleting the element at the specified index.
|
|
397
355
|
*/
|
|
398
356
|
deleteAt(index: number): boolean;
|
|
399
|
-
/**
|
|
400
|
-
* Time Complexity: O(1)
|
|
401
|
-
* Space Complexity: O(1)
|
|
402
|
-
*/
|
|
403
357
|
/**
|
|
404
358
|
* Time Complexity: O(1)
|
|
405
359
|
* Space Complexity: O(1)
|
|
@@ -416,10 +370,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
416
370
|
* @returns a boolean value.
|
|
417
371
|
*/
|
|
418
372
|
isEntry(rawElement: any): rawElement is [K, V];
|
|
419
|
-
/**
|
|
420
|
-
* Time Complexity: O(1)
|
|
421
|
-
* Space Complexity: O(1)
|
|
422
|
-
*/
|
|
423
373
|
/**
|
|
424
374
|
* Time Complexity: O(1)
|
|
425
375
|
* Space Complexity: O(1)
|
|
@@ -427,10 +377,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
427
377
|
* The `clear` function clears all the entries in a data structure and resets its properties.
|
|
428
378
|
*/
|
|
429
379
|
clear(): void;
|
|
430
|
-
/**
|
|
431
|
-
* Time Complexity: O(n)
|
|
432
|
-
* Space Complexity: O(n)
|
|
433
|
-
*/
|
|
434
380
|
/**
|
|
435
381
|
* Time Complexity: O(n)
|
|
436
382
|
* Space Complexity: O(n)
|
|
@@ -441,10 +387,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
441
387
|
* of the original `LinkedHashMap` object.
|
|
442
388
|
*/
|
|
443
389
|
clone(): LinkedHashMap<K, V>;
|
|
444
|
-
/**
|
|
445
|
-
* Time Complexity: O(n)
|
|
446
|
-
* Space Complexity: O(n)
|
|
447
|
-
*/
|
|
448
390
|
/**
|
|
449
391
|
* Time Complexity: O(n)
|
|
450
392
|
* Space Complexity: O(n)
|
|
@@ -461,10 +403,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
461
403
|
* `LinkedHashMap` object that satisfy the given predicate function.
|
|
462
404
|
*/
|
|
463
405
|
filter(predicate: EntryCallback<K, V, boolean>, thisArg?: any): LinkedHashMap<K, V>;
|
|
464
|
-
/**
|
|
465
|
-
* Time Complexity: O(n)
|
|
466
|
-
* Space Complexity: O(n)
|
|
467
|
-
*/
|
|
468
406
|
/**
|
|
469
407
|
* Time Complexity: O(n)
|
|
470
408
|
* Space Complexity: O(n)
|
|
@@ -483,27 +421,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
483
421
|
* function.
|
|
484
422
|
*/
|
|
485
423
|
map<VM>(callback: EntryCallback<K, V, VM>, thisArg?: any): LinkedHashMap<K, VM>;
|
|
486
|
-
/**
|
|
487
|
-
* Time Complexity: O(1)
|
|
488
|
-
* Space Complexity: O(1)
|
|
489
|
-
*/
|
|
490
|
-
/**
|
|
491
|
-
* Time Complexity: O(1)
|
|
492
|
-
* Space Complexity: O(1)
|
|
493
|
-
*
|
|
494
|
-
* The put function sets a value in a data structure using a specified key.
|
|
495
|
-
* @param {K} key - The key parameter is of type K, which represents the type of the key being passed
|
|
496
|
-
* to the function.
|
|
497
|
-
* @param {V} value - The value parameter represents the value that you want to associate with the
|
|
498
|
-
* specified key in the data structure.
|
|
499
|
-
* @returns The method is returning a boolean value.
|
|
500
|
-
*/
|
|
501
|
-
put(key: K, value: V): boolean;
|
|
502
|
-
/**
|
|
503
|
-
* Time Complexity: O(n)
|
|
504
|
-
* Space Complexity: O(1)
|
|
505
|
-
* where n is the number of entries in the LinkedHashMap.
|
|
506
|
-
*/
|
|
507
424
|
/**
|
|
508
425
|
* Time Complexity: O(n)
|
|
509
426
|
* Space Complexity: O(1)
|
|
@@ -512,10 +429,6 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
512
429
|
* The above function is an iterator that yields key-value pairs from a linked list.
|
|
513
430
|
*/
|
|
514
431
|
protected _getIterator(): Generator<[K, V], void, unknown>;
|
|
515
|
-
/**
|
|
516
|
-
* Time Complexity: O(1)
|
|
517
|
-
* Space Complexity: O(1)
|
|
518
|
-
*/
|
|
519
432
|
/**
|
|
520
433
|
* Time Complexity: O(1)
|
|
521
434
|
* Space Complexity: O(1)
|