linked-list-typed 1.48.3 → 1.48.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.
Files changed (38) hide show
  1. package/dist/data-structures/base/iterable-base.d.ts +6 -6
  2. package/dist/data-structures/base/iterable-base.js +3 -3
  3. package/dist/data-structures/binary-tree/avl-tree.d.ts +5 -3
  4. package/dist/data-structures/binary-tree/avl-tree.js +6 -4
  5. package/dist/data-structures/binary-tree/binary-tree.d.ts +18 -15
  6. package/dist/data-structures/binary-tree/binary-tree.js +16 -13
  7. package/dist/data-structures/binary-tree/bst.d.ts +15 -11
  8. package/dist/data-structures/binary-tree/bst.js +17 -13
  9. package/dist/data-structures/binary-tree/rb-tree.d.ts +19 -13
  10. package/dist/data-structures/binary-tree/rb-tree.js +20 -14
  11. package/dist/data-structures/binary-tree/tree-multimap.d.ts +21 -14
  12. package/dist/data-structures/binary-tree/tree-multimap.js +25 -18
  13. package/dist/data-structures/graph/abstract-graph.d.ts +53 -52
  14. package/dist/data-structures/graph/abstract-graph.js +82 -78
  15. package/dist/data-structures/graph/directed-graph.d.ts +70 -52
  16. package/dist/data-structures/graph/directed-graph.js +111 -65
  17. package/dist/data-structures/graph/map-graph.d.ts +5 -5
  18. package/dist/data-structures/graph/map-graph.js +8 -8
  19. package/dist/data-structures/graph/undirected-graph.d.ts +51 -32
  20. package/dist/data-structures/graph/undirected-graph.js +117 -54
  21. package/dist/data-structures/hash/hash-map.d.ts +8 -8
  22. package/dist/data-structures/hash/hash-map.js +2 -2
  23. package/dist/interfaces/binary-tree.d.ts +1 -1
  24. package/dist/types/data-structures/base/base.d.ts +3 -3
  25. package/package.json +2 -2
  26. package/src/data-structures/base/iterable-base.ts +6 -6
  27. package/src/data-structures/binary-tree/avl-tree.ts +8 -5
  28. package/src/data-structures/binary-tree/binary-tree.ts +23 -19
  29. package/src/data-structures/binary-tree/bst.ts +19 -14
  30. package/src/data-structures/binary-tree/rb-tree.ts +20 -14
  31. package/src/data-structures/binary-tree/tree-multimap.ts +27 -19
  32. package/src/data-structures/graph/abstract-graph.ts +87 -82
  33. package/src/data-structures/graph/directed-graph.ts +114 -65
  34. package/src/data-structures/graph/map-graph.ts +8 -8
  35. package/src/data-structures/graph/undirected-graph.ts +124 -56
  36. package/src/data-structures/hash/hash-map.ts +8 -8
  37. package/src/interfaces/binary-tree.ts +1 -1
  38. package/src/types/data-structures/base/base.ts +3 -3
@@ -1,7 +1,7 @@
1
1
  import type { DijkstraResult, VertexKey } from '../../types';
2
- import { PairCallback } from "../../types";
2
+ import { EntryCallback } from "../../types";
3
3
  import { IGraph } from '../../interfaces';
4
- import { IterablePairBase } from "../base";
4
+ import { IterableEntryBase } from "../base";
5
5
  export declare abstract class AbstractVertex<V = any> {
6
6
  key: VertexKey;
7
7
  value: V | undefined;
@@ -30,10 +30,10 @@ export declare abstract class AbstractEdge<E = any> {
30
30
  protected _hashCode: string;
31
31
  get hashCode(): string;
32
32
  }
33
- export declare abstract class AbstractGraph<V = any, E = any, VO extends AbstractVertex<V> = AbstractVertex<V>, EO extends AbstractEdge<E> = AbstractEdge<E>> extends IterablePairBase<VertexKey, V | undefined> implements IGraph<V, E, VO, EO> {
33
+ export declare abstract class AbstractGraph<V = any, E = any, VO extends AbstractVertex<V> = AbstractVertex<V>, EO extends AbstractEdge<E> = AbstractEdge<E>> extends IterableEntryBase<VertexKey, V | undefined> implements IGraph<V, E, VO, EO> {
34
34
  constructor();
35
- protected _vertices: Map<VertexKey, VO>;
36
- get vertices(): Map<VertexKey, VO>;
35
+ protected _vertexMap: Map<VertexKey, VO>;
36
+ get vertexMap(): Map<VertexKey, VO>;
37
37
  /**
38
38
  * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
39
39
  * This means that using abstract methods in the parent class cannot constrain the grandchild classes. Defining methods within an interface also cannot constrain the descendant classes. When inheriting from this class, developers need to be aware that this method needs to be overridden.
@@ -67,8 +67,8 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
67
67
  *
68
68
  * The function "getVertex" returns the vertex with the specified ID or undefined if it doesn't exist.
69
69
  * @param {VertexKey} vertexKey - The `vertexKey` parameter is the identifier of the vertex that you want to retrieve from
70
- * the `_vertices` map.
71
- * @returns The method `getVertex` returns the vertex with the specified `vertexKey` if it exists in the `_vertices`
70
+ * the `_vertexMap` map.
71
+ * @returns The method `getVertex` returns the vertex with the specified `vertexKey` if it exists in the `_vertexMap`
72
72
  * map. If the vertex does not exist, it returns `undefined`.
73
73
  */
74
74
  getVertex(vertexKey: VertexKey): VO | undefined;
@@ -88,6 +88,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
88
88
  hasVertex(vertexOrKey: VO | VertexKey): boolean;
89
89
  addVertex(vertex: VO): boolean;
90
90
  addVertex(key: VertexKey, value?: V): boolean;
91
+ isVertexKey(potentialKey: any): potentialKey is VertexKey;
91
92
  /**
92
93
  * Time Complexity: O(1) - Constant time for Map operations.
93
94
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
@@ -103,20 +104,20 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
103
104
  */
104
105
  deleteVertex(vertexOrKey: VO | VertexKey): boolean;
105
106
  /**
106
- * Time Complexity: O(K), where K is the number of vertices to be removed.
107
+ * Time Complexity: O(K), where K is the number of vertexMap to be removed.
107
108
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
108
109
  */
109
110
  /**
110
- * Time Complexity: O(K), where K is the number of vertices to be removed.
111
+ * Time Complexity: O(K), where K is the number of vertexMap to be removed.
111
112
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
112
113
  *
113
- * The function removes all vertices from a graph and returns a boolean indicating if any vertices were removed.
114
- * @param {VO[] | VertexKey[]} vertices - The `vertices` parameter can be either an array of vertices (`VO[]`) or an array
114
+ * The function removes all vertexMap from a graph and returns a boolean indicating if any vertexMap were removed.
115
+ * @param {VO[] | VertexKey[]} vertexMap - The `vertexMap` parameter can be either an array of vertexMap (`VO[]`) or an array
115
116
  * of vertex IDs (`VertexKey[]`).
116
- * @returns a boolean value. It returns true if at least one vertex was successfully removed, and false if no vertices
117
+ * @returns a boolean value. It returns true if at least one vertex was successfully removed, and false if no vertexMap
117
118
  * were removed.
118
119
  */
119
- removeManyVertices(vertices: VO[] | VertexKey[]): boolean;
120
+ removeManyVertices(vertexMap: VO[] | VertexKey[]): boolean;
120
121
  /**
121
122
  * Time Complexity: O(1) - Depends on the implementation in the concrete class.
122
123
  * Space Complexity: O(1) - Depends on the implementation in the concrete class.
@@ -125,7 +126,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
125
126
  * Time Complexity: O(1) - Depends on the implementation in the concrete class.
126
127
  * Space Complexity: O(1) - Depends on the implementation in the concrete class.
127
128
  *
128
- * The function checks if there is an edge between two vertices and returns a boolean value indicating the result.
129
+ * The function checks if there is an edge between two vertexMap and returns a boolean value indicating the result.
129
130
  * @param {VertexKey | VO} v1 - The parameter v1 can be either a VertexKey or a VO. A VertexKey represents the unique
130
131
  * identifier of a vertex in a graph, while VO represents the type of the vertex object itself.
131
132
  * @param {VertexKey | VO} v2 - The parameter `v2` represents the second vertex in the edge. It can be either a
@@ -143,14 +144,14 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
143
144
  * Time Complexity: O(1) - Constant time for Map and Edge operations.
144
145
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
145
146
  *
146
- * The function sets the weight of an edge between two vertices in a graph.
147
+ * The function sets the weight of an edge between two vertexMap in a graph.
147
148
  * @param {VertexKey | VO} srcOrKey - The `srcOrKey` parameter can be either a `VertexKey` or a `VO` object. It represents
148
149
  * the source vertex of the edge.
149
150
  * @param {VertexKey | VO} destOrKey - The `destOrKey` parameter represents the destination vertex of the edge. It can be
150
151
  * either a `VertexKey` or a vertex object `VO`.
151
152
  * @param {number} weight - The weight parameter represents the weight of the edge between the source vertex (srcOrKey)
152
153
  * and the destination vertex (destOrKey).
153
- * @returns a boolean value. If the edge exists between the source and destination vertices, the function will update
154
+ * @returns a boolean value. If the edge exists between the source and destination vertexMap, the function will update
154
155
  * the weight of the edge and return true. If the edge does not exist, the function will return false.
155
156
  */
156
157
  setEdgeWeight(srcOrKey: VertexKey | VO, destOrKey: VertexKey | VO, weight: number): boolean;
@@ -162,12 +163,12 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
162
163
  * Time Complexity: O(P), where P is the number of paths found (in the worst case, exploring all paths).
163
164
  * Space Complexity: O(P) - Linear space, where P is the number of paths found.
164
165
  *
165
- * The function `getAllPathsBetween` finds all paths between two vertices in a graph using depth-first search.
166
+ * The function `getAllPathsBetween` finds all paths between two vertexMap in a graph using depth-first search.
166
167
  * @param {VO | VertexKey} v1 - The parameter `v1` represents either a vertex object (`VO`) or a vertex ID (`VertexKey`).
167
168
  * It is the starting vertex for finding paths.
168
169
  * @param {VO | VertexKey} v2 - The parameter `v2` represents either a vertex object (`VO`) or a vertex ID (`VertexKey`).
169
170
  * @param limit - The count of limitation of result array.
170
- * @returns The function `getAllPathsBetween` returns an array of arrays of vertices (`VO[][]`).
171
+ * @returns The function `getAllPathsBetween` returns an array of arrays of vertexMap (`VO[][]`).
171
172
  */
172
173
  getAllPathsBetween(v1: VO | VertexKey, v2: VO | VertexKey, limit?: number): VO[][];
173
174
  /**
@@ -179,8 +180,8 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
179
180
  * Space Complexity: O(1) - Constant space.
180
181
  *
181
182
  * The function calculates the sum of weights along a given path.
182
- * @param {VO[]} path - An array of vertices (VO) representing a path in a graph.
183
- * @returns The function `getPathSumWeight` returns the sum of the weights of the edges in the given path.
183
+ * @param {VO[]} path - An array of vertexMap (VO) representing a path in a graph.
184
+ * @returns The function `getPathSumWeight` returns the sum of the weights of the edgeMap in the given path.
184
185
  */
185
186
  getPathSumWeight(path: VO[]): number;
186
187
  /**
@@ -191,17 +192,17 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
191
192
  * Time Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
192
193
  * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
193
194
  *
194
- * The function `getMinCostBetween` calculates the minimum cost between two vertices in a graph, either based on edge
195
+ * The function `getMinCostBetween` calculates the minimum cost between two vertexMap in a graph, either based on edge
195
196
  * weights or using a breadth-first search algorithm.
196
197
  * @param {VO | VertexKey} v1 - The parameter `v1` represents the starting vertex or its ID.
197
198
  * @param {VO | VertexKey} v2 - The parameter `v2` represents the destination vertex or its ID. It is the vertex to which
198
199
  * you want to find the minimum cost or weight from the source vertex `v1`.
199
- * @param {boolean} [isWeight] - isWeight is an optional parameter that indicates whether the graph edges have weights.
200
+ * @param {boolean} [isWeight] - isWeight is an optional parameter that indicates whether the graph edgeMap have weights.
200
201
  * If isWeight is set to true, the function will calculate the minimum cost between v1 and v2 based on the weights of
201
- * the edges. If isWeight is set to false or not provided, the function will calculate the
202
- * @returns The function `getMinCostBetween` returns a number representing the minimum cost between two vertices (`v1`
202
+ * the edgeMap. If isWeight is set to false or not provided, the function will calculate the
203
+ * @returns The function `getMinCostBetween` returns a number representing the minimum cost between two vertexMap (`v1`
203
204
  * and `v2`). If the `isWeight` parameter is `true`, it calculates the minimum weight among all paths between the
204
- * vertices. If `isWeight` is `false` or not provided, it uses a breadth-first search (BFS) algorithm to calculate the
205
+ * vertexMap. If `isWeight` is `false` or not provided, it uses a breadth-first search (BFS) algorithm to calculate the
205
206
  * minimum number of
206
207
  */
207
208
  getMinCostBetween(v1: VO | VertexKey, v2: VO | VertexKey, isWeight?: boolean): number | undefined;
@@ -213,20 +214,20 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
213
214
  * Time Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm or DFS).
214
215
  * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm or DFS).
215
216
  *
216
- * The function `getMinPathBetween` returns the minimum path between two vertices in a graph, either based on weight or
217
+ * The function `getMinPathBetween` returns the minimum path between two vertexMap in a graph, either based on weight or
217
218
  * using a breadth-first search algorithm.
218
219
  * @param {VO | VertexKey} v1 - The parameter `v1` represents the starting vertex of the path. It can be either a vertex
219
220
  * object (`VO`) or a vertex ID (`VertexKey`).
220
221
  * @param {VO | VertexKey} v2 - VO | VertexKey - The second vertex or vertex ID between which we want to find the minimum
221
222
  * path.
222
- * @param {boolean} [isWeight] - A boolean flag indicating whether to consider the weight of edges in finding the
223
+ * @param {boolean} [isWeight] - A boolean flag indicating whether to consider the weight of edgeMap in finding the
223
224
  * minimum path. If set to true, the function will use Dijkstra's algorithm to find the minimum weighted path. If set
224
225
  * to false, the function will use breadth-first search (BFS) to find the minimum path.
225
226
  * @param isDFS - If set to true, it enforces the use of getAllPathsBetween to first obtain all possible paths,
226
227
  * followed by iterative computation of the shortest path. This approach may result in exponential time complexity,
227
228
  * so the default method is to use the Dijkstra algorithm to obtain the shortest weighted path.
228
- * @returns The function `getMinPathBetween` returns an array of vertices (`VO[]`) representing the minimum path between
229
- * two vertices (`v1` and `v2`). If there is no path between the vertices, it returns `undefined`.
229
+ * @returns The function `getMinPathBetween` returns an array of vertexMap (`VO[]`) representing the minimum path between
230
+ * two vertexMap (`v1` and `v2`). If there is no path between the vertexMap, it returns `undefined`.
230
231
  */
231
232
  getMinPathBetween(v1: VO | VertexKey, v2: VO | VertexKey, isWeight?: boolean, isDFS?: boolean): VO[] | undefined;
232
233
  /**
@@ -241,7 +242,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
241
242
  * Time Complexity: O(V^2 + E) - Quadratic time in the worst case (no heap optimization).
242
243
  * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
243
244
  *
244
- * The function `dijkstraWithoutHeap` implements Dijkstra's algorithm to find the shortest path between two vertices in
245
+ * The function `dijkstraWithoutHeap` implements Dijkstra's algorithm to find the shortest path between two vertexMap in
245
246
  * a graph without using a heap data structure.
246
247
  * @param {VO | VertexKey} src - The source vertex from which to start the Dijkstra's algorithm. It can be either a
247
248
  * vertex object or a vertex ID.
@@ -253,7 +254,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
253
254
  * `getMinDist` is set to `true`, the `minDist` property in the result will contain the minimum distance
254
255
  * @param {boolean} [genPaths] - The `genPaths` parameter is a boolean flag that determines whether or not to generate
255
256
  * paths in the Dijkstra algorithm. If `genPaths` is set to `true`, the algorithm will calculate and return the
256
- * shortest paths from the source vertex to all other vertices in the graph. If `genPaths
257
+ * shortest paths from the source vertex to all other vertexMap in the graph. If `genPaths
257
258
  * @returns The function `dijkstraWithoutHeap` returns an object of type `DijkstraResult<VO>`.
258
259
  */
259
260
  dijkstraWithoutHeap(src: VO | VertexKey, dest?: VO | VertexKey | undefined, getMinDist?: boolean, genPaths?: boolean): DijkstraResult<VO>;
@@ -261,7 +262,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
261
262
  * Dijkstra algorithm time: O(logVE) space: O(VO + EO)
262
263
  *
263
264
  * Dijkstra's algorithm only solves the single-source shortest path problem, while the Bellman-Ford algorithm and Floyd-Warshall algorithm can address shortest paths between all pairs of nodes.
264
- * Dijkstra's algorithm is suitable for graphs with non-negative edge weights, whereas the Bellman-Ford algorithm and Floyd-Warshall algorithm can handle negative-weight edges.
265
+ * Dijkstra's algorithm is suitable for graphs with non-negative edge weights, whereas the Bellman-Ford algorithm and Floyd-Warshall algorithm can handle negative-weight edgeMap.
265
266
  * 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(VO^3), where VO is the number of nodes. For dense graphs, Floyd-Warshall might become slower.
266
267
  *
267
268
  * /
@@ -281,13 +282,13 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
281
282
  * start. It can be either a vertex object or a vertex ID.
282
283
  * @param {VO | VertexKey | undefined} [dest] - The `dest` parameter is the destination vertex or vertex ID. It specifies the
283
284
  * vertex to which the shortest path is calculated from the source vertex. If no destination is provided, the algorithm
284
- * will calculate the shortest paths to all other vertices from the source vertex.
285
+ * will calculate the shortest paths to all other vertexMap from the source vertex.
285
286
  * @param {boolean} [getMinDist] - The `getMinDist` parameter is a boolean flag that determines whether the minimum
286
287
  * distance from the source vertex to the destination vertex should be calculated and returned in the result. If
287
288
  * `getMinDist` is set to `true`, the `minDist` property in the result will contain the minimum distance
288
289
  * @param {boolean} [genPaths] - The `genPaths` parameter is a boolean flag that determines whether or not to generate
289
290
  * paths in the Dijkstra algorithm. If `genPaths` is set to `true`, the algorithm will calculate and return the
290
- * shortest paths from the source vertex to all other vertices in the graph. If `genPaths
291
+ * shortest paths from the source vertex to all other vertexMap in the graph. If `genPaths
291
292
  * @returns The function `dijkstra` returns an object of type `DijkstraResult<VO>`.
292
293
  */
293
294
  dijkstra(src: VO | VertexKey, dest?: VO | VertexKey | undefined, getMinDist?: boolean, genPaths?: boolean): DijkstraResult<VO>;
@@ -302,16 +303,16 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
302
303
  * Space Complexity: O(V + E) - Depends on the implementation (Bellman-Ford algorithm).
303
304
  *
304
305
  * one to rest pairs
305
- * The Bellman-Ford algorithm is also used to find the shortest paths from a source node to all other nodes in a graph. Unlike Dijkstra's algorithm, it can handle edge weights that are negative. Its basic idea involves iterative relaxation of all edges for several rounds to gradually approximate the shortest paths. Due to its ability to handle negative-weight edges, the Bellman-Ford algorithm is more flexible in some scenarios.
306
+ * The Bellman-Ford algorithm is also used to find the shortest paths from a source node to all other nodes in a graph. Unlike Dijkstra's algorithm, it can handle edge weights that are negative. Its basic idea involves iterative relaxation of all edgeMap for several rounds to gradually approximate the shortest paths. Due to its ability to handle negative-weight edgeMap, the Bellman-Ford algorithm is more flexible in some scenarios.
306
307
  * The `bellmanFord` function implements the Bellman-Ford algorithm to find the shortest path from a source vertex to
307
- * all other vertices in a graph, and optionally detects negative cycles and generates the minimum path.
308
+ * all other vertexMap in a graph, and optionally detects negative cycles and generates the minimum path.
308
309
  * @param {VO | VertexKey} src - The `src` parameter is the source vertex from which the Bellman-Ford algorithm will
309
310
  * start calculating the shortest paths. It can be either a vertex object or a vertex ID.
310
311
  * @param {boolean} [scanNegativeCycle] - A boolean flag indicating whether to scan for negative cycles in the graph.
311
312
  * @param {boolean} [getMin] - The `getMin` parameter is a boolean flag that determines whether the algorithm should
312
- * calculate the minimum distance from the source vertex to all other vertices in the graph. If `getMin` is set to
313
+ * calculate the minimum distance from the source vertex to all other vertexMap in the graph. If `getMin` is set to
313
314
  * `true`, the algorithm will find the minimum distance and update the `min` variable with the minimum
314
- * @param {boolean} [genPath] - A boolean flag indicating whether to generate paths for all vertices from the source
315
+ * @param {boolean} [genPath] - A boolean flag indicating whether to generate paths for all vertexMap from the source
315
316
  * vertex.
316
317
  * @returns The function `bellmanFord` returns an object with the following properties:
317
318
  */
@@ -334,7 +335,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
334
335
  /**
335
336
  * BellmanFord time:O(VE) space:O(VO)
336
337
  * one to rest pairs
337
- * The Bellman-Ford algorithm is also used to find the shortest paths from a source node to all other nodes in a graph. Unlike Dijkstra's algorithm, it can handle edge weights that are negative. Its basic idea involves iterative relaxation of all edges for several rounds to gradually approximate the shortest paths. Due to its ability to handle negative-weight edges, the Bellman-Ford algorithm is more flexible in some scenarios.
338
+ * The Bellman-Ford algorithm is also used to find the shortest paths from a source node to all other nodes in a graph. Unlike Dijkstra's algorithm, it can handle edge weights that are negative. Its basic idea involves iterative relaxation of all edgeMap for several rounds to gradually approximate the shortest paths. Due to its ability to handle negative-weight edgeMap, the Bellman-Ford algorithm is more flexible in some scenarios.
338
339
  * The `bellmanFord` function implements the Bellman-Ford algorithm to find the shortest path from a source vertex to
339
340
  */
340
341
  /**
@@ -342,7 +343,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
342
343
  * Space Complexity: O(V^2) - Quadratic space (Floyd-Warshall algorithm).
343
344
  * Not support graph with negative weight cycle
344
345
  * all pairs
345
- * The Floyd-Warshall algorithm is used to find the shortest paths between all pairs of nodes in a graph. It employs dynamic programming to compute the shortest paths from any node to any other node. The Floyd-Warshall algorithm's advantage lies in its ability to handle graphs with negative-weight edges, and it can simultaneously compute shortest paths between any two nodes.
346
+ * The Floyd-Warshall algorithm is used to find the shortest paths between all pairs of nodes in a graph. It employs dynamic programming to compute the shortest paths from any node to any other node. The Floyd-Warshall algorithm's advantage lies in its ability to handle graphs with negative-weight edgeMap, and it can simultaneously compute shortest paths between any two nodes.
346
347
  * /
347
348
 
348
349
  /**
@@ -351,13 +352,13 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
351
352
  *
352
353
  * Not support graph with negative weight cycle
353
354
  * all pairs
354
- * The Floyd-Warshall algorithm is used to find the shortest paths between all pairs of nodes in a graph. It employs dynamic programming to compute the shortest paths from any node to any other node. The Floyd-Warshall algorithm's advantage lies in its ability to handle graphs with negative-weight edges, and it can simultaneously compute shortest paths between any two nodes.
355
- * The function implements the Floyd-Warshall algorithm to find the shortest path between all pairs of vertices in a
355
+ * The Floyd-Warshall algorithm is used to find the shortest paths between all pairs of nodes in a graph. It employs dynamic programming to compute the shortest paths from any node to any other node. The Floyd-Warshall algorithm's advantage lies in its ability to handle graphs with negative-weight edgeMap, and it can simultaneously compute shortest paths between any two nodes.
356
+ * The function implements the Floyd-Warshall algorithm to find the shortest path between all pairs of vertexMap in a
356
357
  * graph.
357
358
  * @returns The function `floydWarshall()` returns an object with two properties: `costs` and `predecessor`. The `costs`
358
- * property is a 2D array of numbers representing the shortest path costs between vertices in a graph. The
359
- * `predecessor` property is a 2D array of vertices (or `undefined`) representing the predecessor vertices in the shortest
360
- * path between vertices in the
359
+ * property is a 2D array of numbers representing the shortest path costs between vertexMap in a graph. The
360
+ * `predecessor` property is a 2D array of vertexMap (or `undefined`) representing the predecessor vertexMap in the shortest
361
+ * path between vertexMap in the
361
362
  */
362
363
  floydWarshall(): {
363
364
  costs: number[][];
@@ -368,7 +369,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
368
369
  * Space Complexity: O(V) - Linear space (Tarjan's algorithm).
369
370
  * Tarjan is an algorithm based on dfs,which is used to solve the connectivity problem of graphs.
370
371
  * Tarjan can find cycles in directed or undirected graph
371
- * Tarjan can find the articulation points and bridges(critical edges) of undirected graphs in linear time,
372
+ * Tarjan can find the articulation points and bridges(critical edgeMap) of undirected graphs in linear time,
372
373
  * Tarjan solve the bi-connected components of undirected graphs;
373
374
  * Tarjan can find the SSC(strongly connected components), articulation points, and bridges of directed graphs.
374
375
  * /
@@ -379,22 +380,22 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
379
380
  *
380
381
  * Tarjan is an algorithm based on dfs,which is used to solve the connectivity problem of graphs.
381
382
  * Tarjan can find cycles in directed or undirected graph
382
- * Tarjan can find the articulation points and bridges(critical edges) of undirected graphs in linear time,
383
+ * Tarjan can find the articulation points and bridges(critical edgeMap) of undirected graphs in linear time,
383
384
  * Tarjan solve the bi-connected components of undirected graphs;
384
385
  * Tarjan can find the SSC(strongly connected components), articulation points, and bridges of directed graphs.
385
386
  * The `tarjan` function is used to perform various graph analysis tasks such as finding articulation points, bridges,
386
387
  * strongly connected components (SCCs), and cycles in a graph.
387
388
  * @param {boolean} [needCutVertexes] - A boolean value indicating whether or not to calculate and return the
388
- * articulation points in the graph. Articulation points are the vertices in a graph whose removal would increase the
389
+ * articulation points in the graph. Articulation points are the vertexMap in a graph whose removal would increase the
389
390
  * number of connected components in the graph.
390
391
  * @param {boolean} [needBridges] - A boolean flag indicating whether the algorithm should find and return the bridges
391
- * (edges whose removal would increase the number of connected components in the graph).
392
+ * (edgeMap whose removal would increase the number of connected components in the graph).
392
393
  * @param {boolean} [needSCCs] - A boolean value indicating whether the Strongly Connected Components (SCCs) of the
393
394
  * graph are needed. If set to true, the function will calculate and return the SCCs of the graph. If set to false, the
394
395
  * SCCs will not be calculated or returned.
395
396
  * @param {boolean} [needCycles] - A boolean flag indicating whether the algorithm should find cycles in the graph. If
396
397
  * set to true, the algorithm will return a map of cycles, where the keys are the low values of the SCCs and the values
397
- * are arrays of vertices that form cycles within the SCCs.
398
+ * are arrays of vertexMap that form cycles within the SCCs.
398
399
  * @returns The function `tarjan` returns an object with the following properties:
399
400
  */
400
401
  tarjan(needCutVertexes?: boolean, needBridges?: boolean, needSCCs?: boolean, needCycles?: boolean): {
@@ -466,7 +467,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
466
467
  * @returns The `filter` method returns an array of key-value pairs `[VertexKey, V | undefined][]`
467
468
  * that satisfy the given predicate function.
468
469
  */
469
- filter(predicate: PairCallback<VertexKey, V | undefined, boolean>, thisArg?: any): [VertexKey, V | undefined][];
470
+ filter(predicate: EntryCallback<VertexKey, V | undefined, boolean>, thisArg?: any): [VertexKey, V | undefined][];
470
471
  /**
471
472
  * Time Complexity: O(n)
472
473
  * Space Complexity: O(n)
@@ -484,7 +485,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
484
485
  * used as the `this` value when calling the callback function. If `thisArg` is not provided, `
485
486
  * @returns The `map` function is returning an array of type `T[]`.
486
487
  */
487
- map<T>(callback: PairCallback<VertexKey, V | undefined, T>, thisArg?: any): T[];
488
+ map<T>(callback: EntryCallback<VertexKey, V | undefined, T>, thisArg?: any): T[];
488
489
  protected _getIterator(): IterableIterator<[VertexKey, V | undefined]>;
489
490
  protected abstract _addEdgeOnly(edge: EO): boolean;
490
491
  protected _addVertexOnly(newVertex: VO): boolean;