Interface Bfs.Iter<V,​E>

  • Type Parameters:
    V - the vertices type
    E - the edges type
    All Superinterfaces:
    Iterator<V>
    All Known Subinterfaces:
    Bfs.IntIter
    Enclosing interface:
    Bfs

    public static interface Bfs.Iter<V,​E>
    extends Iterator<V>
    A BFS iterator.
    Author:
    Barak Ugav
    • Method Detail

      • hasNext

        boolean hasNext()
        Check whether there is more vertices to iterate over.
        Specified by:
        hasNext in interface Iterator<V>
      • next

        V next()
        Advance the iterator and return a vertex that was not visited by the iterator yet.
        Specified by:
        next in interface Iterator<V>
      • lastEdge

        E lastEdge()
        Get the edge that led to the last vertex returned by next().

        The behavior is undefined if next() was not called yet.

        Returns:
        the edge that led to the last vertex returned by next()
      • layer

        int layer()
        Get the layer of the last vertex returned by next().

        The layer of a vertex is the cardinality distance, the number of edges in the path, from the source(s) to the vertex.

        The behavior is undefined if next() was not called yet.

        Returns:
        the layer of the last vertex returned by next().