Package org.graph4j

Interface PredecessorIterator<E>

Type Parameters:
E - the type of edge labels.
All Superinterfaces:
NeighborIterator<E>

public interface PredecessorIterator<E> extends NeighborIterator<E>
Enables iteration over the edges incident to a target vertex, returning one by one the predecessors of the target along with information regarding the corresponding edge. Used in directed graphs.
Author:
Cristian Frăsinaru
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the position of the target in the adjacency list of the current (source) vertex.
     
    Sets the label of the current edge.
    double
    Returns the weight of the current edge.
    boolean
    Checks if there are more predecessors of the target vertex to iterate through.
    boolean
    Checks if the current predecessor is not the first one in the predecessor list.
    int
    Returns the next predecessor.
    int
    Returns the previous predecessor.
    void
    Removes the current edge, from the current to the target vertex.
    void
    setEdgeLabel(E label)
    Sets the label of the current edge.
    void
    setEdgeWeight(double weight)
    Sets the label of the current edge.

    Methods inherited from interface org.graph4j.NeighborIterator

    getEdgeData, getEdgeData, incEdgeData, isPredecessor, isSuccessor, setEdgeData
  • Method Details

    • hasNext

      boolean hasNext()
      Checks if there are more predecessors of the target vertex to iterate through.
      Specified by:
      hasNext in interface NeighborIterator<E>
      Returns:
      true if there are more predecessors of the target vertex.
    • next

      int next()
      Returns the next predecessor.
      Specified by:
      next in interface NeighborIterator<E>
      Returns:
      the next predecessor of the target vertex.
    • hasPrevious

      boolean hasPrevious()
      Checks if the current predecessor is not the first one in the predecessor list.
      Specified by:
      hasPrevious in interface NeighborIterator<E>
      Returns:
      true if the current predecessor is not the first one in the predecessor list.
    • previous

      int previous()
      Returns the previous predecessor.
      Specified by:
      previous in interface NeighborIterator<E>
      Returns:
      the previous predecessor of the target vertex.
    • adjListPos

      int adjListPos()
      Returns the position of the target in the adjacency list of the current (source) vertex.
      Specified by:
      adjListPos in interface NeighborIterator<E>
      Returns:
      the position of the target in the adjacency list of the current (source) vertex.
    • edge

      Edge edge()
      Specified by:
      edge in interface NeighborIterator<E>
      Returns:
      the current edge;
    • getEdgeWeight

      double getEdgeWeight()
      Returns the weight of the current edge.
      Specified by:
      getEdgeWeight in interface NeighborIterator<E>
      Returns:
      the weight of the edge from the current vertex to the target vertex.
    • setEdgeWeight

      void setEdgeWeight(double weight)
      Sets the label of the current edge.
      Specified by:
      setEdgeWeight in interface NeighborIterator<E>
      Parameters:
      weight - the weight to be set for the edge connecting the current vertex to the target vertex
    • getEdgeLabel

      E getEdgeLabel()
      Sets the label of the current edge.
      Specified by:
      getEdgeLabel in interface NeighborIterator<E>
      Returns:
      the label of the edge from the current vertex to the target vertex.
    • setEdgeLabel

      void setEdgeLabel(E label)
      Sets the label of the current edge.
      Specified by:
      setEdgeLabel in interface NeighborIterator<E>
      Parameters:
      label - the label to be set for the edge connecting the current vertex to the target vertex.
    • removeEdge

      void removeEdge()
      Removes the current edge, from the current to the target vertex. The current edge becomes the previously one.
      Specified by:
      removeEdge in interface NeighborIterator<E>