Skip to content

Commit 87d208e

Browse files
removed .* import and made small visual change
1 parent cfdad19 commit 87d208e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package com.thealgorithms.graph;
22

3-
import java.util.*;
3+
import java.util.ArrayList;
4+
import java.util.Collections;
5+
import java.util.HashMap;
6+
import java.util.HashSet;
7+
import java.util.List;
8+
import java.util.Map;
9+
import java.util.Objects;
10+
import java.util.Set;
411

512
/**
613
* DFS that visits a successor only when all its predecessors are already visited,
@@ -141,7 +148,9 @@ private static <T> boolean allParentsVisited(T node, Set<T> visited, Map<T, List
141148
}
142149

143150
private static <T> boolean appearsAnywhere(Map<T, List<T>> succ, T node) {
144-
if (succ.containsKey(node)) return true;
151+
if (succ.containsKey(node)) {
152+
return true;
153+
}
145154
for (List<T> nbrs : succ.values()) {
146155
if (nbrs != null && nbrs.contains(node)) return true;
147156
}

0 commit comments

Comments
 (0)