Class BfsDfsIndexedVertexSpliterator

All Implemented Interfaces:
Spliterator<Integer>, Spliterator.OfInt, Spliterator.OfPrimitive<Integer,IntConsumer,Spliterator.OfInt>, BareEnumerator<Integer>, Enumerator<Integer>, Enumerator.OfInt

public class BfsDfsIndexedVertexSpliterator extends AbstractIntEnumerator
Enumerates vertices in a graph with indexed vertices starting from a root vertex in breadth-first-order or in depth-first-order.
Author:
Werner Randelshofer
  • Constructor Details

    • BfsDfsIndexedVertexSpliterator

      public BfsDfsIndexedVertexSpliterator(@NonNull Function<Integer,Enumerator.OfInt> nextFunction, int root, int vertexCount, boolean dfs)
      Creates a new instance.
      Parameters:
      nextFunction - the nextFunction
      root - the root vertex
      vertexCount - the vertex count
      dfs - whether to perform depth-first-search instead of breadth-first-search
    • BfsDfsIndexedVertexSpliterator

      public BfsDfsIndexedVertexSpliterator(@NonNull Function<Integer,Enumerator.OfInt> nextFunction, int root, @NonNull AddToIntSet visited, boolean dfs)
      Creates a new instance.
      Parameters:
      nextFunction - the nextFunction
      root - the root vertex
      dfs - whether to perform depth-first-search instead of breadth-first-search
  • Method Details

    • moveNext

      public boolean moveNext()