max-priority-queue-typed
Advanced tools
Comparing version
@@ -528,3 +528,3 @@ /** | ||
protected _displayAux(node: N | null | undefined, options: BinaryTreePrintOptions): NodeDisplayLayout; | ||
protected _defaultOneParamCallback: (node: N) => K; | ||
protected _defaultOneParamCallback: (node: N | null | undefined) => K | undefined; | ||
/** | ||
@@ -531,0 +531,0 @@ * Swap the data of two nodes in the binary tree. |
@@ -102,13 +102,4 @@ /** | ||
*/ | ||
abstract deleteVertex(vertexOrKey: VO | VertexKey): boolean; | ||
/** | ||
* Time Complexity: O(1) - Constant time for Map operations. | ||
* Space Complexity: O(1) - Constant space, as it creates only a few variables. | ||
* | ||
* The `deleteVertex` function removes a vertex from a graph by its ID or by the vertex object itself. | ||
* @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID | ||
* (`VertexKey`). | ||
* @returns The method is returning a boolean value. | ||
*/ | ||
deleteVertex(vertexOrKey: VO | VertexKey): boolean; | ||
/** | ||
* Time Complexity: O(K), where K is the number of vertexMap to be removed. | ||
@@ -115,0 +106,0 @@ * Space Complexity: O(1) - Constant space, as it creates only a few variables. |
@@ -101,19 +101,2 @@ "use strict"; | ||
/** | ||
* Time Complexity: O(1) - Constant time for Map operations. | ||
* Space Complexity: O(1) - Constant space, as it creates only a few variables. | ||
*/ | ||
/** | ||
* Time Complexity: O(1) - Constant time for Map operations. | ||
* Space Complexity: O(1) - Constant space, as it creates only a few variables. | ||
* | ||
* The `deleteVertex` function removes a vertex from a graph by its ID or by the vertex object itself. | ||
* @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID | ||
* (`VertexKey`). | ||
* @returns The method is returning a boolean value. | ||
*/ | ||
deleteVertex(vertexOrKey) { | ||
const vertexKey = this._getVertexKey(vertexOrKey); | ||
return this._vertexMap.delete(vertexKey); | ||
} | ||
/** | ||
* Time Complexity: O(K), where K is the number of vertexMap to be removed. | ||
@@ -120,0 +103,0 @@ * Space Complexity: O(1) - Constant space, as it creates only a few variables. |
@@ -215,2 +215,6 @@ "use strict"; | ||
if (vertex) { | ||
const neighbors = this.getNeighbors(vertex); | ||
for (const neighbor of neighbors) { | ||
this._inEdgeMap.delete(neighbor); | ||
} | ||
this._outEdgeMap.delete(vertex); | ||
@@ -217,0 +221,0 @@ this._inEdgeMap.delete(vertex); |
{ | ||
"name": "max-priority-queue-typed", | ||
"version": "1.49.3", | ||
"version": "1.49.4", | ||
"description": "Max Priority Queue. Javascript & Typescript Data Structure.", | ||
@@ -130,4 +130,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"data-structure-typed": "^1.49.3" | ||
"data-structure-typed": "^1.49.4" | ||
} | ||
} |
@@ -176,15 +176,3 @@ /** | ||
/** | ||
* Time Complexity: O(1) - Constant time for Map operations. | ||
* Space Complexity: O(1) - Constant space, as it creates only a few variables. | ||
* | ||
* The `deleteVertex` function removes a vertex from a graph by its ID or by the vertex object itself. | ||
* @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID | ||
* (`VertexKey`). | ||
* @returns The method is returning a boolean value. | ||
*/ | ||
deleteVertex(vertexOrKey: VO | VertexKey): boolean { | ||
const vertexKey = this._getVertexKey(vertexOrKey); | ||
return this._vertexMap.delete(vertexKey); | ||
} | ||
abstract deleteVertex(vertexOrKey: VO | VertexKey): boolean; | ||
@@ -191,0 +179,0 @@ /** |
@@ -243,3 +243,3 @@ /** | ||
*/ | ||
override deleteVertex(vertexOrKey: VO | VertexKey): boolean { | ||
deleteVertex(vertexOrKey: VO | VertexKey): boolean { | ||
let vertexKey: VertexKey; | ||
@@ -256,4 +256,8 @@ let vertex: VO | undefined; | ||
if (vertex) { | ||
this._outEdgeMap.delete(vertex) | ||
this._inEdgeMap.delete(vertex) | ||
const neighbors = this.getNeighbors(vertex); | ||
for (const neighbor of neighbors) { | ||
this._inEdgeMap.delete(neighbor); | ||
} | ||
this._outEdgeMap.delete(vertex); | ||
this._inEdgeMap.delete(vertex); | ||
} | ||
@@ -260,0 +264,0 @@ |
@@ -215,3 +215,3 @@ /** | ||
*/ | ||
override deleteVertex(vertexOrKey: VO | VertexKey): boolean { | ||
deleteVertex(vertexOrKey: VO | VertexKey): boolean { | ||
let vertexKey: VertexKey; | ||
@@ -218,0 +218,0 @@ let vertex: VO | undefined; |
@@ -36,4 +36,3 @@ /** | ||
if (elements) { | ||
for (const el of elements) | ||
this.push(el); | ||
for (const el of elements) this.push(el); | ||
} | ||
@@ -40,0 +39,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1824256
-0.08%36373
-0.09%Updated