Enum Class TraversalAlgorithm

java.lang.Object
java.lang.Enum<TraversalAlgorithm>
me.lucko.luckperms.common.graph.TraversalAlgorithm
All Implemented Interfaces:
Serializable, Comparable<TraversalAlgorithm>, java.lang.constant.Constable

public enum TraversalAlgorithm extends Enum<TraversalAlgorithm>
A set of traversal algorithm implementations for Graphs.
  • Enum Constant Details

    • BREADTH_FIRST

      public static final TraversalAlgorithm BREADTH_FIRST
      Traverses in breadth-first order.

      That is, all the nodes of depth 0 are returned, then depth 1, then 2, and so on.

      See Wikipedia for more info.

    • DEPTH_FIRST_PRE_ORDER

      public static final TraversalAlgorithm DEPTH_FIRST_PRE_ORDER
      Traverses in depth-first pre-order.

      "Pre-order" implies that nodes appear in the order in which they are first visited.

      See Wikipedia for more info.

    • DEPTH_FIRST_POST_ORDER

      public static final TraversalAlgorithm DEPTH_FIRST_POST_ORDER
      Traverses in depth-first post-order.

      "Post-order" implies that nodes appear in the order in which they are visited for the last time.

      See Wikipedia for more info.

  • Method Details

    • values

      public static TraversalAlgorithm[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TraversalAlgorithm valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • traverse

      public abstract <N> Iterable<N> traverse(Graph<N> graph, N startNode)
      Returns an unmodifiable Iterable over the nodes reachable from startNode, in the order defined by the algorithm.
      Type Parameters:
      N - the node type
      Parameters:
      graph - the graph
      startNode - the start node
      Returns:
      the traversal