Class IdMap

  • All Implemented Interfaces:
    BatchNodeIterable, IdMapping, NodeIterator, NodeMapping

    public class IdMap
    extends java.lang.Object
    implements NodeMapping
    This is basically a long to int mapper. It sorts the id's in ascending order so its guaranteed that there is no ID greater then nextGraphId / capacity
    • Constructor Detail

      • IdMap

        public IdMap​(HugeLongArray graphIds,
                     org.neo4j.gds.collections.HugeSparseLongArray nodeToGraphIds,
                     LabelInformation labelInformation,
                     long nodeCount,
                     long highestNeoId,
                     AllocationTracker allocationTracker)
        initialize the map with pre-built sub arrays
    • Method Detail

      • memoryEstimation

        public static org.neo4j.gds.core.utils.mem.MemoryEstimation memoryEstimation()
      • toMappedNodeId

        public long toMappedNodeId​(long nodeId)
        Description copied from interface: IdMapping
        Map original nodeId to inner nodeId
        Specified by:
        toMappedNodeId in interface IdMapping
        Parameters:
        nodeId - must be smaller or equal to the id returned by IdMapping.highestNeoId()
      • 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
      • rootNodeMapping

        public NodeMapping rootNodeMapping()
        Description copied from interface: NodeMapping
        Returns the original node mapping if the current node mapping is filtered, otherwise it returns itself.
        Specified by:
        rootNodeMapping in interface NodeMapping
      • 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
      • availableNodeLabels

        public java.util.Set<org.neo4j.gds.NodeLabel> availableNodeLabels()
        Specified by:
        availableNodeLabels in interface NodeMapping
      • nodeLabels

        public java.util.Set<org.neo4j.gds.NodeLabel> nodeLabels​(long nodeId)
        Specified by:
        nodeLabels in interface NodeMapping
      • hasLabel

        public boolean hasLabel​(long nodeId,
                                org.neo4j.gds.NodeLabel label)
        Specified by:
        hasLabel in interface NodeMapping
      • withFilteredLabels

        public IdMap withFilteredLabels​(java.util.Collection<org.neo4j.gds.NodeLabel> nodeLabels,
                                        int concurrency)
        Specified by:
        withFilteredLabels in interface NodeMapping