Package org.graph4j

Interface NeighborIterator<E>

Type Parameters:
E - the type of edge labels.
All Known Subinterfaces:
PredecessorIterator<E>, SuccessorIterator<E>

public interface NeighborIterator<E>
Enables iteration over the edges incident with a source vertex, returning one by one the neighbors of the source along with information regarding the corresponding edge. In case of undirected graphs, it iterates over all the neighbors. In case of directed graphs, the default behavior is to iterate over the successors of the source vertex, returning the information regarding the edges outgoing from it.
Author:
Cristian Frăsinaru
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the position of the current vertex in the adjacency list of the source.
     
    double
    getEdgeData(int dataType)
     
    double
    getEdgeData(int dataType, double defaultValue)
     
    Sets the label of the current edge.
    double
    Returns the weight of the current edge.
    boolean
    Checks if there are more neighbors of the source vertex to iterate through.
    boolean
    Checks if the current neighbor is not the first one in the adjacency list.
    void
    incEdgeData(int dataType, double amount)
     
    default boolean
     
    default boolean
     
    int
    Returns the next neighbor.
    int
    Returns the previous neighbor.
    void
    Removes the current edge, from the source to the current vertex.
    void
    setEdgeData(int dataType, double value)
     
    void
    setEdgeLabel(E label)
    Sets the label of the current edge.
    void
    setEdgeWeight(double weight)
    Sets the label of the current edge.
  • Method Details

    • hasNext

      boolean hasNext()
      Checks if there are more neighbors of the source vertex to iterate through.
      Returns:
      true if there are more neighbors of the source vertex
    • next

      int next()
      Returns the next neighbor.
      Returns:
      the next neighbor of the source vertex
    • hasPrevious

      boolean hasPrevious()
      Checks if the current neighbor is not the first one in the adjacency list.
      Returns:
      true if the current neighbor is not the first one in the adjacency list
    • previous

      int previous()
      Returns the previous neighbor.
      Returns:
      the previous neighbor of the source vertex
    • adjListPos

      int adjListPos()
      Returns the position of the current vertex in the adjacency list of the source.
      Returns:
      the position of the current vertex in the adjacency list of the source.
    • edge

      Edge edge()
      Returns:
      the current edge;
    • getEdgeWeight

      double getEdgeWeight()
      Returns the weight of the current edge.
      Returns:
      the weight of the edge from the source vertex to the current vertex.
    • setEdgeWeight

      void setEdgeWeight(double weight)
      Sets the label of the current edge.
      Parameters:
      weight - the weight to be set for the edge connecting the source vertex to the current vertex
    • setEdgeData

      void setEdgeData(int dataType, double value)
    • incEdgeData

      void incEdgeData(int dataType, double amount)
    • getEdgeData

      double getEdgeData(int dataType)
    • getEdgeData

      double getEdgeData(int dataType, double defaultValue)
    • getEdgeLabel

      E getEdgeLabel()
      Sets the label of the current edge.
      Returns:
      the label of the edge from the source vertex to the current vertex vertex
    • setEdgeLabel

      void setEdgeLabel(E label)
      Sets the label of the current edge.
      Parameters:
      label - the label to be set for the edge connecting the source vertex to the current vertex
    • removeEdge

      void removeEdge()
      Removes the current edge, from the source to the current vertex. The current edge becomes the previously one.
    • isSuccessor

      default boolean isSuccessor()
    • isPredecessor

      default boolean isPredecessor()