Package com.jgalgo
Interface EdgeIter
-
- All Superinterfaces:
it.unimi.dsi.fastutil.ints.IntIterator
,Iterator<Integer>
,PrimitiveIterator<Integer,IntConsumer>
,PrimitiveIterator.OfInt
public interface EdgeIter extends it.unimi.dsi.fastutil.ints.IntIterator
Iterator used to iterate over edges of a vertex.Each
int
returned byIntIterator.nextInt()
is an ID of an edge iterated by the iterator. The source and target of the last iterated edge are available bysource()
andtarget()
.Graph g = ...; int vertex = ...; for (EdgeIter eit = g.outEdges(vertex).iterator(); eit.hasNext();) { int e = eit.nextInt(); int u = eit.source(); int v = eit.target(); assert vertex == u; System.out.println("Out edge of " + vertex + ": " + e + "(" + u + ", " + v + ")"); }
- Author:
- Barak Ugav
- See Also:
EdgeSet
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
source()
Get the source vertex of the last returned edge.int
target()
Get the target vertex of the last returned edge.-
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator
forEachRemaining, forEachRemaining, next, nextInt, skip
-
Methods inherited from interface java.util.PrimitiveIterator.OfInt
forEachRemaining
-
-
-
-
Method Detail
-
source
int source()
Get the source vertex of the last returned edge.The behavior is undefined if
IntIterator.nextInt()
was not called yet.- Returns:
- the source vertex of the last returned edge
-
target
int target()
Get the target vertex of the last returned edge.The behavior is undefined if
IntIterator.nextInt()
was not called yet.- Returns:
- the target vertex of the last returned edge
-
-