Package org.graph4j

Interface VertexIterator<V>

Type Parameters:
V - the type of vertex labels.

public interface VertexIterator<V>
An iterator over all the vertices of a graph.
Author:
Cristian Frăsinaru
  • Method Summary

    Modifier and Type
    Method
    Description
     
    double
     
    boolean
    Returns true if the iteration has more vertices.
    int
    Returns the next vertex in the iteration.
    void
    Removes the current vertex from the graph.
    void
    setLabel(V label)
     
    void
    setWeight(double weight)
     
  • Method Details

    • hasNext

      boolean hasNext()
      Returns true if the iteration has more vertices. If it returns true, the next() method would return a vertex rather than throwing an exception.
      Returns:
      true if the iteration has more vertices.
    • next

      int next()
      Returns the next vertex in the iteration.
      Returns:
      the next vertex in the iteration.
      Throws:
      NoSuchElementException - if the iteration has no more vertices.
    • setWeight

      void setWeight(double weight)
      Parameters:
      weight - the weight to be set for the current vertex.
    • getWeight

      double getWeight()
      Returns:
      the weight of the current vertex.
    • setLabel

      void setLabel(V label)
      Parameters:
      label - the label to be set for the current vertex.
    • getLabel

      V getLabel()
      Returns:
      the label of the current vertex.
    • remove

      void remove()
      Removes the current vertex from the graph.