Interface RelationshipIterator

    • Method Detail

      • supportsInverseIteration

        boolean supportsInverseIteration()
      • forEachRelationship

        void forEachRelationship​(long nodeId,
                                 RelationshipConsumer consumer)
        Calls the given consumer function for every relationship of a given node.
        Parameters:
        nodeId - id of the node for which to iterate relationships
        consumer - relationship consumer function
      • forEachRelationship

        void forEachRelationship​(long nodeId,
                                 double fallbackValue,
                                 RelationshipWithPropertyConsumer consumer)
        Calls the given consumer function for every relationship of a given node. If the graph was loaded with a relationship property, the property value of the relationship will be passed into the consumer, otherwise the given fallback value will be used.
        Parameters:
        nodeId - id of the node for which to iterate relationships
        fallbackValue - value used as relationship property if no properties were loaded
        consumer - relationship consumer function
      • forEachInverseRelationship

        void forEachInverseRelationship​(long nodeId,
                                        RelationshipConsumer consumer)
        Calls the given consumer for every inverse relationship of a given node. Inverse relationships basically mirror the relationships in that graph. For example, if `Graph.forEachRelationship(42)` returns `1337` then the result of `forEachInverseRelationship(1337)` contains `42. For undirected graphs, accessing the inverse relationships is never supported.

        Note, that this the inverse index might not always be present. Check Graph.characteristics() before calling this method to verify that the graphs is inverse indexed.

        Parameters:
        nodeId - if of the node for which to iterate the inverse relationships
        consumer - relationship consumer function
      • forEachInverseRelationship

        void forEachInverseRelationship​(long nodeId,
                                        double fallbackValue,
                                        RelationshipWithPropertyConsumer consumer)
        Calls the given consumer for every inverse relationship of a given node. If the graph was loaded with a relationship property, the property value of the relationship will be passed into the consumer, otherwise the given fallback value will be used.

        Inverse relationships basically mirror the relationships in that graph. For example, if `Graph.forEachRelationship(42)` returns `1337` then the result of `forEachInverseRelationship(1337)` contains `42. For undirected graphs, accessing the inverse relationships is never supported.

        Note, that this the inverse index might not always be present. Check Graph.characteristics() before calling this method to verify that the graphs is inverse indexed.

        Parameters:
        nodeId - if of the node for which to iterate the inverse relationships
        fallbackValue - value used as relationship property if no properties were loaded
        consumer - relationship consumer function
      • streamRelationships

        java.util.stream.Stream<RelationshipCursor> streamRelationships​(long nodeId,
                                                                        double fallbackValue)
      • concurrentCopy

        default RelationshipIterator concurrentCopy()
        Returns:
        a copy of this iterator that reuses new cursors internally, so that iterations happen independent of other iterations.