Package net.minecraft.util
Class Graph
java.lang.Object
net.minecraft.util.Graph
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> boolean
depthFirstSearch
(Map<T, Set<T>> pGraph, Set<T> pNonCyclicalNodes, Set<T> pPathSet, Consumer<T> pOnNonCyclicalNodeFound, T pCurrentNode) Detects if a cycle is present in the given graph, via a depth first search, and returnstrue
if a cycle was found.
-
Constructor Details
-
Graph
private Graph()
-
-
Method Details
-
depthFirstSearch
public static <T> boolean depthFirstSearch(Map<T, Set<T>> pGraph, Set<T> pNonCyclicalNodes, Set<T> pPathSet, Consumer<T> pOnNonCyclicalNodeFound, T pCurrentNode) Detects if a cycle is present in the given graph, via a depth first search, and returnstrue
if a cycle was found.- Parameters:
pNonCyclicalNodes
- Nodes that are verified to have no cycles involving them.pPathSet
- The current collection of seen nodes. When invoked not recursively, this should be an empty set.pOnNonCyclicalNodeFound
- Invoked on each node as we prove that no cycles can be reached starting from this node.
-