data-structure-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 (84) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +6 -6
  3. package/dist/cjs/data-structures/base/iterable-base.d.ts +6 -6
  4. package/dist/cjs/data-structures/base/iterable-base.js +3 -3
  5. package/dist/cjs/data-structures/base/iterable-base.js.map +1 -1
  6. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +5 -3
  7. package/dist/cjs/data-structures/binary-tree/avl-tree.js +6 -4
  8. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  9. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +18 -15
  10. package/dist/cjs/data-structures/binary-tree/binary-tree.js +16 -13
  11. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  12. package/dist/cjs/data-structures/binary-tree/bst.d.ts +15 -11
  13. package/dist/cjs/data-structures/binary-tree/bst.js +17 -13
  14. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  15. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +19 -13
  16. package/dist/cjs/data-structures/binary-tree/rb-tree.js +20 -14
  17. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +21 -14
  19. package/dist/cjs/data-structures/binary-tree/tree-multimap.js +25 -18
  20. package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
  21. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +53 -52
  22. package/dist/cjs/data-structures/graph/abstract-graph.js +82 -78
  23. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  24. package/dist/cjs/data-structures/graph/directed-graph.d.ts +70 -52
  25. package/dist/cjs/data-structures/graph/directed-graph.js +111 -65
  26. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  27. package/dist/cjs/data-structures/graph/map-graph.d.ts +5 -5
  28. package/dist/cjs/data-structures/graph/map-graph.js +8 -8
  29. package/dist/cjs/data-structures/graph/map-graph.js.map +1 -1
  30. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +51 -32
  31. package/dist/cjs/data-structures/graph/undirected-graph.js +117 -54
  32. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  33. package/dist/cjs/data-structures/hash/hash-map.d.ts +8 -8
  34. package/dist/cjs/data-structures/hash/hash-map.js +2 -2
  35. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  36. package/dist/cjs/interfaces/binary-tree.d.ts +1 -1
  37. package/dist/cjs/types/data-structures/base/base.d.ts +3 -3
  38. package/dist/mjs/data-structures/base/iterable-base.d.ts +6 -6
  39. package/dist/mjs/data-structures/base/iterable-base.js +1 -1
  40. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +5 -3
  41. package/dist/mjs/data-structures/binary-tree/avl-tree.js +6 -4
  42. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +18 -15
  43. package/dist/mjs/data-structures/binary-tree/binary-tree.js +17 -14
  44. package/dist/mjs/data-structures/binary-tree/bst.d.ts +15 -11
  45. package/dist/mjs/data-structures/binary-tree/bst.js +17 -13
  46. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +19 -13
  47. package/dist/mjs/data-structures/binary-tree/rb-tree.js +20 -14
  48. package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +21 -14
  49. package/dist/mjs/data-structures/binary-tree/tree-multimap.js +25 -18
  50. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +53 -52
  51. package/dist/mjs/data-structures/graph/abstract-graph.js +83 -79
  52. package/dist/mjs/data-structures/graph/directed-graph.d.ts +70 -52
  53. package/dist/mjs/data-structures/graph/directed-graph.js +111 -65
  54. package/dist/mjs/data-structures/graph/map-graph.d.ts +5 -5
  55. package/dist/mjs/data-structures/graph/map-graph.js +8 -8
  56. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +51 -32
  57. package/dist/mjs/data-structures/graph/undirected-graph.js +119 -56
  58. package/dist/mjs/data-structures/hash/hash-map.d.ts +8 -8
  59. package/dist/mjs/data-structures/hash/hash-map.js +3 -3
  60. package/dist/mjs/interfaces/binary-tree.d.ts +1 -1
  61. package/dist/mjs/types/data-structures/base/base.d.ts +3 -3
  62. package/dist/umd/data-structure-typed.js +413 -285
  63. package/dist/umd/data-structure-typed.min.js +2 -2
  64. package/dist/umd/data-structure-typed.min.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/data-structures/base/iterable-base.ts +6 -6
  67. package/src/data-structures/binary-tree/avl-tree.ts +8 -5
  68. package/src/data-structures/binary-tree/binary-tree.ts +23 -19
  69. package/src/data-structures/binary-tree/bst.ts +19 -14
  70. package/src/data-structures/binary-tree/rb-tree.ts +20 -14
  71. package/src/data-structures/binary-tree/tree-multimap.ts +27 -19
  72. package/src/data-structures/graph/abstract-graph.ts +87 -82
  73. package/src/data-structures/graph/directed-graph.ts +114 -65
  74. package/src/data-structures/graph/map-graph.ts +8 -8
  75. package/src/data-structures/graph/undirected-graph.ts +124 -56
  76. package/src/data-structures/hash/hash-map.ts +8 -8
  77. package/src/interfaces/binary-tree.ts +1 -1
  78. package/src/types/data-structures/base/base.ts +3 -3
  79. package/test/integration/bst.test.ts +1 -1
  80. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +1 -1
  81. package/test/unit/data-structures/binary-tree/tree-multimap.test.ts +3 -3
  82. package/test/unit/data-structures/graph/directed-graph.test.ts +52 -15
  83. package/test/unit/data-structures/graph/map-graph.test.ts +3 -3
  84. package/test/unit/data-structures/graph/undirected-graph.test.ts +42 -5
@@ -25,7 +25,7 @@ class DirectedVertex extends abstract_graph_1.AbstractVertex {
25
25
  exports.DirectedVertex = DirectedVertex;
26
26
  class DirectedEdge extends abstract_graph_1.AbstractEdge {
27
27
  /**
28
- * The constructor function initializes the source and destination vertices of an edge, along with an optional weight
28
+ * The constructor function initializes the source and destination vertexMap of an edge, along with an optional weight
29
29
  * and value.
30
30
  * @param {VertexKey} src - The `src` parameter is the source vertex ID. It represents the starting point of an edge in
31
31
  * a graph.
@@ -64,7 +64,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
64
64
  /**
65
65
  * The function creates a new vertex with an optional value and returns it.
66
66
  * @param {VertexKey} key - The `key` parameter is the unique identifier for the vertex. It is of type `VertexKey`, which
67
- * could be a number or a string depending on how you want to identify your vertices.
67
+ * could be a number or a string depending on how you want to identify your vertexMap.
68
68
  * @param [value] - The 'value' parameter is an optional value that can be assigned to the vertex. If a value is provided,
69
69
  * it will be assigned to the 'value' property of the vertex. If no value is provided, the 'value' property will be
70
70
  * assigned the same value as the 'key' parameter
@@ -78,7 +78,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
78
78
  * 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.
79
79
  */
80
80
  /**
81
- * The function creates a directed edge between two vertices with an optional weight and value.
81
+ * The function creates a directed edge between two vertexMap with an optional weight and value.
82
82
  * @param {VertexKey} src - The source vertex ID of the edge. It represents the starting point of the edge.
83
83
  * @param {VertexKey} dest - The `dest` parameter is the identifier of the destination vertex for the edge.
84
84
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge. If no
@@ -91,43 +91,43 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
91
91
  return new DirectedEdge(src, dest, weight !== null && weight !== void 0 ? weight : 1, value);
92
92
  }
93
93
  /**
94
- * Time Complexity: O(|V|) where |V| is the number of vertices
94
+ * Time Complexity: O(|V|) where |V| is the number of vertexMap
95
95
  * Space Complexity: O(1)
96
96
  */
97
97
  /**
98
- * Time Complexity: O(|V|) where |V| is the number of vertices
98
+ * Time Complexity: O(|V|) where |V| is the number of vertexMap
99
99
  * Space Complexity: O(1)
100
100
  *
101
- * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
101
+ * The `getEdge` function retrieves an edge between two vertexMap based on their source and destination IDs.
102
102
  * @param {VO | VertexKey | undefined} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
103
103
  * @param {VO | VertexKey | undefined} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
104
104
  * destination vertex of the edge. It can be either a vertex object (`VO`), a vertex ID (`VertexKey`), or `undefined` if the
105
105
  * destination is not specified.
106
- * @returns the first edge found between the source and destination vertices, or undefined if no such edge is found.
106
+ * @returns the first edge found between the source and destination vertexMap, or undefined if no such edge is found.
107
107
  */
108
108
  getEdge(srcOrKey, destOrKey) {
109
- let edges = [];
109
+ let edgeMap = [];
110
110
  if (srcOrKey !== undefined && destOrKey !== undefined) {
111
111
  const src = this._getVertex(srcOrKey);
112
112
  const dest = this._getVertex(destOrKey);
113
113
  if (src && dest) {
114
114
  const srcOutEdges = this._outEdgeMap.get(src);
115
115
  if (srcOutEdges) {
116
- edges = srcOutEdges.filter(edge => edge.dest === dest.key);
116
+ edgeMap = srcOutEdges.filter(edge => edge.dest === dest.key);
117
117
  }
118
118
  }
119
119
  }
120
- return edges[0] || undefined;
120
+ return edgeMap[0] || undefined;
121
121
  }
122
122
  /**
123
- * Time Complexity: O(|E|) where |E| is the number of edges
123
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
124
124
  * Space Complexity: O(1)
125
125
  */
126
126
  /**
127
- * Time Complexity: O(|E|) where |E| is the number of edges
127
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
128
128
  * Space Complexity: O(1)
129
129
  *
130
- * The function removes an edge between two vertices in a graph and returns the removed edge.
130
+ * The function removes an edge between two vertexMap in a graph and returns the removed edge.
131
131
  * @param {VO | VertexKey} srcOrKey - The source vertex or its ID.
132
132
  * @param {VO | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
133
133
  * @returns the removed edge (EO) if it exists, or undefined if either the source or destination vertex does not exist.
@@ -150,48 +150,94 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
150
150
  return removed;
151
151
  }
152
152
  /**
153
- * Time Complexity: O(|E|) where |E| is the number of edges
153
+ * Time Complexity: O(E) where E is the number of edgeMap
154
154
  * Space Complexity: O(1)
155
155
  */
156
156
  /**
157
- * Time Complexity: O(|E|) where |E| is the number of edges
157
+ * Time Complexity: O(E) where E is the number of edgeMap
158
158
  * Space Complexity: O(1)
159
159
  *
160
- * The function removes an edge from a graph and returns the removed edge, or undefined if the edge was not found.
161
- * @param {EO} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
162
- * and `dest`, which represent the source and destination vertices of the edge, respectively.
163
- * @returns The method `deleteEdge` returns the removed edge (`EO`) if it exists, or `undefined` if the edge does not exist.
164
- */
165
- deleteEdge(edge) {
160
+ * The `deleteEdge` function removes an edge from a graph and returns the removed edge.
161
+ * @param {EO | VertexKey} edgeOrSrcVertexKey - The `edge` parameter can be either an `EO` object (edge object) or
162
+ * a `VertexKey` (key of a vertex).
163
+ * @param {VertexKey} [destVertexKey] - The `destVertexKey` parameter is an optional parameter that
164
+ * represents the key of the destination vertex of the edge. It is used to specify the destination
165
+ * vertex when the `edge` parameter is a vertex key. If `destVertexKey` is not provided, the function
166
+ * assumes that the `edge`
167
+ * @returns the removed edge (EO) or undefined if no edge was removed.
168
+ */
169
+ deleteEdge(edgeOrSrcVertexKey, destVertexKey) {
166
170
  let removed = undefined;
167
- const src = this._getVertex(edge.src);
168
- const dest = this._getVertex(edge.dest);
171
+ let src, dest;
172
+ if (this.isVertexKey(edgeOrSrcVertexKey)) {
173
+ if (this.isVertexKey(destVertexKey)) {
174
+ src = this._getVertex(edgeOrSrcVertexKey);
175
+ dest = this._getVertex(destVertexKey);
176
+ }
177
+ else {
178
+ return;
179
+ }
180
+ }
181
+ else {
182
+ src = this._getVertex(edgeOrSrcVertexKey.src);
183
+ dest = this._getVertex(edgeOrSrcVertexKey.dest);
184
+ }
169
185
  if (src && dest) {
170
186
  const srcOutEdges = this._outEdgeMap.get(src);
171
187
  if (srcOutEdges && srcOutEdges.length > 0) {
172
- (0, utils_1.arrayRemove)(srcOutEdges, (edge) => edge.src === src.key);
188
+ (0, utils_1.arrayRemove)(srcOutEdges, (edge) => edge.src === src.key && edge.dest === (dest === null || dest === void 0 ? void 0 : dest.key));
173
189
  }
174
190
  const destInEdges = this._inEdgeMap.get(dest);
175
191
  if (destInEdges && destInEdges.length > 0) {
176
- removed = (0, utils_1.arrayRemove)(destInEdges, (edge) => edge.dest === dest.key)[0];
192
+ removed = (0, utils_1.arrayRemove)(destInEdges, (edge) => edge.src === src.key && edge.dest === dest.key)[0];
177
193
  }
178
194
  }
179
195
  return removed;
180
196
  }
181
197
  /**
182
- * Time Complexity: O(|E|) where |E| is the number of edges
198
+ * Time Complexity: O(1) - Constant time for Map operations.
199
+ * Space Complexity: O(1) - Constant space, as it creates only a few variables.
200
+ */
201
+ /**
202
+ * Time Complexity: O(1) - Constant time for Map operations.
203
+ * Space Complexity: O(1) - Constant space, as it creates only a few variables.
204
+ *
205
+ * The `deleteVertex` function removes a vertex from a graph by its ID or by the vertex object itself.
206
+ * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
207
+ * (`VertexKey`).
208
+ * @returns The method is returning a boolean value.
209
+ */
210
+ deleteVertex(vertexOrKey) {
211
+ let vertexKey;
212
+ let vertex;
213
+ if (this.isVertexKey(vertexOrKey)) {
214
+ vertex = this.getVertex(vertexOrKey);
215
+ vertexKey = vertexOrKey;
216
+ }
217
+ else {
218
+ vertex = vertexOrKey;
219
+ vertexKey = this._getVertexKey(vertexOrKey);
220
+ }
221
+ if (vertex) {
222
+ this._outEdgeMap.delete(vertex);
223
+ this._inEdgeMap.delete(vertex);
224
+ }
225
+ return this._vertexMap.delete(vertexKey);
226
+ }
227
+ /**
228
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
183
229
  * Space Complexity: O(1)
184
230
  */
185
231
  /**
186
- * Time Complexity: O(|E|) where |E| is the number of edges
232
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
187
233
  * Space Complexity: O(1)
188
234
  *
189
- * The function removes edges between two vertices and returns the removed edges.
235
+ * The function removes edgeMap between two vertexMap and returns the removed edgeMap.
190
236
  * @param {VertexKey | VO} v1 - The parameter `v1` can be either a `VertexKey` or a `VO`. A `VertexKey` represents the
191
237
  * unique identifier of a vertex in a graph, while `VO` represents the actual vertex object.
192
238
  * @param {VertexKey | VO} v2 - The parameter `v2` represents either a `VertexKey` or a `VO` object. It is used to specify
193
239
  * the second vertex in the edge that needs to be removed.
194
- * @returns an array of removed edges (EO[]).
240
+ * @returns an array of removed edgeMap (EO[]).
195
241
  */
196
242
  deleteEdgesBetween(v1, v2) {
197
243
  const removed = [];
@@ -211,10 +257,10 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
211
257
  * Time Complexity: O(1)
212
258
  * Space Complexity: O(1)
213
259
  *
214
- * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
260
+ * The function `incomingEdgesOf` returns an array of incoming edgeMap for a given vertex or vertex ID.
215
261
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
216
262
  * (`VertexKey`).
217
- * @returns The method `incomingEdgesOf` returns an array of edges (`EO[]`).
263
+ * @returns The method `incomingEdgesOf` returns an array of edgeMap (`EO[]`).
218
264
  */
219
265
  incomingEdgesOf(vertexOrKey) {
220
266
  const target = this._getVertex(vertexOrKey);
@@ -231,10 +277,10 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
231
277
  * Time Complexity: O(1)
232
278
  * Space Complexity: O(1)
233
279
  *
234
- * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
280
+ * The function `outgoingEdgesOf` returns an array of outgoing edgeMap from a given vertex or vertex ID.
235
281
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`VO`) or a vertex ID
236
282
  * (`VertexKey`).
237
- * @returns The method `outgoingEdgesOf` returns an array of edges (`EO[]`).
283
+ * @returns The method `outgoingEdgesOf` returns an array of edgeMap (`EO[]`).
238
284
  */
239
285
  outgoingEdgesOf(vertexOrKey) {
240
286
  const target = this._getVertex(vertexOrKey);
@@ -266,9 +312,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
266
312
  * Time Complexity: O(1)
267
313
  * Space Complexity: O(1)
268
314
  *
269
- * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
315
+ * The function "inDegreeOf" returns the number of incoming edgeMap for a given vertex.
270
316
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
271
- * @returns The number of incoming edges of the specified vertex or vertex ID.
317
+ * @returns The number of incoming edgeMap of the specified vertex or vertex ID.
272
318
  */
273
319
  inDegreeOf(vertexOrKey) {
274
320
  return this.incomingEdgesOf(vertexOrKey).length;
@@ -281,9 +327,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
281
327
  * Time Complexity: O(1)
282
328
  * Space Complexity: O(1)
283
329
  *
284
- * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
330
+ * The function `outDegreeOf` returns the number of outgoing edgeMap from a given vertex.
285
331
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
286
- * @returns The number of outgoing edges from the specified vertex or vertex ID.
332
+ * @returns The number of outgoing edgeMap from the specified vertex or vertex ID.
287
333
  */
288
334
  outDegreeOf(vertexOrKey) {
289
335
  return this.outgoingEdgesOf(vertexOrKey).length;
@@ -296,9 +342,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
296
342
  * Time Complexity: O(1)
297
343
  * Space Complexity: O(1)
298
344
  *
299
- * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
345
+ * The function "edgesOf" returns an array of both outgoing and incoming edgeMap of a given vertex or vertex ID.
300
346
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
301
- * @returns The function `edgesOf` returns an array of edges.
347
+ * @returns The function `edgesOf` returns an array of edgeMap.
302
348
  */
303
349
  edgesOf(vertexOrKey) {
304
350
  return [...this.outgoingEdgesOf(vertexOrKey), ...this.incomingEdgesOf(vertexOrKey)];
@@ -334,17 +380,17 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
334
380
  return this._getVertex(e.dest);
335
381
  }
336
382
  /**
337
- * Time Complexity: O(|E|) where |E| is the number of edges
383
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
338
384
  * Space Complexity: O(1)
339
385
  */
340
386
  /**
341
- * Time Complexity: O(|E|) where |E| is the number of edges
387
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
342
388
  * Space Complexity: O(1)
343
389
  *
344
- * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
390
+ * The function `getDestinations` returns an array of destination vertexMap connected to a given vertex.
345
391
  * @param {VO | VertexKey | undefined} vertex - The `vertex` parameter represents the starting vertex from which we want to
346
392
  * find the destinations. It can be either a `VO` object, a `VertexKey` value, or `undefined`.
347
- * @returns an array of vertices (VO[]).
393
+ * @returns an array of vertexMap (VO[]).
348
394
  */
349
395
  getDestinations(vertex) {
350
396
  if (vertex === undefined) {
@@ -361,26 +407,26 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
361
407
  return destinations;
362
408
  }
363
409
  /**
364
- * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
410
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertexMap and |E| is the number of edgeMap
365
411
  * Space Complexity: O(|V|)
366
412
  */
367
413
  /**
368
- * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
414
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertexMap and |E| is the number of edgeMap
369
415
  * Space Complexity: O(|V|)
370
416
  *
371
- * The `topologicalSort` function performs a topological sort on a graph and returns an array of vertices or vertex IDs
417
+ * The `topologicalSort` function performs a topological sort on a graph and returns an array of vertexMap or vertex IDs
372
418
  * in the sorted order, or undefined if the graph contains a cycle.
373
419
  * @param {'vertex' | 'key'} [propertyName] - The `propertyName` parameter is an optional parameter that specifies the
374
- * property to use for sorting the vertices. It can have two possible values: 'vertex' or 'key'. If 'vertex' is
375
- * specified, the vertices themselves will be used for sorting. If 'key' is specified, the ids of
376
- * @returns an array of vertices or vertex IDs in topological order. If there is a cycle in the graph, it returns undefined.
420
+ * property to use for sorting the vertexMap. It can have two possible values: 'vertex' or 'key'. If 'vertex' is
421
+ * specified, the vertexMap themselves will be used for sorting. If 'key' is specified, the ids of
422
+ * @returns an array of vertexMap or vertex IDs in topological order. If there is a cycle in the graph, it returns undefined.
377
423
  */
378
424
  topologicalSort(propertyName) {
379
425
  propertyName = propertyName !== null && propertyName !== void 0 ? propertyName : 'key';
380
426
  // When judging whether there is a cycle in the undirected graph, all nodes with degree of **<= 1** are enqueued
381
427
  // When judging whether there is a cycle in the directed graph, all nodes with **in degree = 0** are enqueued
382
428
  const statusMap = new Map();
383
- for (const entry of this.vertices) {
429
+ for (const entry of this.vertexMap) {
384
430
  statusMap.set(entry[1], 0);
385
431
  }
386
432
  let sorted = [];
@@ -400,7 +446,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
400
446
  statusMap.set(cur, 2);
401
447
  sorted.push(cur);
402
448
  };
403
- for (const entry of this.vertices) {
449
+ for (const entry of this.vertexMap) {
404
450
  if (statusMap.get(entry[1]) === 0) {
405
451
  dfs(entry[1]);
406
452
  }
@@ -412,35 +458,35 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
412
458
  return sorted.reverse();
413
459
  }
414
460
  /**
415
- * Time Complexity: O(|E|) where |E| is the number of edges
461
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
416
462
  * Space Complexity: O(|E|)
417
463
  */
418
464
  /**
419
- * Time Complexity: O(|E|) where |E| is the number of edges
465
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
420
466
  * Space Complexity: O(|E|)
421
467
  *
422
- * The `edgeSet` function returns an array of all the edges in the graph.
423
- * @returns The `edgeSet()` method returns an array of edges (`EO[]`).
468
+ * The `edgeSet` function returns an array of all the edgeMap in the graph.
469
+ * @returns The `edgeSet()` method returns an array of edgeMap (`EO[]`).
424
470
  */
425
471
  edgeSet() {
426
- let edges = [];
472
+ let edgeMap = [];
427
473
  this._outEdgeMap.forEach(outEdges => {
428
- edges = [...edges, ...outEdges];
474
+ edgeMap = [...edgeMap, ...outEdges];
429
475
  });
430
- return edges;
476
+ return edgeMap;
431
477
  }
432
478
  /**
433
- * Time Complexity: O(|E|) where |E| is the number of edges
479
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
434
480
  * Space Complexity: O(1)
435
481
  */
436
482
  /**
437
- * Time Complexity: O(|E|) where |E| is the number of edges
483
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
438
484
  * Space Complexity: O(1)
439
485
  *
440
- * The function `getNeighbors` returns an array of neighboring vertices of a given vertex or vertex ID in a graph.
486
+ * The function `getNeighbors` returns an array of neighboring vertexMap of a given vertex or vertex ID in a graph.
441
487
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
442
488
  * (`VertexKey`).
443
- * @returns an array of vertices (VO[]).
489
+ * @returns an array of vertexMap (VO[]).
444
490
  */
445
491
  getNeighbors(vertexOrKey) {
446
492
  const neighbors = [];
@@ -465,10 +511,10 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
465
511
  * Time Complexity: O(1)
466
512
  * Space Complexity: O(1)
467
513
  *
468
- * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
514
+ * The function "getEndsOfEdge" returns the source and destination vertexMap of an edge if it exists in the graph,
469
515
  * otherwise it returns undefined.
470
516
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph.
471
- * @returns The function `getEndsOfEdge` returns an array containing two vertices `[VO, VO]` if the edge exists in the
517
+ * @returns The function `getEndsOfEdge` returns an array containing two vertexMap `[VO, VO]` if the edge exists in the
472
518
  * graph. If the edge does not exist, it returns `undefined`.
473
519
  */
474
520
  getEndsOfEdge(edge) {
@@ -492,7 +538,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
492
538
  * Time Complexity: O(1)
493
539
  * Space Complexity: O(1)
494
540
  *
495
- * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertices exist.
541
+ * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertexMap exist.
496
542
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph. It is the edge that
497
543
  * needs to be added to the graph.
498
544
  * @returns a boolean value. It returns true if the edge was successfully added to the graph, and false if either the
@@ -1 +1 @@
1
- {"version":3,"file":"directed-graph.js","sourceRoot":"","sources":["../../../../src/data-structures/graph/directed-graph.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,uCAA0C;AAC1C,qDAA+E;AAI/E,MAAa,cAAwB,SAAQ,+BAAiB;IAC5D;;;;;;OAMG;IACH,YAAY,GAAc,EAAE,KAAS;QACnC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpB,CAAC;CACF;AAXD,wCAWC;AAED,MAAa,YAAsB,SAAQ,6BAAe;IAIxD;;;;;;;;;;OAUG;IACH,YAAY,GAAc,EAAE,IAAe,EAAE,MAAe,EAAE,KAAS;QACrE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AApBD,oCAoBC;AAED,MAAa,aAMX,SAAQ,8BAA2B;IAEnC;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;QAGA,gBAAW,GAAkB,IAAI,GAAG,EAAY,CAAC;QAMjD,eAAU,GAAkB,IAAI,GAAG,EAAY,CAAC;IAR1D,CAAC;IAID,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AI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,6DAA6D;QAC7D,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;YAC5B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACpD,IAAI,WAAW,EAAE,CAAC;gBAChB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1C,CAAC;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACpD,IAAI,WAAW,EAAE,CAAC;gBAChB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1C,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACN,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAjiBD,sCAiiBC"}
1
+ {"version":3,"file":"directed-graph.js","sourceRoot":"","sources":["../../../../src/data-structures/graph/directed-graph.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,uCAA0C;AAC1C,qDAA+E;AAI/E,MAAa,cAAwB,SAAQ,+BAAiB;IAC5D;;;;;;OAMG;IACH,YAAY,GAAc,EAAE,KAAS;QACnC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpB,CAAC;CACF;AAXD,wCAWC;AAED,MAAa,YAAsB,SAAQ,6BAAe;IAIxD;;;;;;;;;;OAUG;IACH,YAAY,GA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<V = any, E = any, VO extends MapVertex<V> = MapVertex<V>, EO extends MapEdge<E> = MapEdge<E>> extends DirectedGraph<V, E, VO, EO> {
34
34
  /**
35
- * The constructor function initializes the origin and bottomRight properties of a MapGraphCoordinate object.
36
- * @param {MapGraphCoordinate} origin - The `origin` parameter is a `MapGraphCoordinate` object that represents the
35
+ * The constructor function initializes the originCoord and bottomRight properties of a MapGraphCoordinate object.
36
+ * @param {MapGraphCoordinate} originCoord - The `originCoord` parameter is a `MapGraphCoordinate` object that represents the
37
37
  * starting point or reference point of the map graph. It defines the coordinates of the top-left corner of the map
38
38
  * graph.
39
39
  * @param {MapGraphCoordinate} [bottomRight] - The `bottomRight` parameter is an optional parameter of type
40
40
  * `MapGraphCoordinate`. It represents the bottom right coordinate of a map graph. If this parameter is not provided,
41
41
  * it will default to `undefined`.
42
42
  */
43
- constructor(origin: MapGraphCoordinate, bottomRight?: MapGraphCoordinate);
44
- protected _origin: MapGraphCoordinate;
45
- get origin(): MapGraphCoordinate;
43
+ constructor(originCoord: MapGraphCoordinate, bottomRight?: MapGraphCoordinate);
44
+ protected _originCoord: MapGraphCoordinate;
45
+ get originCoord(): MapGraphCoordinate;
46
46
  protected _bottomRight: MapGraphCoordinate | undefined;
47
47
  get bottomRight(): MapGraphCoordinate | undefined;
48
48
  /**
@@ -40,22 +40,22 @@ class MapEdge extends directed_graph_1.DirectedEdge {
40
40
  exports.MapEdge = MapEdge;
41
41
  class MapGraph extends directed_graph_1.DirectedGraph {
42
42
  /**
43
- * The constructor function initializes the origin and bottomRight properties of a MapGraphCoordinate object.
44
- * @param {MapGraphCoordinate} origin - The `origin` parameter is a `MapGraphCoordinate` object that represents the
43
+ * The constructor function initializes the originCoord and bottomRight properties of a MapGraphCoordinate object.
44
+ * @param {MapGraphCoordinate} originCoord - The `originCoord` parameter is a `MapGraphCoordinate` object that represents the
45
45
  * starting point or reference point of the map graph. It defines the coordinates of the top-left corner of the map
46
46
  * graph.
47
47
  * @param {MapGraphCoordinate} [bottomRight] - The `bottomRight` parameter is an optional parameter of type
48
48
  * `MapGraphCoordinate`. It represents the bottom right coordinate of a map graph. If this parameter is not provided,
49
49
  * it will default to `undefined`.
50
50
  */
51
- constructor(origin, bottomRight) {
51
+ constructor(originCoord, bottomRight) {
52
52
  super();
53
- this._origin = [0, 0];
54
- this._origin = origin;
53
+ this._originCoord = [0, 0];
54
+ this._originCoord = originCoord;
55
55
  this._bottomRight = bottomRight;
56
56
  }
57
- get origin() {
58
- return this._origin;
57
+ get originCoord() {
58
+ return this._originCoord;
59
59
  }
60
60
  get bottomRight() {
61
61
  return this._bottomRight;
@@ -71,7 +71,7 @@ class MapGraph extends directed_graph_1.DirectedGraph {
71
71
  * @param {number} long - The `long` parameter represents the longitude coordinate of the vertex.
72
72
  * @returns The method is returning a new instance of the `MapVertex` class, casted as type `VO`.
73
73
  */
74
- createVertex(key, value, lat = this.origin[0], long = this.origin[1]) {
74
+ createVertex(key, value, lat = this.originCoord[0], long = this.originCoord[1]) {
75
75
  return new MapVertex(key, value, lat, long);
76
76
  }
77
77
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"map-graph.js","sourceRoot":"","sources":["../../../../src/data-structures/graph/map-graph.ts"],"names":[],"mappings":";;;AACA,qDAA+E;AAE/E,MAAa,SAAmB,SAAQ,+BAAiB;IAIvD;;;;;;;;;;;OAWG;IACH,YAAY,GAAc,EAAE,KAAQ,EAAE,GAAW,EAAE,IAAY;QAC7D,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AArBD,8BAqBC;AAED,MAAa,OAAiB,SAAQ,6BAAe;IACnD;;;;;;;;;OASG;IACH,YAAY,GAAc,EAAE,IAAe,EAAE,MAAe,EAAE,KAAS;QACrE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IA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