Class Graph

java.lang.Object
net.minecraft.util.Graph

public final class Graph extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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 returns true if a cycle was found.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 returns true 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.