Package org.graph4j
Interface PredecessorIterator<E>
- Type Parameters:
E- the type of edge labels.
- All Superinterfaces:
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 TypeMethodDescriptionintReturns the position of the target in the adjacency list of the current (source) vertex.edge()Sets the label of the current edge.doubleReturns the weight of the current edge.booleanhasNext()Checks if there are more predecessors of the target vertex to iterate through.booleanChecks if the current predecessor is not the first one in the predecessor list.intnext()Returns the next predecessor.intprevious()Returns the previous predecessor.voidRemoves the current edge, from the current to the target vertex.voidsetEdgeLabel(E label) Sets the label of the current edge.voidsetEdgeWeight(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:
hasNextin interfaceNeighborIterator<E>- Returns:
trueif there are more predecessors of the target vertex.
-
next
int next()Returns the next predecessor.- Specified by:
nextin interfaceNeighborIterator<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:
hasPreviousin interfaceNeighborIterator<E>- Returns:
trueif the current predecessor is not the first one in the predecessor list.
-
previous
int previous()Returns the previous predecessor.- Specified by:
previousin interfaceNeighborIterator<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:
adjListPosin interfaceNeighborIterator<E>- Returns:
- the position of the target in the adjacency list of the current (source) vertex.
-
edge
Edge edge()- Specified by:
edgein interfaceNeighborIterator<E>- Returns:
- the current edge;
-
getEdgeWeight
double getEdgeWeight()Returns the weight of the current edge.- Specified by:
getEdgeWeightin interfaceNeighborIterator<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:
setEdgeWeightin interfaceNeighborIterator<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:
getEdgeLabelin interfaceNeighborIterator<E>- Returns:
- the label of the edge from the current vertex to the target vertex.
-
setEdgeLabel
Sets the label of the current edge.- Specified by:
setEdgeLabelin interfaceNeighborIterator<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:
removeEdgein interfaceNeighborIterator<E>
-