Skip to content

Commit 00ac924

Browse files
Update StronglyConnectedComponentOptimized.java
1 parent 54f4025 commit 00ac924

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/thealgorithms/graph/StronglyConnectedComponentOptimized.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.HashMap;
44
import java.util.List;
55
import java.util.Stack;
6+
67
/**
78
* Finds the strongly connected components in a directed graph.
89
*
@@ -25,11 +26,11 @@ public void btrack(HashMap<Integer, List<Integer>> adjList, int[] visited, Stack
2526
}
2627
dfsCallsNodes.add(currentNode);
2728
}
28-
29+
2930
public void btrack2(HashMap<Integer, List<Integer>> adjRevList, int[] visited, int currentNode, List<Integer> newScc) {
3031
visited[currentNode] = 1;
3132
newScc.add(currentNode);
32-
List<Integer> neighbors = adjRevList.get(currentNode);
33+
List<Integer> neighbors = adjRevList.get(currentNode);
3334
// Check for null before iterating
3435
if (neighbors != null) {
3536
for (int neighbor : neighbors) {
@@ -39,7 +40,6 @@ public void btrack2(HashMap<Integer, List<Integer>> adjRevList, int[] visited, i
3940
}
4041
}
4142
}
42-
4343

4444
public int getOutput(HashMap<Integer, List<Integer>> adjList, int n) {
4545
int[] visited = new int[n];

0 commit comments

Comments
 (0)