data-structure-typed 1.42.8 → 1.42.9

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 (107) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +12 -12
  3. package/benchmark/report.html +12 -12
  4. package/benchmark/report.json +106 -106
  5. package/dist/cjs/src/data-structures/binary-tree/avl-tree.d.ts +88 -23
  6. package/dist/cjs/src/data-structures/binary-tree/avl-tree.js +88 -23
  7. package/dist/cjs/src/data-structures/binary-tree/avl-tree.js.map +1 -1
  8. package/dist/cjs/src/data-structures/binary-tree/binary-tree.d.ts +180 -74
  9. package/dist/cjs/src/data-structures/binary-tree/binary-tree.js +388 -201
  10. package/dist/cjs/src/data-structures/binary-tree/binary-tree.js.map +1 -1
  11. package/dist/cjs/src/data-structures/binary-tree/bst.d.ts +121 -66
  12. package/dist/cjs/src/data-structures/binary-tree/bst.js +121 -67
  13. package/dist/cjs/src/data-structures/binary-tree/bst.js.map +1 -1
  14. package/dist/cjs/src/data-structures/binary-tree/rb-tree.d.ts +72 -5
  15. package/dist/cjs/src/data-structures/binary-tree/rb-tree.js +95 -18
  16. package/dist/cjs/src/data-structures/binary-tree/rb-tree.js.map +1 -1
  17. package/dist/cjs/src/data-structures/binary-tree/tree-multimap.d.ts +82 -43
  18. package/dist/cjs/src/data-structures/binary-tree/tree-multimap.js +82 -43
  19. package/dist/cjs/src/data-structures/binary-tree/tree-multimap.js.map +1 -1
  20. package/dist/cjs/src/data-structures/graph/abstract-graph.d.ts +139 -36
  21. package/dist/cjs/src/data-structures/graph/abstract-graph.js +147 -36
  22. package/dist/cjs/src/data-structures/graph/abstract-graph.js.map +1 -1
  23. package/dist/cjs/src/data-structures/graph/directed-graph.d.ts +126 -0
  24. package/dist/cjs/src/data-structures/graph/directed-graph.js +126 -0
  25. package/dist/cjs/src/data-structures/graph/directed-graph.js.map +1 -1
  26. package/dist/cjs/src/data-structures/graph/undirected-graph.d.ts +63 -0
  27. package/dist/cjs/src/data-structures/graph/undirected-graph.js +63 -0
  28. package/dist/cjs/src/data-structures/graph/undirected-graph.js.map +1 -1
  29. package/dist/cjs/src/data-structures/heap/heap.d.ts +175 -12
  30. package/dist/cjs/src/data-structures/heap/heap.js +175 -12
  31. package/dist/cjs/src/data-structures/heap/heap.js.map +1 -1
  32. package/dist/cjs/src/data-structures/linked-list/doubly-linked-list.d.ts +203 -0
  33. package/dist/cjs/src/data-structures/linked-list/doubly-linked-list.js +203 -0
  34. package/dist/cjs/src/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  35. package/dist/cjs/src/data-structures/linked-list/singly-linked-list.d.ts +182 -0
  36. package/dist/cjs/src/data-structures/linked-list/singly-linked-list.js +182 -0
  37. package/dist/cjs/src/data-structures/linked-list/singly-linked-list.js.map +1 -1
  38. package/dist/cjs/src/data-structures/linked-list/skip-linked-list.d.ts +64 -0
  39. package/dist/cjs/src/data-structures/linked-list/skip-linked-list.js +64 -0
  40. package/dist/cjs/src/data-structures/linked-list/skip-linked-list.js.map +1 -1
  41. package/dist/cjs/src/data-structures/queue/deque.d.ts +113 -3
  42. package/dist/cjs/src/data-structures/queue/deque.js +113 -3
  43. package/dist/cjs/src/data-structures/queue/deque.js.map +1 -1
  44. package/dist/cjs/src/data-structures/queue/queue.d.ts +87 -0
  45. package/dist/cjs/src/data-structures/queue/queue.js +87 -0
  46. package/dist/cjs/src/data-structures/queue/queue.js.map +1 -1
  47. package/dist/cjs/src/data-structures/stack/stack.d.ts +42 -0
  48. package/dist/cjs/src/data-structures/stack/stack.js +42 -0
  49. package/dist/cjs/src/data-structures/stack/stack.js.map +1 -1
  50. package/dist/cjs/src/data-structures/trie/trie.d.ts +76 -0
  51. package/dist/cjs/src/data-structures/trie/trie.js +76 -1
  52. package/dist/cjs/src/data-structures/trie/trie.js.map +1 -1
  53. package/dist/mjs/src/data-structures/binary-tree/avl-tree.d.ts +88 -23
  54. package/dist/mjs/src/data-structures/binary-tree/avl-tree.js +88 -23
  55. package/dist/mjs/src/data-structures/binary-tree/binary-tree.d.ts +180 -74
  56. package/dist/mjs/src/data-structures/binary-tree/binary-tree.js +388 -201
  57. package/dist/mjs/src/data-structures/binary-tree/bst.d.ts +121 -66
  58. package/dist/mjs/src/data-structures/binary-tree/bst.js +121 -67
  59. package/dist/mjs/src/data-structures/binary-tree/rb-tree.d.ts +72 -5
  60. package/dist/mjs/src/data-structures/binary-tree/rb-tree.js +95 -18
  61. package/dist/mjs/src/data-structures/binary-tree/tree-multimap.d.ts +82 -43
  62. package/dist/mjs/src/data-structures/binary-tree/tree-multimap.js +82 -43
  63. package/dist/mjs/src/data-structures/graph/abstract-graph.d.ts +139 -36
  64. package/dist/mjs/src/data-structures/graph/abstract-graph.js +147 -36
  65. package/dist/mjs/src/data-structures/graph/directed-graph.d.ts +126 -0
  66. package/dist/mjs/src/data-structures/graph/directed-graph.js +126 -0
  67. package/dist/mjs/src/data-structures/graph/undirected-graph.d.ts +63 -0
  68. package/dist/mjs/src/data-structures/graph/undirected-graph.js +63 -0
  69. package/dist/mjs/src/data-structures/heap/heap.d.ts +175 -12
  70. package/dist/mjs/src/data-structures/heap/heap.js +175 -12
  71. package/dist/mjs/src/data-structures/linked-list/doubly-linked-list.d.ts +203 -0
  72. package/dist/mjs/src/data-structures/linked-list/doubly-linked-list.js +203 -0
  73. package/dist/mjs/src/data-structures/linked-list/singly-linked-list.d.ts +182 -0
  74. package/dist/mjs/src/data-structures/linked-list/singly-linked-list.js +182 -0
  75. package/dist/mjs/src/data-structures/linked-list/skip-linked-list.d.ts +64 -0
  76. package/dist/mjs/src/data-structures/linked-list/skip-linked-list.js +64 -0
  77. package/dist/mjs/src/data-structures/queue/deque.d.ts +113 -3
  78. package/dist/mjs/src/data-structures/queue/deque.js +113 -3
  79. package/dist/mjs/src/data-structures/queue/queue.d.ts +87 -0
  80. package/dist/mjs/src/data-structures/queue/queue.js +87 -0
  81. package/dist/mjs/src/data-structures/stack/stack.d.ts +42 -0
  82. package/dist/mjs/src/data-structures/stack/stack.js +42 -0
  83. package/dist/mjs/src/data-structures/trie/trie.d.ts +76 -0
  84. package/dist/mjs/src/data-structures/trie/trie.js +76 -1
  85. package/dist/umd/data-structure-typed.min.js +1 -1
  86. package/dist/umd/data-structure-typed.min.js.map +1 -1
  87. package/package.json +1 -1
  88. package/src/data-structures/binary-tree/avl-tree.ts +97 -23
  89. package/src/data-structures/binary-tree/binary-tree.ts +419 -204
  90. package/src/data-structures/binary-tree/bst.ts +130 -68
  91. package/src/data-structures/binary-tree/rb-tree.ts +106 -19
  92. package/src/data-structures/binary-tree/tree-multimap.ts +88 -44
  93. package/src/data-structures/graph/abstract-graph.ts +133 -7
  94. package/src/data-structures/graph/directed-graph.ts +145 -1
  95. package/src/data-structures/graph/undirected-graph.ts +72 -0
  96. package/src/data-structures/heap/heap.ts +201 -12
  97. package/src/data-structures/linked-list/doubly-linked-list.ts +232 -0
  98. package/src/data-structures/linked-list/singly-linked-list.ts +208 -0
  99. package/src/data-structures/linked-list/skip-linked-list.ts +74 -0
  100. package/src/data-structures/queue/deque.ts +127 -3
  101. package/src/data-structures/queue/queue.ts +99 -0
  102. package/src/data-structures/stack/stack.ts +48 -0
  103. package/src/data-structures/trie/trie.ts +87 -4
  104. package/test/integration/index.html +24 -2
  105. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +19 -2
  106. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +0 -1
  107. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +0 -1
@@ -66,6 +66,13 @@ 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
70
+ * Space Complexity: O(1)
71
+ */
72
+ /**
73
+ * Time Complexity: O(|V|) where |V| is the number of vertices
74
+ * Space Complexity: O(1)
75
+ *
69
76
  * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
70
77
  * @param {VO | VertexKey | null} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
71
78
  * @param {VO | VertexKey | null} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
@@ -75,6 +82,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
75
82
  */
76
83
  getEdge(srcOrKey: VO | VertexKey | null, destOrKey: VO | VertexKey | null): EO | null;
77
84
  /**
85
+ * Time Complexity: O(|E|) where |E| is the number of edges
86
+ * Space Complexity: O(1)
87
+ */
88
+ /**
89
+ * Time Complexity: O(|E|) where |E| is the number of edges
90
+ * Space Complexity: O(1)
91
+ *
78
92
  * The function removes an edge between two vertices in a graph and returns the removed edge.
79
93
  * @param {VO | VertexKey} srcOrKey - The source vertex or its ID.
80
94
  * @param {VO | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
@@ -82,6 +96,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
82
96
  */
83
97
  deleteEdgeSrcToDest(srcOrKey: VO | VertexKey, destOrKey: VO | VertexKey): EO | null;
84
98
  /**
99
+ * Time Complexity: O(|E|) where |E| is the number of edges
100
+ * Space Complexity: O(1)
101
+ */
102
+ /**
103
+ * Time Complexity: O(|E|) where |E| is the number of edges
104
+ * Space Complexity: O(1)
105
+ *
85
106
  * The function removes an edge from a graph and returns the removed edge, or null if the edge was not found.
86
107
  * @param {EO} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
87
108
  * and `dest`, which represent the source and destination vertices of the edge, respectively.
@@ -89,6 +110,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
89
110
  */
90
111
  deleteEdge(edge: EO): EO | null;
91
112
  /**
113
+ * Time Complexity: O(|E|) where |E| is the number of edges
114
+ * Space Complexity: O(1)
115
+ */
116
+ /**
117
+ * Time Complexity: O(|E|) where |E| is the number of edges
118
+ * Space Complexity: O(1)
119
+ *
92
120
  * The function removes edges between two vertices and returns the removed edges.
93
121
  * @param {VertexKey | VO} v1 - The parameter `v1` can be either a `VertexKey` or a `VO`. A `VertexKey` represents the
94
122
  * unique identifier of a vertex in a graph, while `VO` represents the actual vertex object.
@@ -98,6 +126,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
98
126
  */
99
127
  deleteEdgesBetween(v1: VertexKey | VO, v2: VertexKey | VO): EO[];
100
128
  /**
129
+ * Time Complexity: O(1)
130
+ * Space Complexity: O(1)
131
+ */
132
+ /**
133
+ * Time Complexity: O(1)
134
+ * Space Complexity: O(1)
135
+ *
101
136
  * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
102
137
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
103
138
  * (`VertexKey`).
@@ -105,6 +140,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
105
140
  */
106
141
  incomingEdgesOf(vertexOrKey: VO | VertexKey): EO[];
107
142
  /**
143
+ * Time Complexity: O(1)
144
+ * Space Complexity: O(1)
145
+ */
146
+ /**
147
+ * Time Complexity: O(1)
148
+ * Space Complexity: O(1)
149
+ *
108
150
  * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
109
151
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`VO`) or a vertex ID
110
152
  * (`VertexKey`).
@@ -112,42 +154,91 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
112
154
  */
113
155
  outgoingEdgesOf(vertexOrKey: VO | VertexKey): EO[];
114
156
  /**
157
+ * Time Complexity: O(1)
158
+ * Space Complexity: O(1)
159
+ */
160
+ /**
161
+ * Time Complexity: O(1)
162
+ * Space Complexity: O(1)
163
+ *
115
164
  * The function "degreeOf" returns the total degree of a vertex, which is the sum of its out-degree and in-degree.
116
165
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
117
166
  * @returns The sum of the out-degree and in-degree of the specified vertex or vertex ID.
118
167
  */
119
168
  degreeOf(vertexOrKey: VertexKey | VO): number;
120
169
  /**
170
+ * Time Complexity: O(1)
171
+ * Space Complexity: O(1)
172
+ */
173
+ /**
174
+ * Time Complexity: O(1)
175
+ * Space Complexity: O(1)
176
+ *
121
177
  * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
122
178
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
123
179
  * @returns The number of incoming edges of the specified vertex or vertex ID.
124
180
  */
125
181
  inDegreeOf(vertexOrKey: VertexKey | VO): number;
126
182
  /**
183
+ * Time Complexity: O(1)
184
+ * Space Complexity: O(1)
185
+ */
186
+ /**
187
+ * Time Complexity: O(1)
188
+ * Space Complexity: O(1)
189
+ *
127
190
  * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
128
191
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
129
192
  * @returns The number of outgoing edges from the specified vertex or vertex ID.
130
193
  */
131
194
  outDegreeOf(vertexOrKey: VertexKey | VO): number;
132
195
  /**
196
+ * Time Complexity: O(1)
197
+ * Space Complexity: O(1)
198
+ */
199
+ /**
200
+ * Time Complexity: O(1)
201
+ * Space Complexity: O(1)
202
+ *
133
203
  * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
134
204
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
135
205
  * @returns The function `edgesOf` returns an array of edges.
136
206
  */
137
207
  edgesOf(vertexOrKey: VertexKey | VO): EO[];
138
208
  /**
209
+ * Time Complexity: O(1)
210
+ * Space Complexity: O(1)
211
+ */
212
+ /**
213
+ * Time Complexity: O(1)
214
+ * Space Complexity: O(1)
215
+ *
139
216
  * The function "getEdgeSrc" returns the source vertex of an edge, or null if the edge does not exist.
140
217
  * @param {EO} e - The parameter "e" is of type EO, which represents an edge in a graph.
141
218
  * @returns either a vertex object (VO) or null.
142
219
  */
143
220
  getEdgeSrc(e: EO): VO | null;
144
221
  /**
222
+ * Time Complexity: O(1)
223
+ * Space Complexity: O(1)
224
+ */
225
+ /**
226
+ * Time Complexity: O(1)
227
+ * Space Complexity: O(1)
228
+ *
145
229
  * The function "getEdgeDest" returns the destination vertex of an edge.
146
230
  * @param {EO} e - The parameter "e" is of type "EO", which represents an edge in a graph.
147
231
  * @returns either a vertex object of type VO or null.
148
232
  */
149
233
  getEdgeDest(e: EO): VO | null;
150
234
  /**
235
+ * Time Complexity: O(|E|) where |E| is the number of edges
236
+ * Space Complexity: O(1)
237
+ */
238
+ /**
239
+ * Time Complexity: O(|E|) where |E| is the number of edges
240
+ * Space Complexity: O(1)
241
+ *
151
242
  * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
152
243
  * @param {VO | VertexKey | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
153
244
  * find the destinations. It can be either a `VO` object, a `VertexKey` value, or `null`.
@@ -155,6 +246,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
155
246
  */
156
247
  getDestinations(vertex: VO | VertexKey | null): VO[];
157
248
  /**
249
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
250
+ * Space Complexity: O(|V|)
251
+ */
252
+ /**
253
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
254
+ * Space Complexity: O(|V|)
255
+ *
158
256
  * The `topologicalSort` function performs a topological sort on a graph and returns an array of vertices or vertex IDs
159
257
  * in the sorted order, or null if the graph contains a cycle.
160
258
  * @param {'vertex' | 'key'} [propertyName] - The `propertyName` parameter is an optional parameter that specifies the
@@ -164,11 +262,25 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
164
262
  */
165
263
  topologicalSort(propertyName?: 'vertex' | 'key'): Array<VO | VertexKey> | null;
166
264
  /**
265
+ * Time Complexity: O(|E|) where |E| is the number of edges
266
+ * Space Complexity: O(|E|)
267
+ */
268
+ /**
269
+ * Time Complexity: O(|E|) where |E| is the number of edges
270
+ * Space Complexity: O(|E|)
271
+ *
167
272
  * The `edgeSet` function returns an array of all the edges in the graph.
168
273
  * @returns The `edgeSet()` method returns an array of edges (`EO[]`).
169
274
  */
170
275
  edgeSet(): EO[];
171
276
  /**
277
+ * Time Complexity: O(|E|) where |E| is the number of edges
278
+ * Space Complexity: O(1)
279
+ */
280
+ /**
281
+ * Time Complexity: O(|E|) where |E| is the number of edges
282
+ * Space Complexity: O(1)
283
+ *
172
284
  * The function `getNeighbors` returns an array of neighboring vertices of a given vertex or vertex ID in a graph.
173
285
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
174
286
  * (`VertexKey`).
@@ -176,6 +288,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
176
288
  */
177
289
  getNeighbors(vertexOrKey: VO | VertexKey): VO[];
178
290
  /**
291
+ * Time Complexity: O(1)
292
+ * Space Complexity: O(1)
293
+ */
294
+ /**
295
+ * Time Complexity: O(1)
296
+ * Space Complexity: O(1)
297
+ *
179
298
  * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
180
299
  * otherwise it returns null.
181
300
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph.
@@ -184,6 +303,13 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
184
303
  */
185
304
  getEndsOfEdge(edge: EO): [VO, VO] | null;
186
305
  /**
306
+ * Time Complexity: O(1)
307
+ * Space Complexity: O(1)
308
+ */
309
+ /**
310
+ * Time Complexity: O(1)
311
+ * Space Complexity: O(1)
312
+ *
187
313
  * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertices exist.
188
314
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph. It is the edge that
189
315
  * needs to be added to the graph.
@@ -91,6 +91,13 @@ 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
95
+ * Space Complexity: O(1)
96
+ */
97
+ /**
98
+ * Time Complexity: O(|V|) where |V| is the number of vertices
99
+ * Space Complexity: O(1)
100
+ *
94
101
  * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
95
102
  * @param {VO | VertexKey | null} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
96
103
  * @param {VO | VertexKey | null} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
@@ -113,6 +120,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
113
120
  return edges[0] || null;
114
121
  }
115
122
  /**
123
+ * Time Complexity: O(|E|) where |E| is the number of edges
124
+ * Space Complexity: O(1)
125
+ */
126
+ /**
127
+ * Time Complexity: O(|E|) where |E| is the number of edges
128
+ * Space Complexity: O(1)
129
+ *
116
130
  * The function removes an edge between two vertices in a graph and returns the removed edge.
117
131
  * @param {VO | VertexKey} srcOrKey - The source vertex or its ID.
118
132
  * @param {VO | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
@@ -136,6 +150,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
136
150
  return removed;
137
151
  }
138
152
  /**
153
+ * Time Complexity: O(|E|) where |E| is the number of edges
154
+ * Space Complexity: O(1)
155
+ */
156
+ /**
157
+ * Time Complexity: O(|E|) where |E| is the number of edges
158
+ * Space Complexity: O(1)
159
+ *
139
160
  * The function removes an edge from a graph and returns the removed edge, or null if the edge was not found.
140
161
  * @param {EO} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
141
162
  * and `dest`, which represent the source and destination vertices of the edge, respectively.
@@ -158,6 +179,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
158
179
  return removed;
159
180
  }
160
181
  /**
182
+ * Time Complexity: O(|E|) where |E| is the number of edges
183
+ * Space Complexity: O(1)
184
+ */
185
+ /**
186
+ * Time Complexity: O(|E|) where |E| is the number of edges
187
+ * Space Complexity: O(1)
188
+ *
161
189
  * The function removes edges between two vertices and returns the removed edges.
162
190
  * @param {VertexKey | VO} v1 - The parameter `v1` can be either a `VertexKey` or a `VO`. A `VertexKey` represents the
163
191
  * unique identifier of a vertex in a graph, while `VO` represents the actual vertex object.
@@ -176,6 +204,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
176
204
  return removed;
177
205
  }
178
206
  /**
207
+ * Time Complexity: O(1)
208
+ * Space Complexity: O(1)
209
+ */
210
+ /**
211
+ * Time Complexity: O(1)
212
+ * Space Complexity: O(1)
213
+ *
179
214
  * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
180
215
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
181
216
  * (`VertexKey`).
@@ -189,6 +224,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
189
224
  return [];
190
225
  }
191
226
  /**
227
+ * Time Complexity: O(1)
228
+ * Space Complexity: O(1)
229
+ */
230
+ /**
231
+ * Time Complexity: O(1)
232
+ * Space Complexity: O(1)
233
+ *
192
234
  * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
193
235
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`VO`) or a vertex ID
194
236
  * (`VertexKey`).
@@ -202,6 +244,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
202
244
  return [];
203
245
  }
204
246
  /**
247
+ * Time Complexity: O(1)
248
+ * Space Complexity: O(1)
249
+ */
250
+ /**
251
+ * Time Complexity: O(1)
252
+ * Space Complexity: O(1)
253
+ *
205
254
  * The function "degreeOf" returns the total degree of a vertex, which is the sum of its out-degree and in-degree.
206
255
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
207
256
  * @returns The sum of the out-degree and in-degree of the specified vertex or vertex ID.
@@ -210,6 +259,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
210
259
  return this.outDegreeOf(vertexOrKey) + this.inDegreeOf(vertexOrKey);
211
260
  }
212
261
  /**
262
+ * Time Complexity: O(1)
263
+ * Space Complexity: O(1)
264
+ */
265
+ /**
266
+ * Time Complexity: O(1)
267
+ * Space Complexity: O(1)
268
+ *
213
269
  * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
214
270
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
215
271
  * @returns The number of incoming edges of the specified vertex or vertex ID.
@@ -218,6 +274,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
218
274
  return this.incomingEdgesOf(vertexOrKey).length;
219
275
  }
220
276
  /**
277
+ * Time Complexity: O(1)
278
+ * Space Complexity: O(1)
279
+ */
280
+ /**
281
+ * Time Complexity: O(1)
282
+ * Space Complexity: O(1)
283
+ *
221
284
  * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
222
285
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
223
286
  * @returns The number of outgoing edges from the specified vertex or vertex ID.
@@ -226,6 +289,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
226
289
  return this.outgoingEdgesOf(vertexOrKey).length;
227
290
  }
228
291
  /**
292
+ * Time Complexity: O(1)
293
+ * Space Complexity: O(1)
294
+ */
295
+ /**
296
+ * Time Complexity: O(1)
297
+ * Space Complexity: O(1)
298
+ *
229
299
  * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
230
300
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
231
301
  * @returns The function `edgesOf` returns an array of edges.
@@ -234,6 +304,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
234
304
  return [...this.outgoingEdgesOf(vertexOrKey), ...this.incomingEdgesOf(vertexOrKey)];
235
305
  }
236
306
  /**
307
+ * Time Complexity: O(1)
308
+ * Space Complexity: O(1)
309
+ */
310
+ /**
311
+ * Time Complexity: O(1)
312
+ * Space Complexity: O(1)
313
+ *
237
314
  * The function "getEdgeSrc" returns the source vertex of an edge, or null if the edge does not exist.
238
315
  * @param {EO} e - The parameter "e" is of type EO, which represents an edge in a graph.
239
316
  * @returns either a vertex object (VO) or null.
@@ -242,6 +319,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
242
319
  return this._getVertex(e.src);
243
320
  }
244
321
  /**
322
+ * Time Complexity: O(1)
323
+ * Space Complexity: O(1)
324
+ */
325
+ /**
326
+ * Time Complexity: O(1)
327
+ * Space Complexity: O(1)
328
+ *
245
329
  * The function "getEdgeDest" returns the destination vertex of an edge.
246
330
  * @param {EO} e - The parameter "e" is of type "EO", which represents an edge in a graph.
247
331
  * @returns either a vertex object of type VO or null.
@@ -250,6 +334,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
250
334
  return this._getVertex(e.dest);
251
335
  }
252
336
  /**
337
+ * Time Complexity: O(|E|) where |E| is the number of edges
338
+ * Space Complexity: O(1)
339
+ */
340
+ /**
341
+ * Time Complexity: O(|E|) where |E| is the number of edges
342
+ * Space Complexity: O(1)
343
+ *
253
344
  * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
254
345
  * @param {VO | VertexKey | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
255
346
  * find the destinations. It can be either a `VO` object, a `VertexKey` value, or `null`.
@@ -270,6 +361,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
270
361
  return destinations;
271
362
  }
272
363
  /**
364
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
365
+ * Space Complexity: O(|V|)
366
+ */
367
+ /**
368
+ * Time Complexity: O(|V| + |E|) where |V| is the number of vertices and |E| is the number of edges
369
+ * Space Complexity: O(|V|)
370
+ *
273
371
  * The `topologicalSort` function performs a topological sort on a graph and returns an array of vertices or vertex IDs
274
372
  * in the sorted order, or null if the graph contains a cycle.
275
373
  * @param {'vertex' | 'key'} [propertyName] - The `propertyName` parameter is an optional parameter that specifies the
@@ -314,6 +412,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
314
412
  return sorted.reverse();
315
413
  }
316
414
  /**
415
+ * Time Complexity: O(|E|) where |E| is the number of edges
416
+ * Space Complexity: O(|E|)
417
+ */
418
+ /**
419
+ * Time Complexity: O(|E|) where |E| is the number of edges
420
+ * Space Complexity: O(|E|)
421
+ *
317
422
  * The `edgeSet` function returns an array of all the edges in the graph.
318
423
  * @returns The `edgeSet()` method returns an array of edges (`EO[]`).
319
424
  */
@@ -325,6 +430,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
325
430
  return edges;
326
431
  }
327
432
  /**
433
+ * Time Complexity: O(|E|) where |E| is the number of edges
434
+ * Space Complexity: O(1)
435
+ */
436
+ /**
437
+ * Time Complexity: O(|E|) where |E| is the number of edges
438
+ * Space Complexity: O(1)
439
+ *
328
440
  * The function `getNeighbors` returns an array of neighboring vertices of a given vertex or vertex ID in a graph.
329
441
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
330
442
  * (`VertexKey`).
@@ -346,6 +458,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
346
458
  return neighbors;
347
459
  }
348
460
  /**
461
+ * Time Complexity: O(1)
462
+ * Space Complexity: O(1)
463
+ */
464
+ /**
465
+ * Time Complexity: O(1)
466
+ * Space Complexity: O(1)
467
+ *
349
468
  * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
350
469
  * otherwise it returns null.
351
470
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph.
@@ -366,6 +485,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
366
485
  }
367
486
  }
368
487
  /**
488
+ * Time Complexity: O(1)
489
+ * Space Complexity: O(1)
490
+ */
491
+ /**
492
+ * Time Complexity: O(1)
493
+ * Space Complexity: O(1)
494
+ *
369
495
  * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertices exist.
370
496
  * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph. It is the edge that
371
497
  * needs to be added to the graph.
@@ -1 +1 @@
1
- {"version":3,"file":"directed-graph.js","sourceRoot":"","sources":["../../../../../src/data-structures/graph/directed-graph.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,uCAAwC;AACxC,qDAA6E;AAI7E,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;IAGnC;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;QAGA,gBAAW,GAAkB,IAAI,GAAG,EAAY,CAAC;QAMjD,eAAU,GAAkB,IAAI,GAAG,EAAY,CAAC;IAR1D,CAAC;IAID,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAID,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;OAGG;IAEH;;;;;;;;OAQG;IACH,YAAY,CAAC,GAAc,EAAE,KAAS;QACpC,OAAO,IAAI,cAAc,CAAC,GAAG,EAAE,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AAE,IAAI,EAAE,EAAE;YACZ,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;SACjB;aAAM;YACL,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAED;;;;;;OAMG;IACO,YAAY,CAAC,IAAQ;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;YAC5D,OAAO,KAAK,CAAC;SACd;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,wDAAwD;QACxD,IAAI,SAAS,IAAI,UAAU,EAAE;YAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACpD,IAAI,WAAW,EAAE;gBACf,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACxB;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;aACzC;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACpD,IAAI,WAAW,EAAE;gBACf,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACxB;iBAAM;gBACL,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;aACzC;YACD,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF;AAlZD,sCAkZC"}
1
+ {"version":3,"file":"directed-graph.js","sourceRoot":"","sources":["../../../../../src/data-structures/graph/directed-graph.ts"],"names":[],"mappings":";;;A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weight?: number, value?: EO['value']): EO;
56
56
  /**
57
+ * Time Complexity: O(|E|), where |E| is the number of edges incident to the given vertex.
58
+ * Space Complexity: O(1)
59
+ */
60
+ /**
61
+ * Time Complexity: O(|E|), where |E| is the number of edges incident to the given vertex.
62
+ * Space Complexity: O(1)
63
+ *
57
64
  * The function `getEdge` returns the first edge that connects two vertices, or null if no such edge exists.
58
65
  * @param {VO | VertexKey | null} v1 - The parameter `v1` represents a vertex or vertex ID. It can be of type `VO` (vertex
59
66
  * object), `null`, or `VertexKey` (a string or number representing the ID of a vertex).
@@ -63,6 +70,13 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
63
70
  */
64
71
  getEdge(v1: VO | VertexKey | null, v2: VO | VertexKey | null): EO | null;
65
72
  /**
73
+ * Time Complexity: O(|E|), where |E| is the number of edges incident to the given vertex.
74
+ * Space Complexity: O(1)
75
+ */
76
+ /**
77
+ * Time Complexity: O(|E|), where |E| is the number of edges incident to the given vertex.
78
+ * Space Complexity: O(1)
79
+ *
66
80
  * The function removes an edge between two vertices in a graph and returns the removed edge.
67
81
  * @param {VO | VertexKey} v1 - The parameter `v1` represents either a vertex object (`VO`) or a vertex ID (`VertexKey`).
68
82
  * @param {VO | VertexKey} v2 - VO | VertexKey - This parameter can be either a vertex object (VO) or a vertex ID
@@ -71,12 +85,26 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
71
85
  */
72
86
  deleteEdgeBetween(v1: VO | VertexKey, v2: VO | VertexKey): EO | null;
73
87
  /**
88
+ * Time Complexity: O(|E|), where |E| is the number of edges incident to the given vertex.
89
+ * Space Complexity: O(1)
90
+ */
91
+ /**
92
+ * Time Complexity: O(|E|), where |E| is the number of edges incident to the given vertex.
93
+ * Space Complexity: O(1)
94
+ *
74
95
  * The deleteEdge function removes an edge between two vertices in a graph.
75
96
  * @param {EO} edge - The parameter "edge" is of type EO, which represents an edge in a graph.
76
97
  * @returns The method is returning either the removed edge (of type EO) or null if the edge was not found.
77
98
  */
78
99
  deleteEdge(edge: EO): EO | null;
79
100
  /**
101
+ * Time Complexity: O(1)
102
+ * Space Complexity: O(1)
103
+ */
104
+ /**
105
+ * Time Complexity: O(1)
106
+ * Space Complexity: O(1)
107
+ *
80
108
  * The function `degreeOf` returns the degree of a vertex in a graph, which is the number of edges connected to that
81
109
  * vertex.
82
110
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
@@ -85,6 +113,13 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
85
113
  */
86
114
  degreeOf(vertexOrKey: VertexKey | VO): number;
87
115
  /**
116
+ * Time Complexity: O(1)
117
+ * Space Complexity: O(1)
118
+ */
119
+ /**
120
+ * Time Complexity: O(1)
121
+ * Space Complexity: O(1)
122
+ *
88
123
  * The function returns the edges of a given vertex or vertex ID.
89
124
  * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`. A `VertexKey` is a
90
125
  * unique identifier for a vertex in a graph, while `VO` represents the type of the vertex.
@@ -92,11 +127,25 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
92
127
  */
93
128
  edgesOf(vertexOrKey: VertexKey | VO): EO[];
94
129
  /**
130
+ * Time Complexity: O(|V| + |E|), where |V| is the number of vertices and |E| is the number of edges.
131
+ * Space Complexity: O(|E|)
132
+ */
133
+ /**
134
+ * Time Complexity: O(|V| + |E|), where |V| is the number of vertices and |E| is the number of edges.
135
+ * Space Complexity: O(|E|)
136
+ *
95
137
  * The function "edgeSet" returns an array of unique edges from a set of edges.
96
138
  * @returns The method `edgeSet()` returns an array of type `EO[]`.
97
139
  */
98
140
  edgeSet(): EO[];
99
141
  /**
142
+ * Time Complexity: O(|V| + |E|), where |V| is the number of vertices and |E| is the number of edges.
143
+ * Space Complexity: O(|E|)
144
+ */
145
+ /**
146
+ * Time Complexity: O(|V| + |E|), where |V| is the number of vertices and |E| is the number of edges.
147
+ * Space Complexity: O(|E|)
148
+ *
100
149
  * The function "getNeighbors" returns an array of neighboring vertices for a given vertex or vertex ID.
101
150
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
102
151
  * (`VertexKey`).
@@ -104,6 +153,13 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
104
153
  */
105
154
  getNeighbors(vertexOrKey: VO | VertexKey): VO[];
106
155
  /**
156
+ * Time Complexity: O(1)
157
+ * Space Complexity: O(1)
158
+ */
159
+ /**
160
+ * Time Complexity: O(1)
161
+ * Space Complexity: O(1)
162
+ *
107
163
  * The function "getEndsOfEdge" returns the vertices at the ends of an edge if the edge exists in the graph, otherwise
108
164
  * it returns null.
109
165
  * @param {EO} edge - The parameter "edge" is of type EO, which represents an edge in a graph.
@@ -112,6 +168,13 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
112
168
  */
113
169
  getEndsOfEdge(edge: EO): [VO, VO] | null;
114
170
  /**
171
+ * Time Complexity: O(1)
172
+ * Space Complexity: O(1)
173
+ */
174
+ /**
175
+ * Time Complexity: O(1)
176
+ * Space Complexity: O(1)
177
+ *
115
178
  * The function adds an edge to the graph by updating the adjacency list with the vertices of the edge.
116
179
  * @param {EO} edge - The parameter "edge" is of type EO, which represents an edge in a graph.
117
180
  * @returns a boolean value.