min-heap-typed 1.39.4 → 1.39.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ export declare class DirectedVertex<V = any> extends AbstractVertex<V> {
11
11
  */
12
12
  constructor(key: VertexKey, val?: V);
13
13
  }
14
- export declare class DirectedEdge<V = any> extends AbstractEdge<V> {
14
+ export declare class DirectedEdge<E = any> extends AbstractEdge<E> {
15
15
  /**
16
16
  * The constructor function initializes the source and destination vertices of an edge, along with an optional weight
17
17
  * and value.
@@ -20,10 +20,10 @@ export declare class DirectedEdge<V = any> extends AbstractEdge<V> {
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 {V} [val] - The `val` parameter is an optional parameter of type `V`. It represents the value associated with
23
+ * @param {E} [val] - The `val` 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?: V);
26
+ constructor(src: VertexKey, dest: VertexKey, weight?: number, val?: E);
27
27
  private _src;
28
28
  get src(): VertexKey;
29
29
  set src(v: VertexKey);
@@ -31,15 +31,15 @@ export declare class DirectedEdge<V = any> extends AbstractEdge<V> {
31
31
  get dest(): VertexKey;
32
32
  set dest(v: VertexKey);
33
33
  }
34
- export declare class DirectedGraph<V extends DirectedVertex<any> = DirectedVertex, E extends DirectedEdge<any> = DirectedEdge> extends AbstractGraph<V, E> implements IGraph<V, E> {
34
+ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V> = DirectedVertex<V>, EO extends DirectedEdge<E> = DirectedEdge<E>> extends AbstractGraph<V, E, VO, EO> implements IGraph<V, E, VO, EO> {
35
35
  /**
36
36
  * The constructor function initializes an instance of a class.
37
37
  */
38
38
  constructor();
39
39
  private _outEdgeMap;
40
- get outEdgeMap(): Map<V, E[]>;
40
+ get outEdgeMap(): Map<VO, EO[]>;
41
41
  private _inEdgeMap;
42
- get inEdgeMap(): Map<V, E[]>;
42
+ get inEdgeMap(): Map<VO, EO[]>;
43
43
  /**
44
44
  * 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.
45
45
  * 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.
@@ -51,9 +51,9 @@ export declare class DirectedGraph<V extends DirectedVertex<any> = DirectedVerte
51
51
  * @param [val] - The 'val' parameter is an optional value that can be assigned to the vertex. If a value is provided,
52
52
  * it will be assigned to the 'val' property of the vertex. If no value is provided, the 'val' property will be
53
53
  * assigned the same value as the 'key' parameter
54
- * @returns a new instance of a DirectedVertex object, casted as type V.
54
+ * @returns a new instance of a DirectedVertex object, casted as type VO.
55
55
  */
56
- createVertex(key: VertexKey, val?: V['val']): V;
56
+ createVertex(key: VertexKey, val?: 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.
@@ -66,98 +66,98 @@ export declare class DirectedGraph<V extends DirectedVertex<any> = DirectedVerte
66
66
  * weight is provided, it defaults to 1.
67
67
  * @param [val] - The 'val' 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
- * @returns a new instance of a DirectedEdge object, casted as type E.
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['val']): E;
71
+ createEdge(src: VertexKey, dest: VertexKey, weight?: number, val?: E): EO;
72
72
  /**
73
73
  * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
74
- * @param {V | null | VertexKey} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
75
- * @param {V | null | VertexKey} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
76
- * destination vertex of the edge. It can be either a vertex object (`V`), a vertex ID (`VertexKey`), or `null` if the
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
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: V | null | VertexKey, destOrKey: V | null | VertexKey): E | null;
80
+ getEdge(srcOrKey: VO | null | VertexKey, destOrKey: VO | null | VertexKey): EO | null;
81
81
  /**
82
82
  * The function removes an edge between two vertices in a graph and returns the removed edge.
83
- * @param {V | VertexKey} srcOrKey - The source vertex or its ID.
84
- * @param {V | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
85
- * @returns the removed edge (E) if it exists, or null if either the source or destination vertex does not exist.
83
+ * @param {VO | VertexKey} srcOrKey - The source vertex or its ID.
84
+ * @param {VO | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
85
+ * @returns the removed edge (EO) if it exists, or null if either the source or destination vertex does not exist.
86
86
  */
87
- deleteEdgeSrcToDest(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
87
+ deleteEdgeSrcToDest(srcOrKey: VO | VertexKey, destOrKey: VO | VertexKey): EO | null;
88
88
  /**
89
89
  * The function removes an edge from a graph and returns the removed edge, or null if the edge was not found.
90
- * @param {E} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
90
+ * @param {EO} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
91
91
  * and `dest`, which represent the source and destination vertices of the edge, respectively.
92
- * @returns The method `deleteEdge` returns the removed edge (`E`) if it exists, or `null` if the edge does not exist.
92
+ * @returns The method `deleteEdge` returns the removed edge (`EO`) if it exists, or `null` if the edge does not exist.
93
93
  */
94
- deleteEdge(edge: E): E | null;
94
+ deleteEdge(edge: EO): EO | null;
95
95
  /**
96
96
  * The function removes edges between two vertices and returns the removed edges.
97
- * @param {VertexKey | V} v1 - The parameter `v1` can be either a `VertexKey` or a `V`. A `VertexKey` represents the
98
- * unique identifier of a vertex in a graph, while `V` represents the actual vertex object.
99
- * @param {VertexKey | V} v2 - The parameter `v2` represents either a `VertexKey` or a `V` object. It is used to specify
97
+ * @param {VertexKey | VO} v1 - The parameter `v1` can be either a `VertexKey` or a `VO`. A `VertexKey` represents the
98
+ * unique identifier of a vertex in a graph, while `VO` represents the actual vertex object.
99
+ * @param {VertexKey | VO} v2 - The parameter `v2` represents either a `VertexKey` or a `VO` object. It is used to specify
100
100
  * the second vertex in the edge that needs to be removed.
101
- * @returns an array of removed edges (E[]).
101
+ * @returns an array of removed edges (EO[]).
102
102
  */
103
- deleteEdgesBetween(v1: VertexKey | V, v2: VertexKey | V): E[];
103
+ deleteEdgesBetween(v1: VertexKey | VO, v2: VertexKey | VO): EO[];
104
104
  /**
105
105
  * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
106
- * @param {V | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`V`) or a vertex ID
106
+ * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
107
107
  * (`VertexKey`).
108
- * @returns The method `incomingEdgesOf` returns an array of edges (`E[]`).
108
+ * @returns The method `incomingEdgesOf` returns an array of edges (`EO[]`).
109
109
  */
110
- incomingEdgesOf(vertexOrKey: V | VertexKey): E[];
110
+ incomingEdgesOf(vertexOrKey: VO | VertexKey): EO[];
111
111
  /**
112
112
  * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
113
- * @param {V | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`V`) or a vertex ID
113
+ * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`VO`) or a vertex ID
114
114
  * (`VertexKey`).
115
- * @returns The method `outgoingEdgesOf` returns an array of edges (`E[]`).
115
+ * @returns The method `outgoingEdgesOf` returns an array of edges (`EO[]`).
116
116
  */
117
- outgoingEdgesOf(vertexOrKey: V | VertexKey): E[];
117
+ outgoingEdgesOf(vertexOrKey: VO | VertexKey): EO[];
118
118
  /**
119
119
  * The function "degreeOf" returns the total degree of a vertex, which is the sum of its out-degree and in-degree.
120
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
120
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
121
121
  * @returns The sum of the out-degree and in-degree of the specified vertex or vertex ID.
122
122
  */
123
- degreeOf(vertexOrKey: VertexKey | V): number;
123
+ degreeOf(vertexOrKey: VertexKey | VO): number;
124
124
  /**
125
125
  * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
126
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
126
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
127
127
  * @returns The number of incoming edges of the specified vertex or vertex ID.
128
128
  */
129
- inDegreeOf(vertexOrKey: VertexKey | V): number;
129
+ inDegreeOf(vertexOrKey: VertexKey | VO): number;
130
130
  /**
131
131
  * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
132
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
132
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
133
133
  * @returns The number of outgoing edges from the specified vertex or vertex ID.
134
134
  */
135
- outDegreeOf(vertexOrKey: VertexKey | V): number;
135
+ outDegreeOf(vertexOrKey: VertexKey | VO): number;
136
136
  /**
137
137
  * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
138
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
138
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
139
139
  * @returns The function `edgesOf` returns an array of edges.
140
140
  */
141
- edgesOf(vertexOrKey: VertexKey | V): E[];
141
+ edgesOf(vertexOrKey: VertexKey | VO): EO[];
142
142
  /**
143
143
  * The function "getEdgeSrc" returns the source vertex of an edge, or null if the edge does not exist.
144
- * @param {E} e - The parameter "e" is of type E, which represents an edge in a graph.
145
- * @returns either a vertex object (V) or null.
144
+ * @param {EO} e - The parameter "e" is of type EO, which represents an edge in a graph.
145
+ * @returns either a vertex object (VO) or null.
146
146
  */
147
- getEdgeSrc(e: E): V | null;
147
+ getEdgeSrc(e: EO): VO | null;
148
148
  /**
149
149
  * The function "getEdgeDest" returns the destination vertex of an edge.
150
- * @param {E} e - The parameter "e" is of type "E", which represents an edge in a graph.
151
- * @returns either a vertex object of type V or null.
150
+ * @param {EO} e - The parameter "e" is of type "EO", which represents an edge in a graph.
151
+ * @returns either a vertex object of type VO or null.
152
152
  */
153
- getEdgeDest(e: E): V | null;
153
+ getEdgeDest(e: EO): VO | null;
154
154
  /**
155
155
  * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
156
- * @param {V | VertexKey | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
157
- * find the destinations. It can be either a `V` object, a `VertexKey` value, or `null`.
158
- * @returns an array of vertices (V[]).
156
+ * @param {VO | VertexKey | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
157
+ * find the destinations. It can be either a `VO` object, a `VertexKey` value, or `null`.
158
+ * @returns an array of vertices (VO[]).
159
159
  */
160
- getDestinations(vertex: V | VertexKey | null): V[];
160
+ getDestinations(vertex: VO | VertexKey | null): VO[];
161
161
  /**
162
162
  * The `topologicalSort` function performs a topological sort on a graph and returns an array of vertices or vertex IDs
163
163
  * in the sorted order, or null if the graph contains a cycle.
@@ -166,35 +166,35 @@ export declare class DirectedGraph<V extends DirectedVertex<any> = DirectedVerte
166
166
  * specified, the vertices themselves will be used for sorting. If 'key' is specified, the ids of
167
167
  * @returns an array of vertices or vertex IDs in topological order. If there is a cycle in the graph, it returns null.
168
168
  */
169
- topologicalSort(propertyName?: 'vertex' | 'key'): Array<V | VertexKey> | null;
169
+ topologicalSort(propertyName?: 'vertex' | 'key'): Array<VO | VertexKey> | null;
170
170
  /**
171
171
  * The `edgeSet` function returns an array of all the edges in the graph.
172
- * @returns The `edgeSet()` method returns an array of edges (`E[]`).
172
+ * @returns The `edgeSet()` method returns an array of edges (`EO[]`).
173
173
  */
174
- edgeSet(): E[];
174
+ edgeSet(): EO[];
175
175
  /**
176
176
  * The function `getNeighbors` returns an array of neighboring vertices of a given vertex or vertex ID in a graph.
177
- * @param {V | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`V`) or a vertex ID
177
+ * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
178
178
  * (`VertexKey`).
179
- * @returns an array of vertices (V[]).
179
+ * @returns an array of vertices (VO[]).
180
180
  */
181
- getNeighbors(vertexOrKey: V | VertexKey): V[];
181
+ getNeighbors(vertexOrKey: VO | VertexKey): VO[];
182
182
  /**
183
183
  * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
184
184
  * otherwise it returns null.
185
- * @param {E} edge - The parameter `edge` is of type `E`, which represents an edge in a graph.
186
- * @returns The function `getEndsOfEdge` returns an array containing two vertices `[V, V]` if the edge exists in the
185
+ * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph.
186
+ * @returns The function `getEndsOfEdge` returns an array containing two vertices `[VO, VO]` if the edge exists in the
187
187
  * graph. If the edge does not exist, it returns `null`.
188
188
  */
189
- getEndsOfEdge(edge: E): [V, V] | null;
189
+ getEndsOfEdge(edge: EO): [VO, VO] | null;
190
190
  /**
191
191
  * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertices exist.
192
- * @param {E} edge - The parameter `edge` is of type `E`, which represents an edge in a graph. It is the edge that
192
+ * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph. It is the edge that
193
193
  * needs to be added to the graph.
194
194
  * @returns a boolean value. It returns true if the edge was successfully added to the graph, and false if either the
195
195
  * source or destination vertex does not exist in the graph.
196
196
  */
197
- protected _addEdgeOnly(edge: E): boolean;
198
- protected _setOutEdgeMap(value: Map<V, E[]>): void;
199
- protected _setInEdgeMap(value: Map<V, E[]>): void;
197
+ protected _addEdgeOnly(edge: EO): boolean;
198
+ protected _setOutEdgeMap(value: Map<VO, EO[]>): void;
199
+ protected _setInEdgeMap(value: Map<VO, EO[]>): void;
200
200
  }
@@ -32,7 +32,7 @@ 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 {V} [val] - The `val` parameter is an optional parameter of type `V`. It represents the value associated with
35
+ * @param {E} [val] - The `val` parameter is an optional parameter of type `E`. It represents the value associated with
36
36
  * the edge.
37
37
  */
38
38
  constructor(src, dest, weight, val) {
@@ -80,7 +80,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
80
80
  * @param [val] - The 'val' parameter is an optional value that can be assigned to the vertex. If a value is provided,
81
81
  * it will be assigned to the 'val' property of the vertex. If no value is provided, the 'val' property will be
82
82
  * assigned the same value as the 'key' parameter
83
- * @returns a new instance of a DirectedVertex object, casted as type V.
83
+ * @returns a new instance of a DirectedVertex object, casted as type VO.
84
84
  */
85
85
  createVertex(key, val) {
86
86
  return new DirectedVertex(key, val !== null && val !== void 0 ? val : key);
@@ -97,16 +97,16 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
97
97
  * weight is provided, it defaults to 1.
98
98
  * @param [val] - The 'val' 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
- * @returns a new instance of a DirectedEdge object, casted as type E.
100
+ * @returns a new instance of a DirectedEdge object, casted as type EO.
101
101
  */
102
102
  createEdge(src, dest, weight, val) {
103
103
  return new DirectedEdge(src, dest, weight !== null && weight !== void 0 ? weight : 1, val);
104
104
  }
105
105
  /**
106
106
  * The `getEdge` function retrieves an edge between two vertices based on their source and destination IDs.
107
- * @param {V | null | VertexKey} srcOrKey - The source vertex or its ID. It can be either a vertex object or a vertex ID.
108
- * @param {V | null | VertexKey} destOrKey - The `destOrKey` parameter in the `getEdge` function represents the
109
- * destination vertex of the edge. It can be either a vertex object (`V`), a vertex ID (`VertexKey`), or `null` if the
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
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.
112
112
  */
@@ -126,9 +126,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
126
126
  }
127
127
  /**
128
128
  * The function removes an edge between two vertices in a graph and returns the removed edge.
129
- * @param {V | VertexKey} srcOrKey - The source vertex or its ID.
130
- * @param {V | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
131
- * @returns the removed edge (E) if it exists, or null if either the source or destination vertex does not exist.
129
+ * @param {VO | VertexKey} srcOrKey - The source vertex or its ID.
130
+ * @param {VO | VertexKey} destOrKey - The `destOrKey` parameter represents the destination vertex or its ID.
131
+ * @returns the removed edge (EO) if it exists, or null if either the source or destination vertex does not exist.
132
132
  */
133
133
  deleteEdgeSrcToDest(srcOrKey, destOrKey) {
134
134
  const src = this._getVertex(srcOrKey);
@@ -149,9 +149,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
149
149
  }
150
150
  /**
151
151
  * The function removes an edge from a graph and returns the removed edge, or null if the edge was not found.
152
- * @param {E} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
152
+ * @param {EO} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
153
153
  * and `dest`, which represent the source and destination vertices of the edge, respectively.
154
- * @returns The method `deleteEdge` returns the removed edge (`E`) if it exists, or `null` if the edge does not exist.
154
+ * @returns The method `deleteEdge` returns the removed edge (`EO`) if it exists, or `null` if the edge does not exist.
155
155
  */
156
156
  deleteEdge(edge) {
157
157
  let removed = null;
@@ -171,11 +171,11 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
171
171
  }
172
172
  /**
173
173
  * The function removes edges between two vertices and returns the removed edges.
174
- * @param {VertexKey | V} v1 - The parameter `v1` can be either a `VertexKey` or a `V`. A `VertexKey` represents the
175
- * unique identifier of a vertex in a graph, while `V` represents the actual vertex object.
176
- * @param {VertexKey | V} v2 - The parameter `v2` represents either a `VertexKey` or a `V` object. It is used to specify
174
+ * @param {VertexKey | VO} v1 - The parameter `v1` can be either a `VertexKey` or a `VO`. A `VertexKey` represents the
175
+ * unique identifier of a vertex in a graph, while `VO` represents the actual vertex object.
176
+ * @param {VertexKey | VO} v2 - The parameter `v2` represents either a `VertexKey` or a `VO` object. It is used to specify
177
177
  * the second vertex in the edge that needs to be removed.
178
- * @returns an array of removed edges (E[]).
178
+ * @returns an array of removed edges (EO[]).
179
179
  */
180
180
  deleteEdgesBetween(v1, v2) {
181
181
  const removed = [];
@@ -189,9 +189,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
189
189
  }
190
190
  /**
191
191
  * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
192
- * @param {V | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`V`) or a vertex ID
192
+ * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
193
193
  * (`VertexKey`).
194
- * @returns The method `incomingEdgesOf` returns an array of edges (`E[]`).
194
+ * @returns The method `incomingEdgesOf` returns an array of edges (`EO[]`).
195
195
  */
196
196
  incomingEdgesOf(vertexOrKey) {
197
197
  const target = this._getVertex(vertexOrKey);
@@ -202,9 +202,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
202
202
  }
203
203
  /**
204
204
  * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
205
- * @param {V | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`V`) or a vertex ID
205
+ * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can accept either a vertex object (`VO`) or a vertex ID
206
206
  * (`VertexKey`).
207
- * @returns The method `outgoingEdgesOf` returns an array of edges (`E[]`).
207
+ * @returns The method `outgoingEdgesOf` returns an array of edges (`EO[]`).
208
208
  */
209
209
  outgoingEdgesOf(vertexOrKey) {
210
210
  const target = this._getVertex(vertexOrKey);
@@ -215,7 +215,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
215
215
  }
216
216
  /**
217
217
  * The function "degreeOf" returns the total degree of a vertex, which is the sum of its out-degree and in-degree.
218
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
218
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
219
219
  * @returns The sum of the out-degree and in-degree of the specified vertex or vertex ID.
220
220
  */
221
221
  degreeOf(vertexOrKey) {
@@ -223,7 +223,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
223
223
  }
224
224
  /**
225
225
  * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
226
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
226
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
227
227
  * @returns The number of incoming edges of the specified vertex or vertex ID.
228
228
  */
229
229
  inDegreeOf(vertexOrKey) {
@@ -231,7 +231,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
231
231
  }
232
232
  /**
233
233
  * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
234
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
234
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
235
235
  * @returns The number of outgoing edges from the specified vertex or vertex ID.
236
236
  */
237
237
  outDegreeOf(vertexOrKey) {
@@ -239,7 +239,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
239
239
  }
240
240
  /**
241
241
  * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
242
- * @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
242
+ * @param {VertexKey | VO} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `VO`.
243
243
  * @returns The function `edgesOf` returns an array of edges.
244
244
  */
245
245
  edgesOf(vertexOrKey) {
@@ -247,25 +247,25 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
247
247
  }
248
248
  /**
249
249
  * The function "getEdgeSrc" returns the source vertex of an edge, or null if the edge does not exist.
250
- * @param {E} e - The parameter "e" is of type E, which represents an edge in a graph.
251
- * @returns either a vertex object (V) or null.
250
+ * @param {EO} e - The parameter "e" is of type EO, which represents an edge in a graph.
251
+ * @returns either a vertex object (VO) or null.
252
252
  */
253
253
  getEdgeSrc(e) {
254
254
  return this._getVertex(e.src);
255
255
  }
256
256
  /**
257
257
  * The function "getEdgeDest" returns the destination vertex of an edge.
258
- * @param {E} e - The parameter "e" is of type "E", which represents an edge in a graph.
259
- * @returns either a vertex object of type V or null.
258
+ * @param {EO} e - The parameter "e" is of type "EO", which represents an edge in a graph.
259
+ * @returns either a vertex object of type VO or null.
260
260
  */
261
261
  getEdgeDest(e) {
262
262
  return this._getVertex(e.dest);
263
263
  }
264
264
  /**
265
265
  * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
266
- * @param {V | VertexKey | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
267
- * find the destinations. It can be either a `V` object, a `VertexKey` value, or `null`.
268
- * @returns an array of vertices (V[]).
266
+ * @param {VO | VertexKey | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
267
+ * find the destinations. It can be either a `VO` object, a `VertexKey` value, or `null`.
268
+ * @returns an array of vertices (VO[]).
269
269
  */
270
270
  getDestinations(vertex) {
271
271
  if (vertex === null) {
@@ -327,7 +327,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
327
327
  }
328
328
  /**
329
329
  * The `edgeSet` function returns an array of all the edges in the graph.
330
- * @returns The `edgeSet()` method returns an array of edges (`E[]`).
330
+ * @returns The `edgeSet()` method returns an array of edges (`EO[]`).
331
331
  */
332
332
  edgeSet() {
333
333
  let edges = [];
@@ -338,9 +338,9 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
338
338
  }
339
339
  /**
340
340
  * The function `getNeighbors` returns an array of neighboring vertices of a given vertex or vertex ID in a graph.
341
- * @param {V | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`V`) or a vertex ID
341
+ * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
342
342
  * (`VertexKey`).
343
- * @returns an array of vertices (V[]).
343
+ * @returns an array of vertices (VO[]).
344
344
  */
345
345
  getNeighbors(vertexOrKey) {
346
346
  const neighbors = [];
@@ -360,8 +360,8 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
360
360
  /**
361
361
  * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
362
362
  * otherwise it returns null.
363
- * @param {E} edge - The parameter `edge` is of type `E`, which represents an edge in a graph.
364
- * @returns The function `getEndsOfEdge` returns an array containing two vertices `[V, V]` if the edge exists in the
363
+ * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph.
364
+ * @returns The function `getEndsOfEdge` returns an array containing two vertices `[VO, VO]` if the edge exists in the
365
365
  * graph. If the edge does not exist, it returns `null`.
366
366
  */
367
367
  getEndsOfEdge(edge) {
@@ -379,7 +379,7 @@ class DirectedGraph extends abstract_graph_1.AbstractGraph {
379
379
  }
380
380
  /**
381
381
  * The function `_addEdgeOnly` adds an edge to a graph if the source and destination vertices exist.
382
- * @param {E} edge - The parameter `edge` is of type `E`, which represents an edge in a graph. It is the edge that
382
+ * @param {EO} edge - The parameter `edge` is of type `EO`, which represents an edge in a graph. It is the edge that
383
383
  * needs to be added to the graph.
384
384
  * @returns a boolean value. It returns true if the edge was successfully added to the graph, and false if either the
385
385
  * source or destination vertex does not exist in the graph.
@@ -13,7 +13,7 @@ export declare class MapVertex<V = any> extends DirectedVertex<V> {
13
13
  * @param {V} [val] - The "val" 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, lat: number, long: number, val?: V);
16
+ constructor(key: VertexKey, val: V, lat: number, long: number);
17
17
  private _lat;
18
18
  get lat(): number;
19
19
  set lat(value: number);
@@ -21,7 +21,7 @@ export declare class MapVertex<V = any> extends DirectedVertex<V> {
21
21
  get long(): number;
22
22
  set long(value: number);
23
23
  }
24
- export declare class MapEdge<V = any> extends DirectedEdge<V> {
24
+ export declare class MapEdge<E = any> extends DirectedEdge<E> {
25
25
  /**
26
26
  * The constructor function initializes a new instance of a class with the given source, destination, weight, and
27
27
  * value.
@@ -29,12 +29,12 @@ export declare class MapEdge<V = any> extends DirectedEdge<V> {
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 {V} [val] - The "val" parameter is an optional parameter of type V. It is used to store additional
32
+ * @param {E} [val] - The "val" 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?: V);
35
+ constructor(src: VertexKey, dest: VertexKey, weight?: number, val?: E);
36
36
  }
37
- export declare class MapGraph<V extends MapVertex<V['val']> = MapVertex, E extends MapEdge = MapEdge> extends DirectedGraph<V, E> {
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
  /**
39
39
  * The constructor function initializes the origin and bottomRight properties of a MapGraphCoordinate object.
40
40
  * @param {MapGraphCoordinate} origin - The `origin` parameter is a `MapGraphCoordinate` object that represents the
@@ -56,13 +56,13 @@ export declare class MapGraph<V extends MapVertex<V['val']> = MapVertex, E exten
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
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['val']`, which means it should be of the same type as the `val` property of the vertex class `V`.
59
+ * is of type `V`, which means it should be of the same type as the `val` 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
- * @returns The method is returning a new instance of the `MapVertex` class, casted as type `V`.
63
+ * @returns The method is returning a new instance of the `MapVertex` class, casted as type `VO`.
64
64
  */
65
- createVertex(key: VertexKey, lat?: number, long?: number, val?: V['val']): V;
65
+ createVertex(key: VertexKey, val?: 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.
@@ -73,7 +73,7 @@ export declare class MapGraph<V extends MapVertex<V['val']> = MapVertex, E exten
73
73
  * If the weight is not provided, it can be set to a default value or left undefined.
74
74
  * @param [val] - The `val` 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
- * @returns a new instance of the `MapEdge` class, cast as type `E`.
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['val']): E;
78
+ createEdge(src: VertexKey, dest: VertexKey, weight?: number, val?: E): EO;
79
79
  }
@@ -15,7 +15,7 @@ class MapVertex extends directed_graph_1.DirectedVertex {
15
15
  * @param {V} [val] - The "val" 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, lat, long, val) {
18
+ constructor(key, val, lat, long) {
19
19
  super(key, val);
20
20
  this._lat = lat;
21
21
  this._long = long;
@@ -42,7 +42,7 @@ 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 {V} [val] - The "val" parameter is an optional parameter of type V. It is used to store additional
45
+ * @param {E} [val] - The "val" 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
48
  constructor(src, dest, weight, val) {
@@ -83,14 +83,14 @@ class MapGraph extends directed_graph_1.DirectedGraph {
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
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['val']`, which means it should be of the same type as the `val` property of the vertex class `V`.
86
+ * is of type `V`, which means it should be of the same type as the `val` 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
- * @returns The method is returning a new instance of the `MapVertex` class, casted as type `V`.
90
+ * @returns The method is returning a new instance of the `MapVertex` class, casted as type `VO`.
91
91
  */
92
- createVertex(key, lat = this.origin[0], long = this.origin[1], val) {
93
- return new MapVertex(key, lat, long, val);
92
+ createVertex(key, val, lat = this.origin[0], long = this.origin[1]) {
93
+ return new MapVertex(key, val, 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.
@@ -102,7 +102,7 @@ class MapGraph extends directed_graph_1.DirectedGraph {
102
102
  * If the weight is not provided, it can be set to a default value or left undefined.
103
103
  * @param [val] - The `val` 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
- * @returns a new instance of the `MapEdge` class, cast as type `E`.
105
+ * @returns a new instance of the `MapEdge` class, cast as type `EO`.
106
106
  */
107
107
  createEdge(src, dest, weight, val) {
108
108
  return new MapEdge(src, dest, weight, val);