Package org.neo4j.graphalgo.core.loading
Class BitIdMap
- java.lang.Object
-
- org.neo4j.graphalgo.core.loading.BitIdMap
-
- All Implemented Interfaces:
BatchNodeIterable
,IdMapping
,NodeIterator
,NodeMapping
public class BitIdMap extends java.lang.Object implements NodeMapping, NodeIterator, BatchNodeIterable
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.neo4j.graphalgo.api.BatchNodeIterable
BatchNodeIterable.IdIterable, BatchNodeIterable.IdIterator
-
Nested classes/interfaces inherited from interface org.neo4j.graphalgo.api.NodeMapping
NodeMapping.NodeLabelConsumer
-
-
Field Summary
-
Fields inherited from interface org.neo4j.graphalgo.api.IdMapping
START_NODE_ID
-
Fields inherited from interface org.neo4j.graphalgo.api.NodeMapping
NOT_FOUND
-
-
Constructor Summary
Constructors Constructor Description BitIdMap(SparseLongArray sparseLongArray, java.util.Map<NodeLabel,com.carrotsearch.hppc.BitSet> labelInformation, AllocationTracker tracker)
initialize the map with pre-built sub arrays
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<NodeLabel>
availableNodeLabels()
java.util.Collection<PrimitiveLongIterable>
batchIterables(long batchSize)
boolean
contains(long nodeId)
Returns true iff the nodeId is mapped, otherwise false.void
forEachNode(java.util.function.LongPredicate consumer)
Iterate over each nodeIdvoid
forEachNodeLabel(long nodeId, NodeMapping.NodeLabelConsumer consumer)
boolean
hasLabel(long nodeId, NodeLabel label)
long
highestNeoId()
java.util.Map<NodeLabel,com.carrotsearch.hppc.BitSet>
labelInformation()
static MemoryEstimation
memoryEstimation()
long
nodeCount()
Number of mapped nodeIds.PrimitiveLongIterator
nodeIterator()
java.util.Set<NodeLabel>
nodeLabels(long nodeId)
long
rootNodeCount()
Number of mapped node ids in the root mapping.SparseLongArray
sparseLongArray()
long
toMappedNodeId(long nodeId)
Map original nodeId to inner nodeIdlong
toOriginalNodeId(long nodeId)
Map inner nodeId back to original nodeIdlong
toRootNodeId(long nodeId)
Maps an internal id to its root internal node id.BitIdMap
withFilteredLabels(java.util.Collection<NodeLabel> nodeLabels, int concurrency)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.neo4j.graphalgo.api.IdMapping
cloneIdMapping
-
-
-
-
Constructor Detail
-
BitIdMap
public BitIdMap(SparseLongArray sparseLongArray, java.util.Map<NodeLabel,com.carrotsearch.hppc.BitSet> labelInformation, AllocationTracker tracker)
initialize the map with pre-built sub arrays
-
-
Method Detail
-
memoryEstimation
public static MemoryEstimation memoryEstimation()
-
toMappedNodeId
public long toMappedNodeId(long nodeId)
Description copied from interface:IdMapping
Map original nodeId to inner nodeId- Specified by:
toMappedNodeId
in interfaceIdMapping
-
toOriginalNodeId
public long toOriginalNodeId(long nodeId)
Description copied from interface:IdMapping
Map inner nodeId back to original nodeId- Specified by:
toOriginalNodeId
in interfaceIdMapping
-
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 interfaceIdMapping
-
contains
public boolean contains(long nodeId)
Description copied from interface:IdMapping
Returns true iff the nodeId is mapped, otherwise false.
-
nodeCount
public long nodeCount()
Description copied from interface:IdMapping
Number of mapped nodeIds.
-
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 interfaceIdMapping
-
highestNeoId
public long highestNeoId()
- Specified by:
highestNeoId
in interfaceIdMapping
-
forEachNode
public void forEachNode(java.util.function.LongPredicate consumer)
Description copied from interface:NodeIterator
Iterate over each nodeId- Specified by:
forEachNode
in interfaceNodeIterator
-
nodeIterator
public PrimitiveLongIterator nodeIterator()
- Specified by:
nodeIterator
in interfaceNodeIterator
-
batchIterables
public java.util.Collection<PrimitiveLongIterable> batchIterables(long batchSize)
- Specified by:
batchIterables
in interfaceBatchNodeIterable
- Returns:
- a collection of iterables over every node, partitioned by the given batch size.
-
availableNodeLabels
public java.util.Set<NodeLabel> availableNodeLabels()
- Specified by:
availableNodeLabels
in interfaceNodeMapping
-
nodeLabels
public java.util.Set<NodeLabel> nodeLabels(long nodeId)
- Specified by:
nodeLabels
in interfaceNodeMapping
-
forEachNodeLabel
public void forEachNodeLabel(long nodeId, NodeMapping.NodeLabelConsumer consumer)
- Specified by:
forEachNodeLabel
in interfaceNodeMapping
-
hasLabel
public boolean hasLabel(long nodeId, NodeLabel label)
- Specified by:
hasLabel
in interfaceNodeMapping
-
withFilteredLabels
public BitIdMap withFilteredLabels(java.util.Collection<NodeLabel> nodeLabels, int concurrency)
- Specified by:
withFilteredLabels
in interfaceNodeMapping
-
labelInformation
public java.util.Map<NodeLabel,com.carrotsearch.hppc.BitSet> labelInformation()
-
sparseLongArray
public SparseLongArray sparseLongArray()
-
-