priority-queue-typed 1.39.5 → 1.39.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 (46) hide show
  1. package/dist/data-structures/binary-tree/avl-tree.d.ts +6 -6
  2. package/dist/data-structures/binary-tree/avl-tree.js +13 -13
  3. package/dist/data-structures/binary-tree/binary-tree.d.ts +7 -7
  4. package/dist/data-structures/binary-tree/binary-tree.js +17 -17
  5. package/dist/data-structures/binary-tree/bst.d.ts +6 -6
  6. package/dist/data-structures/binary-tree/bst.js +13 -13
  7. package/dist/data-structures/binary-tree/rb-tree.d.ts +2 -2
  8. package/dist/data-structures/binary-tree/rb-tree.js +4 -4
  9. package/dist/data-structures/binary-tree/segment-tree.d.ts +7 -7
  10. package/dist/data-structures/binary-tree/segment-tree.js +16 -16
  11. package/dist/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  12. package/dist/data-structures/binary-tree/tree-multiset.js +18 -18
  13. package/dist/data-structures/graph/abstract-graph.d.ts +17 -17
  14. package/dist/data-structures/graph/abstract-graph.js +24 -24
  15. package/dist/data-structures/graph/directed-graph.d.ts +12 -12
  16. package/dist/data-structures/graph/directed-graph.js +15 -15
  17. package/dist/data-structures/graph/map-graph.d.ts +9 -9
  18. package/dist/data-structures/graph/map-graph.js +13 -13
  19. package/dist/data-structures/graph/undirected-graph.d.ts +11 -11
  20. package/dist/data-structures/graph/undirected-graph.js +14 -14
  21. package/dist/data-structures/hash/hash-table.d.ts +4 -4
  22. package/dist/data-structures/hash/hash-table.js +8 -8
  23. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +31 -31
  24. package/dist/data-structures/linked-list/doubly-linked-list.js +54 -54
  25. package/dist/data-structures/linked-list/singly-linked-list.d.ts +24 -24
  26. package/dist/data-structures/linked-list/singly-linked-list.js +52 -52
  27. package/dist/data-structures/queue/queue.js +1 -1
  28. package/dist/interfaces/binary-tree.d.ts +2 -2
  29. package/dist/interfaces/graph.d.ts +2 -2
  30. package/package.json +2 -2
  31. package/src/data-structures/binary-tree/avl-tree.ts +13 -13
  32. package/src/data-structures/binary-tree/binary-tree.ts +18 -18
  33. package/src/data-structures/binary-tree/bst.ts +16 -16
  34. package/src/data-structures/binary-tree/rb-tree.ts +6 -6
  35. package/src/data-structures/binary-tree/segment-tree.ts +15 -15
  36. package/src/data-structures/binary-tree/tree-multiset.ts +18 -18
  37. package/src/data-structures/graph/abstract-graph.ts +34 -34
  38. package/src/data-structures/graph/directed-graph.ts +16 -16
  39. package/src/data-structures/graph/map-graph.ts +13 -13
  40. package/src/data-structures/graph/undirected-graph.ts +15 -15
  41. package/src/data-structures/hash/hash-table.ts +9 -9
  42. package/src/data-structures/linked-list/doubly-linked-list.ts +61 -61
  43. package/src/data-structures/linked-list/singly-linked-list.ts +58 -58
  44. package/src/data-structures/queue/queue.ts +1 -1
  45. package/src/interfaces/binary-tree.ts +2 -2
  46. package/src/interfaces/graph.ts +2 -2
@@ -8,14 +8,14 @@ class TreeMultisetNode extends avl_tree_1.AVLTreeNode {
8
8
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
9
9
  * @param {BTNKey} key - The `key` parameter is of type `BTNKey` and represents the unique identifier
10
10
  * of the binary tree node.
11
- * @param {V} [val] - The `val` parameter is an optional parameter of type `V`. It represents the value of the binary
11
+ * @param {V} [value] - The `value` parameter is an optional parameter of type `V`. It represents the value of the binary
12
12
  * tree node. If no value is provided, it will be `undefined`.
13
13
  * @param {number} [count=1] - The `count` parameter is a number that represents the number of times a particular value
14
14
  * occurs in a binary tree node. It has a default value of 1, which means that if no value is provided for the `count`
15
15
  * parameter when creating a new instance of the `BinaryTreeNode` class.
16
16
  */
17
- constructor(key, val, count = 1) {
18
- super(key, val);
17
+ constructor(key, value, count = 1) {
18
+ super(key, value);
19
19
  this.count = count;
20
20
  }
21
21
  }
@@ -41,13 +41,13 @@ class TreeMultiset extends avl_tree_1.AVLTree {
41
41
  * The function creates a new BSTNode with the given key, value, and count.
42
42
  * @param {BTNKey} key - The key parameter is the unique identifier for the binary tree node. It is used to
43
43
  * distinguish one node from another in the tree.
44
- * @param {N} val - The `val` parameter represents the value that will be stored in the binary search tree node.
44
+ * @param {N} value - The `value` parameter represents the value that will be stored in the binary search tree node.
45
45
  * @param {number} [count] - The "count" parameter is an optional parameter of type number. It represents the number of
46
46
  * occurrences of the value in the binary search tree node. If not provided, the count will default to 1.
47
47
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
48
48
  */
49
- createNode(key, val, count) {
50
- return new TreeMultisetNode(key, val, count);
49
+ createNode(key, value, count) {
50
+ return new TreeMultisetNode(key, value, count);
51
51
  }
52
52
  /**
53
53
  * The `add` function adds a new node to a binary search tree, updating the count if the key already
@@ -55,23 +55,23 @@ class TreeMultiset extends avl_tree_1.AVLTree {
55
55
  * @param {BTNKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
56
56
  * `BTNKey` (which represents the key of the node to be added), a `N` (which represents a
57
57
  * node to be added), or `null` (which represents a null node).
58
- * @param [val] - The `val` parameter represents the value associated with the key that is being
58
+ * @param [value] - The `value` parameter represents the value associated with the key that is being
59
59
  * added to the binary tree.
60
60
  * @param [count=1] - The `count` parameter represents the number of occurrences of the key/value
61
61
  * pair that will be added to the binary tree. It has a default value of 1, which means that if no
62
62
  * count is specified, the default count will be 1.
63
63
  * @returns The function `add` returns a value of type `N | null | undefined`.
64
64
  */
65
- add(keyOrNode, val, count = 1) {
65
+ add(keyOrNode, value, count = 1) {
66
66
  let inserted = undefined, newNode;
67
67
  if (keyOrNode instanceof TreeMultisetNode) {
68
- newNode = this.createNode(keyOrNode.key, keyOrNode.val, keyOrNode.count);
68
+ newNode = this.createNode(keyOrNode.key, keyOrNode.value, keyOrNode.count);
69
69
  }
70
70
  else if (keyOrNode === null) {
71
71
  newNode = null;
72
72
  }
73
73
  else {
74
- newNode = this.createNode(keyOrNode, val, count);
74
+ newNode = this.createNode(keyOrNode, value, count);
75
75
  }
76
76
  if (!this.root) {
77
77
  this._setRoot(newNode);
@@ -86,7 +86,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
86
86
  if (cur) {
87
87
  if (newNode) {
88
88
  if (this._compare(cur.key, newNode.key) === types_1.CP.eq) {
89
- cur.val = newNode.val;
89
+ cur.value = newNode.value;
90
90
  cur.count += newNode.count;
91
91
  this._setCount(this.count + newNode.count);
92
92
  traversing = false;
@@ -187,7 +187,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
187
187
  for (let i = 0; i < keysOrNodes.length; i++) {
188
188
  const keyOrNode = keysOrNodes[i];
189
189
  if (keyOrNode instanceof TreeMultisetNode) {
190
- inserted.push(this.add(keyOrNode.key, keyOrNode.val, keyOrNode.count));
190
+ inserted.push(this.add(keyOrNode.key, keyOrNode.value, keyOrNode.count));
191
191
  continue;
192
192
  }
193
193
  if (keyOrNode === null) {
@@ -217,7 +217,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
217
217
  return;
218
218
  const m = l + Math.floor((r - l) / 2);
219
219
  const midNode = sorted[m];
220
- this.add(midNode.key, midNode.val, midNode.count);
220
+ this.add(midNode.key, midNode.value, midNode.count);
221
221
  buildBalanceBST(l, m - 1);
222
222
  buildBalanceBST(m + 1, r);
223
223
  };
@@ -233,7 +233,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
233
233
  if (l <= r) {
234
234
  const m = l + Math.floor((r - l) / 2);
235
235
  const midNode = sorted[m];
236
- this.add(midNode.key, midNode.val, midNode.count);
236
+ this.add(midNode.key, midNode.value, midNode.count);
237
237
  stack.push([m + 1, r]);
238
238
  stack.push([l, m - 1]);
239
239
  }
@@ -329,16 +329,16 @@ class TreeMultiset extends avl_tree_1.AVLTree {
329
329
  * @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
330
330
  */
331
331
  _swap(srcNode, destNode) {
332
- const { key, val, count, height } = destNode;
333
- const tempNode = this.createNode(key, val, count);
332
+ const { key, value, count, height } = destNode;
333
+ const tempNode = this.createNode(key, value, count);
334
334
  if (tempNode) {
335
335
  tempNode.height = height;
336
336
  destNode.key = srcNode.key;
337
- destNode.val = srcNode.val;
337
+ destNode.value = srcNode.value;
338
338
  destNode.count = srcNode.count;
339
339
  destNode.height = srcNode.height;
340
340
  srcNode.key = tempNode.key;
341
- srcNode.val = tempNode.val;
341
+ srcNode.value = tempNode.value;
342
342
  srcNode.count = tempNode.count;
343
343
  srcNode.height = tempNode.height;
344
344
  }
@@ -5,31 +5,31 @@ export declare abstract class AbstractVertex<V = any> {
5
5
  * The function is a protected constructor that takes an key and an optional value as parameters.
6
6
  * @param {VertexKey} key - The `key` parameter is of type `VertexKey` and represents the identifier of the vertex. It is
7
7
  * used to uniquely identify the vertex object.
8
- * @param {V} [val] - The parameter "val" is an optional parameter of type V. It is used to assign a value to the
8
+ * @param {V} [value] - The parameter "value" is an optional parameter of type V. It is used to assign a value to the
9
9
  * vertex. If no value is provided, it will be set to undefined.
10
10
  */
11
- protected constructor(key: VertexKey, val?: V);
11
+ protected constructor(key: VertexKey, value?: V);
12
12
  private _key;
13
13
  get key(): VertexKey;
14
14
  set key(v: VertexKey);
15
- private _val;
16
- get val(): V | undefined;
17
- set val(value: V | undefined);
15
+ private _value;
16
+ get value(): V | undefined;
17
+ set value(value: V | undefined);
18
18
  }
19
- export declare abstract class AbstractEdge<VO = any> {
19
+ export declare abstract class AbstractEdge<E = any> {
20
20
  /**
21
21
  * The above function is a protected constructor that initializes the weight, value, and hash code properties of an
22
22
  * object.
23
23
  * @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the object. If
24
24
  * a value is provided, it will be assigned to the `_weight` property. If no value is provided, the default value of 1
25
25
  * will be assigned.
26
- * @param {VO} [val] - The `val` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
26
+ * @param {VO} [value] - The `value` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
27
27
  * meaning it can be omitted when creating an instance of the class.
28
28
  */
29
- protected constructor(weight?: number, val?: VO);
30
- private _val;
31
- get val(): VO | undefined;
32
- set val(value: VO | undefined);
29
+ protected constructor(weight?: number, value?: E);
30
+ private _value;
31
+ get value(): E | undefined;
32
+ set value(value: E | undefined);
33
33
  private _weight;
34
34
  get weight(): number;
35
35
  set weight(v: number);
@@ -53,18 +53,18 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
53
53
  * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
54
54
  * 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.
55
55
  * @param key
56
- * @param val
56
+ * @param value
57
57
  */
58
- abstract createVertex(key: VertexKey, val?: V): VO;
58
+ abstract createVertex(key: VertexKey, value?: V): VO;
59
59
  /**
60
60
  * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
61
61
  * 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.
62
62
  * @param srcOrV1
63
63
  * @param destOrV2
64
64
  * @param weight
65
- * @param val
65
+ * @param value
66
66
  */
67
- abstract createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): EO;
67
+ abstract createEdge(srcOrV1: VertexKey, destOrV2: VertexKey, weight?: number, value?: E): EO;
68
68
  abstract deleteEdge(edge: EO): EO | null;
69
69
  abstract getEdge(srcOrKey: VO | VertexKey, destOrKey: VO | VertexKey): EO | null;
70
70
  abstract degreeOf(vertexOrKey: VO | VertexKey): number;
@@ -88,7 +88,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
88
88
  */
89
89
  hasVertex(vertexOrKey: VO | VertexKey): boolean;
90
90
  addVertex(vertex: VO): boolean;
91
- addVertex(key: VertexKey, val?: V): boolean;
91
+ addVertex(key: VertexKey, value?: V): boolean;
92
92
  /**
93
93
  * The `deleteVertex` function removes a vertex from a graph by its ID or by the vertex object itself.
94
94
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
@@ -114,7 +114,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
114
114
  */
115
115
  hasEdge(v1: VertexKey | VO, v2: VertexKey | VO): boolean;
116
116
  addEdge(edge: EO): boolean;
117
- addEdge(src: VO | VertexKey, dest: VO | VertexKey, weight?: number, val?: E): boolean;
117
+ addEdge(src: VO | VertexKey, dest: VO | VertexKey, weight?: number, value?: E): boolean;
118
118
  /**
119
119
  * The function sets the weight of an edge between two vertices in a graph.
120
120
  * @param {VertexKey | VO} srcOrKey - The `srcOrKey` parameter can be either a `VertexKey` or a `VO` object. It represents
@@ -16,12 +16,12 @@ class AbstractVertex {
16
16
  * The function is a protected constructor that takes an key and an optional value as parameters.
17
17
  * @param {VertexKey} key - The `key` parameter is of type `VertexKey` and represents the identifier of the vertex. It is
18
18
  * used to uniquely identify the vertex object.
19
- * @param {V} [val] - The parameter "val" is an optional parameter of type V. It is used to assign a value to the
19
+ * @param {V} [value] - The parameter "value" is an optional parameter of type V. It is used to assign a value to the
20
20
  * vertex. If no value is provided, it will be set to undefined.
21
21
  */
22
- constructor(key, val) {
22
+ constructor(key, value) {
23
23
  this._key = key;
24
- this._val = val;
24
+ this._value = value;
25
25
  }
26
26
  get key() {
27
27
  return this._key;
@@ -29,11 +29,11 @@ class AbstractVertex {
29
29
  set key(v) {
30
30
  this._key = v;
31
31
  }
32
- get val() {
33
- return this._val;
32
+ get value() {
33
+ return this._value;
34
34
  }
35
- set val(value) {
36
- this._val = value;
35
+ set value(value) {
36
+ this._value = value;
37
37
  }
38
38
  }
39
39
  exports.AbstractVertex = AbstractVertex;
@@ -44,19 +44,19 @@ class AbstractEdge {
44
44
  * @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the object. If
45
45
  * a value is provided, it will be assigned to the `_weight` property. If no value is provided, the default value of 1
46
46
  * will be assigned.
47
- * @param {VO} [val] - The `val` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
47
+ * @param {VO} [value] - The `value` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
48
48
  * meaning it can be omitted when creating an instance of the class.
49
49
  */
50
- constructor(weight, val) {
50
+ constructor(weight, value) {
51
51
  this._weight = weight !== undefined ? weight : 1;
52
- this._val = val;
52
+ this._value = value;
53
53
  this._hashCode = (0, utils_1.uuidV4)();
54
54
  }
55
- get val() {
56
- return this._val;
55
+ get value() {
56
+ return this._value;
57
57
  }
58
- set val(value) {
59
- this._val = value;
58
+ set value(value) {
59
+ this._value = value;
60
60
  }
61
61
  get weight() {
62
62
  return this._weight;
@@ -107,12 +107,12 @@ class AbstractGraph {
107
107
  hasVertex(vertexOrKey) {
108
108
  return this._vertices.has(this._getVertexKey(vertexOrKey));
109
109
  }
110
- addVertex(keyOrVertex, val) {
110
+ addVertex(keyOrVertex, value) {
111
111
  if (keyOrVertex instanceof AbstractVertex) {
112
112
  return this._addVertexOnly(keyOrVertex);
113
113
  }
114
114
  else {
115
- const newVertex = this.createVertex(keyOrVertex, val);
115
+ const newVertex = this.createVertex(keyOrVertex, value);
116
116
  return this._addVertexOnly(newVertex);
117
117
  }
118
118
  }
@@ -152,7 +152,7 @@ class AbstractGraph {
152
152
  const edge = this.getEdge(v1, v2);
153
153
  return !!edge;
154
154
  }
155
- addEdge(srcOrEdge, dest, weight, val) {
155
+ addEdge(srcOrEdge, dest, weight, value) {
156
156
  if (srcOrEdge instanceof AbstractEdge) {
157
157
  return this._addEdgeOnly(srcOrEdge);
158
158
  }
@@ -164,7 +164,7 @@ class AbstractGraph {
164
164
  srcOrEdge = srcOrEdge.key;
165
165
  if (dest instanceof AbstractVertex)
166
166
  dest = dest.key;
167
- const newEdge = this.createEdge(srcOrEdge, dest, weight, val);
167
+ const newEdge = this.createEdge(srcOrEdge, dest, weight, value);
168
168
  return this._addEdgeOnly(newEdge);
169
169
  }
170
170
  else {
@@ -406,10 +406,10 @@ class AbstractGraph {
406
406
  const getMinOfNoSeen = () => {
407
407
  let min = Infinity;
408
408
  let minV = null;
409
- for (const [key, val] of distMap) {
409
+ for (const [key, value] of distMap) {
410
410
  if (!seen.has(key)) {
411
- if (val < min) {
412
- min = val;
411
+ if (value < min) {
412
+ min = value;
413
413
  minV = key;
414
414
  }
415
415
  }
@@ -530,7 +530,7 @@ class AbstractGraph {
530
530
  distMap.set(vertexOrKey, Infinity);
531
531
  }
532
532
  const heap = new priority_queue_1.PriorityQueue({ comparator: (a, b) => a.key - b.key });
533
- heap.add({ key: 0, val: srcVertex });
533
+ heap.add({ key: 0, value: srcVertex });
534
534
  distMap.set(srcVertex, 0);
535
535
  preMap.set(srcVertex, null);
536
536
  /**
@@ -558,7 +558,7 @@ class AbstractGraph {
558
558
  while (heap.size > 0) {
559
559
  const curHeapNode = heap.poll();
560
560
  const dist = curHeapNode === null || curHeapNode === void 0 ? void 0 : curHeapNode.key;
561
- const cur = curHeapNode === null || curHeapNode === void 0 ? void 0 : curHeapNode.val;
561
+ const cur = curHeapNode === null || curHeapNode === void 0 ? void 0 : curHeapNode.value;
562
562
  if (dist !== undefined) {
563
563
  if (cur) {
564
564
  seen.add(cur);
@@ -579,7 +579,7 @@ class AbstractGraph {
579
579
  const distSrcToNeighbor = distMap.get(neighbor);
580
580
  if (distSrcToNeighbor) {
581
581
  if (dist + weight < distSrcToNeighbor) {
582
- heap.add({ key: dist + weight, val: neighbor });
582
+ heap.add({ key: dist + weight, value: neighbor });
583
583
  preMap.set(neighbor, cur);
584
584
  distMap.set(neighbor, dist + weight);
585
585
  }
@@ -6,10 +6,10 @@ export declare class DirectedVertex<V = any> extends AbstractVertex<V> {
6
6
  * The constructor function initializes a vertex with an optional value.
7
7
  * @param {VertexKey} key - The `key` parameter is of type `VertexKey` and represents the identifier of the vertex. It is
8
8
  * used to uniquely identify the vertex within a graph or data structure.
9
- * @param {V} [val] - The "val" parameter is an optional parameter of type V. It is used to initialize the value of the
9
+ * @param {V} [value] - The "value" parameter is an optional parameter of type V. It is used to initialize the value of the
10
10
  * vertex. If no value is provided, the vertex will be initialized with a default value.
11
11
  */
12
- constructor(key: VertexKey, val?: V);
12
+ constructor(key: VertexKey, value?: V);
13
13
  }
14
14
  export declare class DirectedEdge<E = any> extends AbstractEdge<E> {
15
15
  /**
@@ -20,10 +20,10 @@ export declare class DirectedEdge<E = any> extends AbstractEdge<E> {
20
20
  * @param {VertexKey} dest - The `dest` parameter represents the destination vertex of an edge. It is of type
21
21
  * `VertexKey`, which is likely a unique identifier for a vertex in a graph.
22
22
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge.
23
- * @param {E} [val] - The `val` parameter is an optional parameter of type `E`. It represents the value associated with
23
+ * @param {E} [value] - The `value` parameter is an optional parameter of type `E`. It represents the value associated with
24
24
  * the edge.
25
25
  */
26
- constructor(src: VertexKey, dest: VertexKey, weight?: number, val?: E);
26
+ constructor(src: VertexKey, dest: VertexKey, weight?: number, value?: E);
27
27
  private _src;
28
28
  get src(): VertexKey;
29
29
  set src(v: VertexKey);
@@ -48,12 +48,12 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
48
48
  * The function creates a new vertex with an optional value and returns it.
49
49
  * @param {VertexKey} key - The `key` parameter is the unique identifier for the vertex. It is of type `VertexKey`, which
50
50
  * could be a number or a string depending on how you want to identify your vertices.
51
- * @param [val] - The 'val' parameter is an optional value that can be assigned to the vertex. If a value is provided,
52
- * it will be assigned to the 'val' property of the vertex. If no value is provided, the 'val' property will be
51
+ * @param [value] - The 'value' parameter is an optional value that can be assigned to the vertex. If a value is provided,
52
+ * it will be assigned to the 'value' property of the vertex. If no value is provided, the 'value' property will be
53
53
  * assigned the same value as the 'key' parameter
54
54
  * @returns a new instance of a DirectedVertex object, casted as type VO.
55
55
  */
56
- createVertex(key: VertexKey, val?: V): VO;
56
+ createVertex(key: VertexKey, value?: V): VO;
57
57
  /**
58
58
  * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
59
59
  * 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.
@@ -64,20 +64,20 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
64
64
  * @param {VertexKey} dest - The `dest` parameter is the identifier of the destination vertex for the edge.
65
65
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge. If no
66
66
  * weight is provided, it defaults to 1.
67
- * @param [val] - The 'val' parameter is an optional value that can be assigned to the edge. It can be of any type and
67
+ * @param [value] - The 'value' parameter is an optional value that can be assigned to the edge. It can be of any type and
68
68
  * is used to store additional information or data associated with the edge.
69
69
  * @returns a new instance of a DirectedEdge object, casted as type EO.
70
70
  */
71
- createEdge(src: VertexKey, dest: VertexKey, weight?: number, val?: E): EO;
71
+ createEdge(src: VertexKey, dest: VertexKey, weight?: number, value?: E): EO;
72
72
  /**
73
73
  * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
74
- * @param {VO | null | VertexKey} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
75
- * @param {VO | null | VertexKey} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
74
+ * @param {VO | VertexKey | null} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
75
+ * @param {VO | VertexKey | null} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
76
76
  * destination vertex of the edge. It can be either a vertex object (`VO`), a vertex ID (`VertexKey`), or `null` if the
77
77
  * destination is not specified.
78
78
  * @returns the first edge found between the source and destination vertices, or null if no such edge is found.
79
79
  */
80
- getEdge(srcOrKey: VO | null | VertexKey, destOrKey: VO | null | VertexKey): EO | null;
80
+ getEdge(srcOrKey: VO | VertexKey | null, destOrKey: VO | VertexKey | null): EO | null;
81
81
  /**
82
82
  * The function removes an edge between two vertices in a graph and returns the removed edge.
83
83
  * @param {VO | VertexKey} srcOrKey - The source vertex or its ID.
@@ -15,11 +15,11 @@ class DirectedVertex extends abstract_graph_1.AbstractVertex {
15
15
  * The constructor function initializes a vertex with an optional value.
16
16
  * @param {VertexKey} key - The `key` parameter is of type `VertexKey` and represents the identifier of the vertex. It is
17
17
  * used to uniquely identify the vertex within a graph or data structure.
18
- * @param {V} [val] - The "val" parameter is an optional parameter of type V. It is used to initialize the value of the
18
+ * @param {V} [value] - The "value" parameter is an optional parameter of type V. It is used to initialize the value of the
19
19
  * vertex. If no value is provided, the vertex will be initialized with a default value.
20
20
  */
21
- constructor(key, val) {
22
- super(key, val);
21
+ constructor(key, value) {
22
+ super(key, value);
23
23
  }
24
24
  }
25
25
  exports.DirectedVertex = DirectedVertex;
@@ -32,11 +32,11 @@ class DirectedEdge extends abstract_graph_1.AbstractEdge {
32
32
  * @param {VertexKey} dest - The `dest` parameter represents the destination vertex of an edge. It is of type
33
33
  * `VertexKey`, which is likely a unique identifier for a vertex in a graph.
34
34
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge.
35
- * @param {E} [val] - The `val` parameter is an optional parameter of type `E`. It represents the value associated with
35
+ * @param {E} [value] - The `value` parameter is an optional parameter of type `E`. It represents the value associated with
36
36
  * the edge.
37
37
  */
38
- constructor(src, dest, weight, val) {
39
- super(weight, val);
38
+ constructor(src, dest, weight, value) {
39
+ super(weight, value);
40
40
  this._src = src;
41
41
  this._dest = dest;
42
42
  }
@@ -77,13 +77,13 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
77
77
  * The function creates a new vertex with an optional value and returns it.
78
78
  * @param {VertexKey} key - The `key` parameter is the unique identifier for the vertex. It is of type `VertexKey`, which
79
79
  * could be a number or a string depending on how you want to identify your vertices.
80
- * @param [val] - The 'val' parameter is an optional value that can be assigned to the vertex. If a value is provided,
81
- * it will be assigned to the 'val' property of the vertex. If no value is provided, the 'val' property will be
80
+ * @param [value] - The 'value' parameter is an optional value that can be assigned to the vertex. If a value is provided,
81
+ * it will be assigned to the 'value' property of the vertex. If no value is provided, the 'value' property will be
82
82
  * assigned the same value as the 'key' parameter
83
83
  * @returns a new instance of a DirectedVertex object, casted as type VO.
84
84
  */
85
- createVertex(key, val) {
86
- return new DirectedVertex(key, val !== null && val !== void 0 ? val : key);
85
+ createVertex(key, value) {
86
+ return new DirectedVertex(key, value !== null && value !== void 0 ? value : key);
87
87
  }
88
88
  /**
89
89
  * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
@@ -95,17 +95,17 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
95
95
  * @param {VertexKey} dest - The `dest` parameter is the identifier of the destination vertex for the edge.
96
96
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge. If no
97
97
  * weight is provided, it defaults to 1.
98
- * @param [val] - The 'val' parameter is an optional value that can be assigned to the edge. It can be of any type and
98
+ * @param [value] - The 'value' parameter is an optional value that can be assigned to the edge. It can be of any type and
99
99
  * is used to store additional information or data associated with the edge.
100
100
  * @returns a new instance of a DirectedEdge object, casted as type EO.
101
101
  */
102
- createEdge(src, dest, weight, val) {
103
- return new DirectedEdge(src, dest, weight !== null && weight !== void 0 ? weight : 1, val);
102
+ createEdge(src, dest, weight, value) {
103
+ return new DirectedEdge(src, dest, weight !== null && weight !== void 0 ? weight : 1, value);
104
104
  }
105
105
  /**
106
106
  * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
107
- * @param {VO | null | VertexKey} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
108
- * @param {VO | null | VertexKey} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
107
+ * @param {VO | VertexKey | null} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
108
+ * @param {VO | VertexKey | null} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
109
109
  * destination vertex of the edge. It can be either a vertex object (`VO`), a vertex ID (`VertexKey`), or `null` if the
110
110
  * destination is not specified.
111
111
  * @returns the first edge found between the source and destination vertices, or null if no such edge is found.
@@ -10,10 +10,10 @@ export declare class MapVertex<V = any> extends DirectedVertex<V> {
10
10
  * @param {number} long - The "long" parameter represents the longitude of a location. Longitude is a geographic
11
11
  * coordinate that specifies the east-west position of a point on the Earth's surface. It is measured in degrees, with
12
12
  * values ranging from -180 to 180.
13
- * @param {V} [val] - The "val" parameter is an optional value of type V. It is not required to be provided when
13
+ * @param {V} [value] - The "value" parameter is an optional value of type V. It is not required to be provided when
14
14
  * creating an instance of the class.
15
15
  */
16
- constructor(key: VertexKey, val: V, lat: number, long: number);
16
+ constructor(key: VertexKey, value: V, lat: number, long: number);
17
17
  private _lat;
18
18
  get lat(): number;
19
19
  set lat(value: number);
@@ -29,10 +29,10 @@ export declare class MapEdge<E = any> extends DirectedEdge<E> {
29
29
  * a graph.
30
30
  * @param {VertexKey} dest - The `dest` parameter is the identifier of the destination vertex for an edge.
31
31
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge.
32
- * @param {E} [val] - The "val" parameter is an optional parameter of type E. It is used to store additional
32
+ * @param {E} [value] - The "value" parameter is an optional parameter of type E. It is used to store additional
33
33
  * information or data associated with the edge.
34
34
  */
35
- constructor(src: VertexKey, dest: VertexKey, weight?: number, val?: E);
35
+ constructor(src: VertexKey, dest: VertexKey, weight?: number, value?: E);
36
36
  }
37
37
  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> {
38
38
  /**
@@ -55,14 +55,14 @@ export declare class MapGraph<V = any, E = any, VO extends MapVertex<V> = MapVer
55
55
  * The function creates a new vertex with the given key, value, latitude, and longitude.
56
56
  * @param {VertexKey} key - The key parameter is the unique identifier for the vertex. It is of type VertexKey, which could
57
57
  * be a string or a number depending on how you define it in your code.
58
- * @param [val] - The `val` parameter is an optional value that can be assigned to the `val` property of the vertex. It
59
- * is of type `V`, which means it should be of the same type as the `val` property of the vertex class `VO`.
58
+ * @param [value] - The `value` parameter is an optional value that can be assigned to the `value` property of the vertex. It
59
+ * is of type `V`, which means it should be of the same type as the `value` property of the vertex class `VO`.
60
60
  * @param {number} lat - The `lat` parameter represents the latitude of the vertex. It is a number that specifies the
61
61
  * position of the vertex on the Earth's surface in the north-south direction.
62
62
  * @param {number} long - The `long` parameter represents the longitude coordinate of the vertex.
63
63
  * @returns The method is returning a new instance of the `MapVertex` class, casted as type `VO`.
64
64
  */
65
- createVertex(key: VertexKey, val?: V, lat?: number, long?: number): VO;
65
+ createVertex(key: VertexKey, value?: V, lat?: number, long?: number): VO;
66
66
  /**
67
67
  * The function creates a new instance of a MapEdge with the given source, destination, weight, and value.
68
68
  * @param {VertexKey} src - The source vertex ID of the edge. It represents the starting point of the edge.
@@ -71,9 +71,9 @@ export declare class MapGraph<V = any, E = any, VO extends MapVertex<V> = MapVer
71
71
  * @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the edge. It
72
72
  * is used to assign a numerical value to the edge, which can be used in algorithms such as shortest path algorithms.
73
73
  * If the weight is not provided, it can be set to a default value or left undefined.
74
- * @param [val] - The `val` parameter is an optional value that can be assigned to the edge. It can be of any type,
74
+ * @param [value] - The `value` parameter is an optional value that can be assigned to the edge. It can be of any type,
75
75
  * depending on the specific implementation of the `MapEdge` class.
76
76
  * @returns a new instance of the `MapEdge` class, cast as type `EO`.
77
77
  */
78
- createEdge(src: VertexKey, dest: VertexKey, weight?: number, val?: E): EO;
78
+ createEdge(src: VertexKey, dest: VertexKey, weight?: number, value?: E): EO;
79
79
  }
@@ -12,11 +12,11 @@ class MapVertex extends directed_graph_1.DirectedVertex {
12
12
  * @param {number} long - The "long" parameter represents the longitude of a location. Longitude is a geographic
13
13
  * coordinate that specifies the east-west position of a point on the Earth's surface. It is measured in degrees, with
14
14
  * values ranging from -180 to 180.
15
- * @param {V} [val] - The "val" parameter is an optional value of type V. It is not required to be provided when
15
+ * @param {V} [value] - The "value" parameter is an optional value of type V. It is not required to be provided when
16
16
  * creating an instance of the class.
17
17
  */
18
- constructor(key, val, lat, long) {
19
- super(key, val);
18
+ constructor(key, value, lat, long) {
19
+ super(key, value);
20
20
  this._lat = lat;
21
21
  this._long = long;
22
22
  }
@@ -42,11 +42,11 @@ class MapEdge extends directed_graph_1.DirectedEdge {
42
42
  * a graph.
43
43
  * @param {VertexKey} dest - The `dest` parameter is the identifier of the destination vertex for an edge.
44
44
  * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge.
45
- * @param {E} [val] - The "val" parameter is an optional parameter of type E. It is used to store additional
45
+ * @param {E} [value] - The "value" parameter is an optional parameter of type E. It is used to store additional
46
46
  * information or data associated with the edge.
47
47
  */
48
- constructor(src, dest, weight, val) {
49
- super(src, dest, weight, val);
48
+ constructor(src, dest, weight, value) {
49
+ super(src, dest, weight, value);
50
50
  }
51
51
  }
52
52
  exports.MapEdge = MapEdge;
@@ -82,15 +82,15 @@ class MapGraph extends directed_graph_1.DirectedGraph {
82
82
  * The function creates a new vertex with the given key, value, latitude, and longitude.
83
83
  * @param {VertexKey} key - The key parameter is the unique identifier for the vertex. It is of type VertexKey, which could
84
84
  * be a string or a number depending on how you define it in your code.
85
- * @param [val] - The `val` parameter is an optional value that can be assigned to the `val` property of the vertex. It
86
- * is of type `V`, which means it should be of the same type as the `val` property of the vertex class `VO`.
85
+ * @param [value] - The `value` parameter is an optional value that can be assigned to the `value` property of the vertex. It
86
+ * is of type `V`, which means it should be of the same type as the `value` property of the vertex class `VO`.
87
87
  * @param {number} lat - The `lat` parameter represents the latitude of the vertex. It is a number that specifies the
88
88
  * position of the vertex on the Earth's surface in the north-south direction.
89
89
  * @param {number} long - The `long` parameter represents the longitude coordinate of the vertex.
90
90
  * @returns The method is returning a new instance of the `MapVertex` class, casted as type `VO`.
91
91
  */
92
- createVertex(key, val, lat = this.origin[0], long = this.origin[1]) {
93
- return new MapVertex(key, val, lat, long);
92
+ createVertex(key, value, lat = this.origin[0], long = this.origin[1]) {
93
+ return new MapVertex(key, value, lat, long);
94
94
  }
95
95
  /**
96
96
  * The function creates a new instance of a MapEdge with the given source, destination, weight, and value.
@@ -100,12 +100,12 @@ class MapGraph extends directed_graph_1.DirectedGraph {
100
100
  * @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the edge. It
101
101
  * is used to assign a numerical value to the edge, which can be used in algorithms such as shortest path algorithms.
102
102
  * If the weight is not provided, it can be set to a default value or left undefined.
103
- * @param [val] - The `val` parameter is an optional value that can be assigned to the edge. It can be of any type,
103
+ * @param [value] - The `value` parameter is an optional value that can be assigned to the edge. It can be of any type,
104
104
  * depending on the specific implementation of the `MapEdge` class.
105
105
  * @returns a new instance of the `MapEdge` class, cast as type `EO`.
106
106
  */
107
- createEdge(src, dest, weight, val) {
108
- return new MapEdge(src, dest, weight, val);
107
+ createEdge(src, dest, weight, value) {
108
+ return new MapEdge(src, dest, weight, value);
109
109
  }
110
110
  }
111
111
  exports.MapGraph = MapGraph;