Class GraphAdapter

    • Field Detail

      • graph

        protected final Graph graph
    • Constructor Detail

      • GraphAdapter

        public GraphAdapter​(Graph graph)
    • Method Detail

      • graph

        public Graph graph()
      • relationshipCount

        public long relationshipCount()
        Specified by:
        relationshipCount in interface Graph
        Returns:
        returns the total number of relationships in the graph.
      • isUndirected

        public boolean isUndirected()
        Specified by:
        isUndirected in interface Graph
      • canRelease

        public void canRelease​(boolean canRelease)
        Specified by:
        canRelease in interface Graph
      • degree

        public int degree​(long nodeId)
        Specified by:
        degree in interface Degrees
      • toMappedNodeId

        public long toMappedNodeId​(long nodeId)
        Description copied from interface: IdMapping
        Map original nodeId to inner nodeId
        Specified by:
        toMappedNodeId in interface IdMapping
      • toOriginalNodeId

        public long toOriginalNodeId​(long nodeId)
        Description copied from interface: IdMapping
        Map inner nodeId back to original nodeId
        Specified by:
        toOriginalNodeId in interface IdMapping
      • toRootNodeId

        public long toRootNodeId​(long nodeId)
        Description copied from interface: IdMapping
        Maps an internal id to its root internal node id. This is necessary for nested (filtered) id mappings. If this mapping is a nested mapping, this method returns the root node id of the parent mapping. For the root mapping this method returns the given node id.
        Specified by:
        toRootNodeId in interface IdMapping
      • contains

        public boolean contains​(long nodeId)
        Description copied from interface: IdMapping
        Returns true iff the nodeId is mapped, otherwise false.
        Specified by:
        contains in interface IdMapping
      • nodeCount

        public long nodeCount()
        Description copied from interface: IdMapping
        Number of mapped nodeIds.
        Specified by:
        nodeCount in interface IdMapping
      • rootNodeCount

        public long rootNodeCount()
        Description copied from interface: IdMapping
        Number of mapped node ids in the root mapping. This is necessary for nested (filtered) id mappings.
        Specified by:
        rootNodeCount in interface IdMapping
      • forEachNode

        public void forEachNode​(java.util.function.LongPredicate consumer)
        Description copied from interface: NodeIterator
        Iterate over each nodeId
        Specified by:
        forEachNode in interface NodeIterator
      • nodeProperties

        public NodeProperties nodeProperties​(java.lang.String propertyKey)
        Description copied from interface: NodePropertyContainer
        Return the property values for a property key NOTE: Avoid using this on the hot path, favor caching the NodeProperties object when possible
        Specified by:
        nodeProperties in interface NodePropertyContainer
        Parameters:
        propertyKey - the node property key
        Returns:
        the values associated with that key
      • forEachRelationship

        public void forEachRelationship​(long nodeId,
                                        RelationshipConsumer consumer)
        Description copied from interface: RelationshipIterator
        Calls the given consumer function for every relationship of a given node.
        Specified by:
        forEachRelationship in interface RelationshipIterator
        Parameters:
        nodeId - id of the node for which to iterate relationships
        consumer - relationship consumer function
      • forEachRelationship

        public void forEachRelationship​(long nodeId,
                                        double fallbackValue,
                                        RelationshipWithPropertyConsumer consumer)
        Description copied from interface: RelationshipIterator
        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.
        Specified by:
        forEachRelationship in interface RelationshipIterator
        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
      • relationshipProperty

        public double relationshipProperty​(long sourceNodeId,
                                           long targetNodeId,
                                           double fallbackValue)
        Description copied from interface: RelationshipProperties
        get value of property on relationship between source and target node id
        Specified by:
        relationshipProperty in interface RelationshipProperties
        Parameters:
        sourceNodeId - source node
        targetNodeId - target node
        fallbackValue - value to use if relationship has no property value
        Returns:
        the property value
      • relationshipProperty

        public double relationshipProperty​(long sourceNodeId,
                                           long targetNodeId)
        Description copied from interface: RelationshipProperties
        Returns the property value for a relationship defined by its source and target nodes.
        Specified by:
        relationshipProperty in interface RelationshipProperties
      • release

        public void release()
        Description copied from interface: Graph
        Release all resources which are not part of the result or IdMapping
        Specified by:
        release in interface Graph
      • releaseTopology

        public void releaseTopology()
        Description copied from interface: Graph
        Release only the topological data associated with that graph.
        Specified by:
        releaseTopology in interface Graph
      • releaseProperties

        public void releaseProperties()
        Description copied from interface: Graph
        Release only the properties associated with that graph.
        Specified by:
        releaseProperties in interface Graph
      • isMultiGraph

        public boolean isMultiGraph()
        Description copied from interface: Graph
        Whether the graph is guaranteed to have no parallel relationships. If this returns false it still may be parallel-free, but we do not know.
        Specified by:
        isMultiGraph in interface Graph
        Returns:
        true iff the graph has maximum one relationship between each pair of nodes.