min-heap-typed 1.41.6 → 1.41.7
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.
|
@@ -172,21 +172,21 @@ class AbstractGraph {
|
|
|
172
172
|
return [];
|
|
173
173
|
}
|
|
174
174
|
const dfs = (cur, dest, visiting, path) => {
|
|
175
|
-
visiting.
|
|
175
|
+
visiting.add(cur);
|
|
176
176
|
if (cur === dest) {
|
|
177
177
|
paths.push([vertex1, ...path]);
|
|
178
178
|
}
|
|
179
179
|
const neighbors = this.getNeighbors(cur);
|
|
180
180
|
for (const neighbor of neighbors) {
|
|
181
|
-
if (!visiting.
|
|
181
|
+
if (!visiting.has(neighbor)) {
|
|
182
182
|
path.push(neighbor);
|
|
183
183
|
dfs(neighbor, dest, visiting, path);
|
|
184
|
-
|
|
184
|
+
path.pop();
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
visiting.
|
|
187
|
+
visiting.delete(cur);
|
|
188
188
|
};
|
|
189
|
-
dfs(vertex1, vertex2, new
|
|
189
|
+
dfs(vertex1, vertex2, new Set(), []);
|
|
190
190
|
return paths;
|
|
191
191
|
}
|
|
192
192
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "min-heap-typed",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.7",
|
|
4
4
|
"description": "Min Heap. Javascript & Typescript Data Structure.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -132,6 +132,6 @@
|
|
|
132
132
|
"typescript": "^4.9.5"
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
|
-
"data-structure-typed": "^1.41.
|
|
135
|
+
"data-structure-typed": "^1.41.7"
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -233,8 +233,8 @@ export abstract class AbstractGraph<
|
|
|
233
233
|
return [];
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
const dfs = (cur: VO, dest: VO, visiting:
|
|
237
|
-
visiting.
|
|
236
|
+
const dfs = (cur: VO, dest: VO, visiting: Set<VO>, path: VO[]) => {
|
|
237
|
+
visiting.add(cur);
|
|
238
238
|
|
|
239
239
|
if (cur === dest) {
|
|
240
240
|
paths.push([vertex1, ...path]);
|
|
@@ -242,17 +242,17 @@ export abstract class AbstractGraph<
|
|
|
242
242
|
|
|
243
243
|
const neighbors = this.getNeighbors(cur);
|
|
244
244
|
for (const neighbor of neighbors) {
|
|
245
|
-
if (!visiting.
|
|
245
|
+
if (!visiting.has(neighbor)) {
|
|
246
246
|
path.push(neighbor);
|
|
247
247
|
dfs(neighbor, dest, visiting, path);
|
|
248
|
-
|
|
248
|
+
path.pop();
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
visiting.
|
|
252
|
+
visiting.delete(cur);
|
|
253
253
|
};
|
|
254
254
|
|
|
255
|
-
dfs(vertex1, vertex2, new
|
|
255
|
+
dfs(vertex1, vertex2, new Set<VO>(), []);
|
|
256
256
|
return paths;
|
|
257
257
|
}
|
|
258
258
|
|