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 TypeMethodDescriptionintReturns the position of the current vertex in the adjacency list of the source.edge()doublegetEdgeData(int dataType) doublegetEdgeData(int dataType, double defaultValue) Sets the label of the current edge.doubleReturns the weight of the current edge.booleanhasNext()Checks if there are more neighbors of the source vertex to iterate through.booleanChecks if the current neighbor is not the first one in the adjacency list.voidincEdgeData(int dataType, double amount) default booleandefault booleanintnext()Returns the next neighbor.intprevious()Returns the previous neighbor.voidRemoves the current edge, from the source to the current vertex.voidsetEdgeData(int dataType, double value) voidsetEdgeLabel(E label) Sets the label of the current edge.voidsetEdgeWeight(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:
trueif 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:
trueif 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
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()
-