Interface RelationshipIterator

    • Method Detail

      • 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 - id 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 - id 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)
        Returns a stream which returns every relationship in the graph starting from the given node id. The id space returned for source and target nodes is the internal id space with respect to the graph this method was called on.

        The object returned by the stream is a single instance of RelationshipCursor. The same instance is used for every element in the stream and should thus not be stored for later use but instead be consumed directly before consuming the next element of the stream.

        Parameters:
        nodeId - id of the node for which to stream the relationships
        fallbackValue - value used as relationship property if no properties were loaded
      • concurrentCopy

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