graph-typed 1.48.4 → 1.48.6

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 +24 -22
  6. package/dist/data-structures/binary-tree/binary-tree.js +35 -22
  7. package/dist/data-structures/binary-tree/bst.d.ts +30 -22
  8. package/dist/data-structures/binary-tree/bst.js +38 -26
  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 +52 -52
  14. package/dist/data-structures/graph/abstract-graph.js +78 -78
  15. package/dist/data-structures/graph/directed-graph.d.ts +47 -47
  16. package/dist/data-structures/graph/directed-graph.js +56 -56
  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 +29 -29
  20. package/dist/data-structures/graph/undirected-graph.js +57 -57
  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 +2 -2
  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 +7 -4
  28. package/src/data-structures/binary-tree/binary-tree.ts +47 -27
  29. package/src/data-structures/binary-tree/bst.ts +52 -32
  30. package/src/data-structures/binary-tree/rb-tree.ts +20 -14
  31. package/src/data-structures/binary-tree/tree-multimap.ts +26 -18
  32. package/src/data-structures/graph/abstract-graph.ts +82 -82
  33. package/src/data-structures/graph/directed-graph.ts +56 -56
  34. package/src/data-structures/graph/map-graph.ts +8 -8
  35. package/src/data-structures/graph/undirected-graph.ts +59 -59
  36. package/src/data-structures/hash/hash-map.ts +8 -8
  37. package/src/interfaces/binary-tree.ts +2 -2
  38. package/src/types/data-structures/base/base.ts +3 -3
@@ -15,7 +15,7 @@ export declare class DirectedEdge<E = any> extends AbstractEdge<E> {
15
15
  src: VertexKey;
16
16
  dest: VertexKey;
17
17
  /**
18
- * The constructor function initializes the source and destination vertices of an edge, along with an optional weight
18
+ * The constructor function initializes the source and destination vertexMap of an edge, along with an optional weight
19
19
  * and value.
20
20
  * @param {VertexKey} src - The `src` parameter is the source vertex ID. It represents the starting point of an edge in
21
21
  * a graph.
@@ -43,7 +43,7 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
43
43
  /**
44
44
  * The function creates a new vertex with an optional value and returns it.
45
45
  * @param {VertexKey} key - The `key` parameter is the unique identifier for the vertex. It is of type `VertexKey`, which
46
- * could be a number or a string depending on how you want to identify your vertices.
46
+ * could be a number or a string depending on how you want to identify your vertexMap.
47
47
  * @param [value] - The 'value' parameter is an optional value that can be assigned to the vertex. If a value is provided,
48
48
  * it will be assigned to the 'value' property of the vertex. If no value is provided, the 'value' property will be
49
49
  * assigned the same value as the 'key' parameter
@@ -55,7 +55,7 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
55
55
  * 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.
56
56
  */
57
57
  /**
58
- * The function creates a directed edge between two vertices with an optional weight and value.
58
+ * The function creates a directed edge between two vertexMap with an optional weight and value.
59
59
  * @param {VertexKey} src - The source vertex ID of the edge. It represents the starting point of the edge.
60
60
  * @param {VertexKey} dest - The `dest` parameter is the identifier of the destination vertex for the edge.
61
61
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge. If no
@@ -66,41 +66,41 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
66
66
  */
67
67
  createEdge(src: VertexKey, dest: VertexKey, weight?: number, value?: E): EO;
68
68
  /**
69
- * Time Complexity: O(|V|) where |V| is the number of vertices
69
+ * Time Complexity: O(|V|) where |V| is the number of vertexMap
70
70
  * Space Complexity: O(1)
71
71
  */
72
72
  /**
73
- * Time Complexity: O(|V|) where |V| is the number of vertices
73
+ * Time Complexity: O(|V|) where |V| is the number of vertexMap
74
74
  * Space Complexity: O(1)
75
75
  *
76
- * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
76
+ * The `getEdge` function retrieves an edge between two vertexMap based on their source and destination IDs.
77
77
  * @param {VO | VertexKey | undefined} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
78
78
  * @param {VO | VertexKey | undefined} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
79
79
  * destination vertex of the edge. It can be either a vertex object (`VO`), a vertex ID (`VertexKey`), or `undefined` if the
80
80
  * destination is not specified.
81
- * @returns the first edge found between the source and destination vertices, or undefined if no such edge is found.
81
+ * @returns the first edge found between the source and destination vertexMap, or undefined if no such edge is found.
82
82
  */
83
83
  getEdge(srcOrKey: VO | VertexKey | undefined, destOrKey: VO | VertexKey | undefined): EO | undefined;
84
84
  /**
85
- * Time Complexity: O(|E|) where |E| is the number of edges
85
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
86
86
  * Space Complexity: O(1)
87
87
  */
88
88
  /**
89
- * Time Complexity: O(|E|) where |E| is the number of edges
89
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
90
90
  * Space Complexity: O(1)
91
91
  *
92
- * The function removes an edge between two vertices in a graph and returns the removed edge.
92
+ * The function removes an edge between two vertexMap in a graph and returns the removed edge.
93
93
  * @param {VO | VertexKey} srcOrKey - The source vertex or its ID.
94
94
  * @param {VO | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
95
95
  * @returns the removed edge (EO) if it exists, or undefined if either the source or destination vertex does not exist.
96
96
  */
97
97
  deleteEdgeSrcToDest(srcOrKey: VO | VertexKey, destOrKey: VO | VertexKey): EO | undefined;
98
98
  /**
99
- * Time Complexity: O(E) where E is the number of edges
99
+ * Time Complexity: O(E) where E is the number of edgeMap
100
100
  * Space Complexity: O(1)
101
101
  */
102
102
  /**
103
- * Time Complexity: O(E) where E is the number of edges
103
+ * Time Complexity: O(E) where E is the number of edgeMap
104
104
  * Space Complexity: O(1)
105
105
  *
106
106
  * The `deleteEdge` function removes an edge from a graph and returns the removed edge.
@@ -128,19 +128,19 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
128
128
  */
129
129
  deleteVertex(vertexOrKey: VO | VertexKey): boolean;
130
130
  /**
131
- * Time Complexity: O(|E|) where |E| is the number of edges
131
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
132
132
  * Space Complexity: O(1)
133
133
  */
134
134
  /**
135
- * Time Complexity: O(|E|) where |E| is the number of edges
135
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
136
136
  * Space Complexity: O(1)
137
137
  *
138
- * The function removes edges between two vertices and returns the removed edges.
138
+ * The function removes edgeMap between two vertexMap and returns the removed edgeMap.
139
139
  * @param {VertexKey | VO} v1 - The parameter `v1` can be either a `VertexKey` or a `VO`. A `VertexKey` represents the
140
140
  * unique identifier of a vertex in a graph, while `VO` represents the actual vertex object.
141
141
  * @param {VertexKey | VO} v2 - The parameter `v2` represents either a `VertexKey` or a `VO` object. It is used to specify
142
142
  * the second vertex in the edge that needs to be removed.
143
- * @returns an array of removed edges (EO[]).
143
+ * @returns an array of removed edgeMap (EO[]).
144
144
  */
145
145
  deleteEdgesBetween(v1: VertexKey | VO, v2: VertexKey | VO): EO[];
146
146
  /**
@@ -151,10 +151,10 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
151
151
  * Time Complexity: O(1)
152
152
  * Space Complexity: O(1)
153
153
  *
154
- * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
154
+ * The function `incomingEdgesOf` returns an array of incoming edgeMap for a given vertex or vertex ID.
155
155
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
156
156
  * (`VertexKey`).
157
- * @returns The method `incomingEdgesOf` returns an array of edges (`EO[]`).
157
+ * @returns The method `incomingEdgesOf` returns an array of edgeMap (`EO[]`).
158
158
  */
159
159
  incomingEdgesOf(vertexOrKey: VO | VertexKey): EO[];
160
160
  /**
@@ -165,10 +165,10 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
165
165
  * Time Complexity: O(1)
166
166
  * Space Complexity: O(1)
167
167
  *
168
- * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
168
+ * The function `outgoingEdgesOf` returns an array of outgoing edgeMap from a given vertex or vertex ID.
169
169
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`VO`) or a vertex ID
170
170
  * (`VertexKey`).
171
- * @returns The method `outgoingEdgesOf` returns an array of edges (`EO[]`).
171
+ * @returns The method `outgoingEdgesOf` returns an array of edgeMap (`EO[]`).
172
172
  */
173
173
  outgoingEdgesOf(vertexOrKey: VO | VertexKey): EO[];
174
174
  /**
@@ -192,9 +192,9 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
192
192
  * Time Complexity: O(1)
193
193
  * Space Complexity: O(1)
194
194
  *
195
- * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
195
+ * The function "inDegreeOf" returns the number of incoming edgeMap for a given vertex.
196
196
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
197
- * @returns The number of incoming edges of the specified vertex or vertex ID.
197
+ * @returns The number of incoming edgeMap of the specified vertex or vertex ID.
198
198
  */
199
199
  inDegreeOf(vertexOrKey: VertexKey | VO): number;
200
200
  /**
@@ -205,9 +205,9 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
205
205
  * Time Complexity: O(1)
206
206
  * Space Complexity: O(1)
207
207
  *
208
- * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
208
+ * The function `outDegreeOf` returns the number of outgoing edgeMap from a given vertex.
209
209
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
210
- * @returns The number of outgoing edges from the specified vertex or vertex ID.
210
+ * @returns The number of outgoing edgeMap from the specified vertex or vertex ID.
211
211
  */
212
212
  outDegreeOf(vertexOrKey: VertexKey | VO): number;
213
213
  /**
@@ -218,9 +218,9 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
218
218
  * Time Complexity: O(1)
219
219
  * Space Complexity: O(1)
220
220
  *
221
- * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
221
+ * The function "edgesOf" returns an array of both outgoing and incoming edgeMap of a given vertex or vertex ID.
222
222
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
223
- * @returns The function `edgesOf` returns an array of edges.
223
+ * @returns The function `edgesOf` returns an array of edgeMap.
224
224
  */
225
225
  edgesOf(vertexOrKey: VertexKey | VO): EO[];
226
226
  /**
@@ -250,59 +250,59 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
250
250
  */
251
251
  getEdgeDest(e: EO): VO | undefined;
252
252
  /**
253
- * Time Complexity: O(|E|) where |E| is the number of edges
253
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
254
254
  * Space Complexity: O(1)
255
255
  */
256
256
  /**
257
- * Time Complexity: O(|E|) where |E| is the number of edges
257
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
258
258
  * Space Complexity: O(1)
259
259
  *
260
- * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
260
+ * The function `getDestinations` returns an array of destination vertexMap connected to a given vertex.
261
261
  * @param {VO | VertexKey | undefined} vertex - The `vertex` parameter represents the starting vertex from which we want to
262
262
  * find the destinations. It can be either a `VO` object, a `VertexKey` value, or `undefined`.
263
- * @returns an array of vertices (VO[]).
263
+ * @returns an array of vertexMap (VO[]).
264
264
  */
265
265
  getDestinations(vertex: VO | VertexKey | undefined): VO[];
266
266
  /**
267
- * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
267
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertexMap and |E| is the number of edgeMap
268
268
  * Space Complexity: O(|V|)
269
269
  */
270
270
  /**
271
- * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
271
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertexMap and |E| is the number of edgeMap
272
272
  * Space Complexity: O(|V|)
273
273
  *
274
- * The `topologicalSort` function performs a topological sort on a graph and returns an array of vertices or vertex IDs
274
+ * The `topologicalSort` function performs a topological sort on a graph and returns an array of vertexMap or vertex IDs
275
275
  * in the sorted order, or undefined if the graph contains a cycle.
276
276
  * @param {'vertex' | 'key'} [propertyName] - The `propertyName` parameter is an optional parameter that specifies the
277
- * property to use for sorting the vertices. It can have two possible values: 'vertex' or 'key'. If 'vertex' is
278
- * specified, the vertices themselves will be used for sorting. If 'key' is specified, the ids of
279
- * @returns an array of vertices or vertex IDs in topological order. If there is a cycle in the graph, it returns undefined.
277
+ * property to use for sorting the vertexMap. It can have two possible values: 'vertex' or 'key'. If 'vertex' is
278
+ * specified, the vertexMap themselves will be used for sorting. If 'key' is specified, the ids of
279
+ * @returns an array of vertexMap or vertex IDs in topological order. If there is a cycle in the graph, it returns undefined.
280
280
  */
281
281
  topologicalSort(propertyName?: 'vertex' | 'key'): Array<VO | VertexKey> | undefined;
282
282
  /**
283
- * Time Complexity: O(|E|) where |E| is the number of edges
283
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
284
284
  * Space Complexity: O(|E|)
285
285
  */
286
286
  /**
287
- * Time Complexity: O(|E|) where |E| is the number of edges
287
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
288
288
  * Space Complexity: O(|E|)
289
289
  *
290
- * The `edgeSet` function returns an array of all the edges in the graph.
291
- * @returns The `edgeSet()` method returns an array of edges (`EO[]`).
290
+ * The `edgeSet` function returns an array of all the edgeMap in the graph.
291
+ * @returns The `edgeSet()` method returns an array of edgeMap (`EO[]`).
292
292
  */
293
293
  edgeSet(): EO[];
294
294
  /**
295
- * Time Complexity: O(|E|) where |E| is the number of edges
295
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
296
296
  * Space Complexity: O(1)
297
297
  */
298
298
  /**
299
- * Time Complexity: O(|E|) where |E| is the number of edges
299
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
300
300
  * Space Complexity: O(1)
301
301
  *
302
- * The function `getNeighbors` returns an array of neighboring vertices of a given vertex or vertex ID in a graph.
302
+ * The function `getNeighbors` returns an array of neighboring vertexMap of a given vertex or vertex ID in a graph.
303
303
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
304
304
  * (`VertexKey`).
305
- * @returns an array of vertices (VO[]).
305
+ * @returns an array of vertexMap (VO[]).
306
306
  */
307
307
  getNeighbors(vertexOrKey: VO | VertexKey): VO[];
308
308
  /**
@@ -313,10 +313,10 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
313
313
  * Time Complexity: O(1)
314
314
  * Space Complexity: O(1)
315
315
  *
316
- * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
316
+ * The function "getEndsOfEdge" returns the source and destination vertexMap of an edge if it exists in the graph,
317
317
  * otherwise it returns undefined.
318
318
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph.
319
- * @returns The function `getEndsOfEdge` returns an array containing two vertices `[VO, VO]` if the edge exists in the
319
+ * @returns The function `getEndsOfEdge` returns an array containing two vertexMap `[VO, VO]` if the edge exists in the
320
320
  * graph. If the edge does not exist, it returns `undefined`.
321
321
  */
322
322
  getEndsOfEdge(edge: EO): [VO, VO] | undefined;
@@ -328,7 +328,7 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
328
328
  * Time Complexity: O(1)
329
329
  * Space Complexity: O(1)
330
330
  *
331
- * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertices exist.
331
+ * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertexMap exist.
332
332
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph. It is the edge that
333
333
  * needs to be added to the graph.
334
334
  * @returns a boolean value. It returns true if the edge was successfully added to the graph, and false if either the
@@ -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,11 +150,11 @@ 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
160
  * The `deleteEdge` function removes an edge from a graph and returns the removed edge.
@@ -222,22 +222,22 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
222
222
  this._outEdgeMap.delete(vertex);
223
223
  this._inEdgeMap.delete(vertex);
224
224
  }
225
- return this._vertices.delete(vertexKey);
225
+ return this._vertexMap.delete(vertexKey);
226
226
  }
227
227
  /**
228
- * Time Complexity: O(|E|) where |E| is the number of edges
228
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
229
229
  * Space Complexity: O(1)
230
230
  */
231
231
  /**
232
- * Time Complexity: O(|E|) where |E| is the number of edges
232
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
233
233
  * Space Complexity: O(1)
234
234
  *
235
- * 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.
236
236
  * @param {VertexKey | VO} v1 - The parameter `v1` can be either a `VertexKey` or a `VO`. A `VertexKey` represents the
237
237
  * unique identifier of a vertex in a graph, while `VO` represents the actual vertex object.
238
238
  * @param {VertexKey | VO} v2 - The parameter `v2` represents either a `VertexKey` or a `VO` object. It is used to specify
239
239
  * the second vertex in the edge that needs to be removed.
240
- * @returns an array of removed edges (EO[]).
240
+ * @returns an array of removed edgeMap (EO[]).
241
241
  */
242
242
  deleteEdgesBetween(v1, v2) {
243
243
  const removed = [];
@@ -257,10 +257,10 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
257
257
  * Time Complexity: O(1)
258
258
  * Space Complexity: O(1)
259
259
  *
260
- * 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.
261
261
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
262
262
  * (`VertexKey`).
263
- * @returns The method `incomingEdgesOf` returns an array of edges (`EO[]`).
263
+ * @returns The method `incomingEdgesOf` returns an array of edgeMap (`EO[]`).
264
264
  */
265
265
  incomingEdgesOf(vertexOrKey) {
266
266
  const target = this._getVertex(vertexOrKey);
@@ -277,10 +277,10 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
277
277
  * Time Complexity: O(1)
278
278
  * Space Complexity: O(1)
279
279
  *
280
- * 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.
281
281
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`VO`) or a vertex ID
282
282
  * (`VertexKey`).
283
- * @returns The method `outgoingEdgesOf` returns an array of edges (`EO[]`).
283
+ * @returns The method `outgoingEdgesOf` returns an array of edgeMap (`EO[]`).
284
284
  */
285
285
  outgoingEdgesOf(vertexOrKey) {
286
286
  const target = this._getVertex(vertexOrKey);
@@ -312,9 +312,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
312
312
  * Time Complexity: O(1)
313
313
  * Space Complexity: O(1)
314
314
  *
315
- * 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.
316
316
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
317
- * @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.
318
318
  */
319
319
  inDegreeOf(vertexOrKey) {
320
320
  return this.incomingEdgesOf(vertexOrKey).length;
@@ -327,9 +327,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
327
327
  * Time Complexity: O(1)
328
328
  * Space Complexity: O(1)
329
329
  *
330
- * 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.
331
331
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
332
- * @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.
333
333
  */
334
334
  outDegreeOf(vertexOrKey) {
335
335
  return this.outgoingEdgesOf(vertexOrKey).length;
@@ -342,9 +342,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
342
342
  * Time Complexity: O(1)
343
343
  * Space Complexity: O(1)
344
344
  *
345
- * 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.
346
346
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
347
- * @returns The function `edgesOf` returns an array of edges.
347
+ * @returns The function `edgesOf` returns an array of edgeMap.
348
348
  */
349
349
  edgesOf(vertexOrKey) {
350
350
  return [...this.outgoingEdgesOf(vertexOrKey), ...this.incomingEdgesOf(vertexOrKey)];
@@ -380,17 +380,17 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
380
380
  return this._getVertex(e.dest);
381
381
  }
382
382
  /**
383
- * Time Complexity: O(|E|) where |E| is the number of edges
383
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
384
384
  * Space Complexity: O(1)
385
385
  */
386
386
  /**
387
- * Time Complexity: O(|E|) where |E| is the number of edges
387
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
388
388
  * Space Complexity: O(1)
389
389
  *
390
- * 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.
391
391
  * @param {VO | VertexKey | undefined} vertex - The `vertex` parameter represents the starting vertex from which we want to
392
392
  * find the destinations. It can be either a `VO` object, a `VertexKey` value, or `undefined`.
393
- * @returns an array of vertices (VO[]).
393
+ * @returns an array of vertexMap (VO[]).
394
394
  */
395
395
  getDestinations(vertex) {
396
396
  if (vertex === undefined) {
@@ -407,26 +407,26 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
407
407
  return destinations;
408
408
  }
409
409
  /**
410
- * 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
411
411
  * Space Complexity: O(|V|)
412
412
  */
413
413
  /**
414
- * 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
415
415
  * Space Complexity: O(|V|)
416
416
  *
417
- * 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
418
418
  * in the sorted order, or undefined if the graph contains a cycle.
419
419
  * @param {'vertex' | 'key'} [propertyName] - The `propertyName` parameter is an optional parameter that specifies the
420
- * property to use for sorting the vertices. It can have two possible values: 'vertex' or 'key'. If 'vertex' is
421
- * specified, the vertices themselves will be used for sorting. If 'key' is specified, the ids of
422
- * @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.
423
423
  */
424
424
  topologicalSort(propertyName) {
425
425
  propertyName = propertyName !== null && propertyName !== void 0 ? propertyName : 'key';
426
426
  // When judging whether there is a cycle in the undirected graph, all nodes with degree of **<= 1** are enqueued
427
427
  // When judging whether there is a cycle in the directed graph, all nodes with **in degree = 0** are enqueued
428
428
  const statusMap = new Map();
429
- for (const entry of this.vertices) {
429
+ for (const entry of this.vertexMap) {
430
430
  statusMap.set(entry[1], 0);
431
431
  }
432
432
  let sorted = [];
@@ -446,7 +446,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
446
446
  statusMap.set(cur, 2);
447
447
  sorted.push(cur);
448
448
  };
449
- for (const entry of this.vertices) {
449
+ for (const entry of this.vertexMap) {
450
450
  if (statusMap.get(entry[1]) === 0) {
451
451
  dfs(entry[1]);
452
452
  }
@@ -458,35 +458,35 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
458
458
  return sorted.reverse();
459
459
  }
460
460
  /**
461
- * Time Complexity: O(|E|) where |E| is the number of edges
461
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
462
462
  * Space Complexity: O(|E|)
463
463
  */
464
464
  /**
465
- * Time Complexity: O(|E|) where |E| is the number of edges
465
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
466
466
  * Space Complexity: O(|E|)
467
467
  *
468
- * The `edgeSet` function returns an array of all the edges in the graph.
469
- * @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[]`).
470
470
  */
471
471
  edgeSet() {
472
- let edges = [];
472
+ let edgeMap = [];
473
473
  this._outEdgeMap.forEach(outEdges => {
474
- edges = [...edges, ...outEdges];
474
+ edgeMap = [...edgeMap, ...outEdges];
475
475
  });
476
- return edges;
476
+ return edgeMap;
477
477
  }
478
478
  /**
479
- * Time Complexity: O(|E|) where |E| is the number of edges
479
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
480
480
  * Space Complexity: O(1)
481
481
  */
482
482
  /**
483
- * Time Complexity: O(|E|) where |E| is the number of edges
483
+ * Time Complexity: O(|E|) where |E| is the number of edgeMap
484
484
  * Space Complexity: O(1)
485
485
  *
486
- * 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.
487
487
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
488
488
  * (`VertexKey`).
489
- * @returns an array of vertices (VO[]).
489
+ * @returns an array of vertexMap (VO[]).
490
490
  */
491
491
  getNeighbors(vertexOrKey) {
492
492
  const neighbors = [];
@@ -511,10 +511,10 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
511
511
  * Time Complexity: O(1)
512
512
  * Space Complexity: O(1)
513
513
  *
514
- * 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,
515
515
  * otherwise it returns undefined.
516
516
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph.
517
- * @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
518
518
  * graph. If the edge does not exist, it returns `undefined`.
519
519
  */
520
520
  getEndsOfEdge(edge) {
@@ -538,7 +538,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
538
538
  * Time Complexity: O(1)
539
539
  * Space Complexity: O(1)
540
540
  *
541
- * 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.
542
542
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph. It is the edge that
543
543
  * needs to be added to the graph.
544
544
  * @returns a boolean value. It returns true if the edge was successfully added to the graph, and false if either the
@@ -32,17 +32,17 @@ export declare class MapEdge<E = any> extends DirectedEdge<E> {
32
32
  }
33
33
  export declare class MapGraph<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
  /**