We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 064d50d + 390eb73 commit ae05db0Copy full SHA for ae05db0
Graph Theory/Depth First Search/dfs.js
@@ -18,6 +18,7 @@ function DFSFindPath(graph, srcNode, destNode) {
18
isFound = node === destNode;
19
if (isFound) return;
20
21
+ if (!graph[node]) return;
22
for (var i = 0; i < graph[node].length; i++) {
23
nextNode = graph[node][i];
24
if (isVisited[nextNode]) continue;
0 commit comments