Class NodeIterator

    • Field Detail

      • EMPTY

        public static final NodeIterator EMPTY
        An empty node iterator.
    • Constructor Detail

      • NodeIterator

        public NodeIterator()
    • Method Detail

      • outdegree

        public abstract int outdegree()
        Returns the outdegree of the current node.
        Returns:
        the outdegree of the current node.
      • successors

        public LazyIntIterator successors()
        Returns a lazy iterator over the successors of the current node. The iteration terminates when -1 is returned.

        This implementation just wraps the array returned by successorArray().

        Returns:
        a lazy iterator over the successors of the current node.
      • successorArray

        public int[] successorArray()
        Returns a reference to an array containing the successors of the current node.

        The returned array may contain more entries than the outdegree of the current node. However, only those with indices from 0 (inclusive) to the outdegree of the current node (exclusive) contain valid data.

        This implementation just unwrap the iterator returned by successors().

        Returns:
        an array whose first elements are the successors of the current node; the array must not be modified by the caller.
      • copy

        public NodeIterator copy​(int upperBound)
        Creates a copy of this iterator that will never return nodes ≥ the specified bound; the copy must be accessible by a different thread. Optional operation (it should be implemented by all classes that allow to scan the graph more than once).

        This implementation just throws an UnsupportedOperationException. It should be kept in sync with the result of ImmutableGraph.hasCopiableIterators().

        Parameters:
        upperBound - the upper bound.
        Returns:
        a copy of this iterator, with the given upper bound.