Class BfsDfsArcSpliterator<V,A>

Type Parameters:
V - the vertex data type
A - the arrow data type
All Implemented Interfaces:
Spliterator<Arc<V,A>>, BareEnumerator<Arc<V,A>>, Enumerator<Arc<V,A>>

public class BfsDfsArcSpliterator<V,A> extends AbstractEnumerator<Arc<V,A>>
Enumerates arcs in a graph starting from a root vertex in breadth-first-order or in depth-first-order.
Author:
Werner Randelshofer
  • Constructor Details

    • BfsDfsArcSpliterator

      public BfsDfsArcSpliterator(Function<V,Iterable<Arc<V,A>>> nextArcsFunction, V root, boolean dfs)
      Creates a new instance.
      Parameters:
      nextArcsFunction - the nextFunction
      root - the root vertex
      dfs - whether to perform depth-first-search instead of breadth-first-search
    • BfsDfsArcSpliterator

      public BfsDfsArcSpliterator(@Nullable Function<V,Iterable<Arc<V,A>>> nextFunction, @Nullable V root, @Nullable AddToSet<Arc<V,A>> visited, boolean dfs)
      Creates a new instance.
      Parameters:
      nextFunction - the function that returns the next vertices of a given vertex
      root - the root vertex
      visited - a function that adds an arc to a set, and returns true if the arc was not yet in the set
      dfs - whether to perform depth-first-search instead of breadth-first-search
  • Method Details

    • moveNext

      public boolean moveNext()