Package com.jgalgo.graph
Interface IEdgeIter
- All Superinterfaces:
EdgeIter<Integer,,Integer> IntIterator,Iterator<Integer>,PrimitiveIterator<Integer,,IntConsumer> PrimitiveIterator.OfInt
Iterator used to iterate over int graph edges.
This interface is a specification of EdgeIter for IntGraph.
Each int returned by IntIterator.nextInt() is an ID of an edge iterated by the iterator. The source and target
of the last iterated edge are available by sourceInt() and targetInt().
IntGraph g = ...;
int vertex = ...;
for (IEdgeIter eit = g.outEdges(vertex).iterator(); eit.hasNext();) {
int e = eit.nextInt();
int u = eit.sourceInt();
int v = eit.targetInt();
assert vertex == u;
System.out.println("Out edge of " + vertex + ": " + e + "(" + u + ", " + v + ")");
}
- Author:
- Barak Ugav
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong -
Method Summary
Modifier and TypeMethodDescriptiondefault IntegerpeekNext()Deprecated.intPeek at the next edge of the iterator without advancing it.default Integersource()Deprecated.Please usesourceInt()instead to avoid un/boxing.intGet the source vertex of the last returned edge.default Integertarget()Deprecated.Please usetargetInt()instead to avoid un/boxing.intGet the target vertex of the last returned edge.Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator
forEachRemaining, forEachRemaining, next, nextInt, skipMethods inherited from interface java.util.PrimitiveIterator.OfInt
forEachRemaining
-
Method Details
-
peekNextInt
int peekNextInt()Peek at the next edge of the iterator without advancing it.Similar to
IntIterator.nextInt()but without advancing the iterator.- Returns:
- the next edge of the iterator
- Throws:
NoSuchElementException- if there is no 'next' element
-
peekNext
Deprecated.Please usepeekNextInt()instead to avoid un/boxing.Peek at the next edge of the iterator without advancing it.Similar to
Iterator.next()but without advancing the iterator. -
sourceInt
int sourceInt()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
-
source
Deprecated.Please usesourceInt()instead to avoid un/boxing.Get the source vertex of the last returned edge.The behavior is undefined if
Iterator.next()was not called yet. -
targetInt
int targetInt()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
-
target
Deprecated.Please usetargetInt()instead to avoid un/boxing.Get the target vertex of the last returned edge.The behavior is undefined if
Iterator.next()was not called yet.
-
peekNextInt()instead to avoid un/boxing.