Interface IEdgeIter

All Superinterfaces:
EdgeIter<Integer,Integer>, IntIterator, Iterator<Integer>, PrimitiveIterator<Integer,IntConsumer>, PrimitiveIterator.OfInt

public interface IEdgeIter extends EdgeIter<Integer,Integer>, IntIterator
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:
  • 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 default Integer peekNext()
      Deprecated.
      Please use peekNextInt() 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.

      Specified by:
      peekNext in interface EdgeIter<Integer,Integer>
      Returns:
      the next edge of 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 default Integer source()
      Deprecated.
      Please use sourceInt() 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.

      Specified by:
      source in interface EdgeIter<Integer,Integer>
      Returns:
      the source vertex of the last returned edge
    • 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 default Integer target()
      Deprecated.
      Please use targetInt() 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.

      Specified by:
      target in interface EdgeIter<Integer,Integer>
      Returns:
      the target vertex of the last returned edge