We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b928eb commit 528b0c0Copy full SHA for 528b0c0
algorithm/graph_search/dfs/exploration/code.js
@@ -33,9 +33,10 @@ function DFSExplore(graph, source) {
33
}
34
35
var visited = DFSExplore(G, 0);
36
-if (G.length === Object.keys(visited).length) {
+var check = true;
37
+for (var i = 0; i < visited.length; i++) check &= visited[i];
38
+if (check) {
39
logger._print('The Graph is CONNECTED');
-}
-else {
40
+} else {
41
logger._print('The Graph is NOT CONNECTED');
42
0 commit comments