Interface EdgeIterator

All Superinterfaces:
EdgeIteratorState
All Known Subinterfaces:
AllEdgesIterator
All Known Implementing Classes:
BaseGraph.AllEdgeIterator, BaseGraph.EdgeIteratorImpl

public interface EdgeIterator extends EdgeIteratorState
Iterates through all edges of one node. Avoids object creation in-between via direct access methods. If you want to access some properties of an 'edge' (i.e. the current state) for later usage store it via edgeIterator.detach() or edgeIterator.getEdge() instead of the iterator itself. Usage:
 EdgeExplorer explorer = graph.createEdgeExplorer();
 EdgeIterator iter = explorer.setBaseNode(nodeId);
 // calls to iter.getAdjNode(), getDistance() without calling next() will cause undefined behaviour!
 while(iter.next()) {
   int baseNodeId = iter.getBaseNode(); // equal to nodeId
   int adjacentNodeId = iter.getAdjNode(); // this is the node where this edge state is "pointing to"
   ...
 }
 

Author:
Peter Karich
See Also:
  • Field Details

    • NO_EDGE

      static final int NO_EDGE
      Integer value used in places where normally an edge would be expected, but none is given. For example in the shortest path tree of route calculations every child element should have an incoming edge, but for the root item there is no parent so we would use this value instead.
      See Also:
    • ANY_EDGE

      static final int ANY_EDGE
      Integer value used in places where normally an edge would be expected, but no specific edge shall be specified.
      See Also:
  • Method Details

    • next

      boolean next()
      To be called to go to the next edge state.

      Returns:
      true if an edge state is available