Package org.neo4j.gds.api
Class IdMapAdapter
- java.lang.Object
-
- org.neo4j.gds.api.IdMapAdapter
-
- All Implemented Interfaces:
BatchNodeIterable
,IdMap
,NodeIterator
,PartialIdMap
- Direct Known Subclasses:
HighLimitIdMap
public abstract class IdMapAdapter extends java.lang.Object implements IdMap
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.neo4j.gds.api.BatchNodeIterable
BatchNodeIterable.BitSetIdIterator, BatchNodeIterable.IdIterable, BatchNodeIterable.IdIterator
-
Nested classes/interfaces inherited from interface org.neo4j.gds.api.IdMap
IdMap.NodeLabelConsumer
-
-
Field Summary
-
Fields inherited from interface org.neo4j.gds.api.IdMap
NO_TYPE, NOT_FOUND, START_NODE_ID
-
-
Constructor Summary
Constructors Constructor Description IdMapAdapter(IdMap idMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNodeIdToLabel(long nodeId, org.neo4j.gds.NodeLabel nodeLabel)
Assigns a node to the given node label.void
addNodeLabel(org.neo4j.gds.NodeLabel nodeLabel)
Adds new node label to the available node labels.java.util.Set<org.neo4j.gds.NodeLabel>
availableNodeLabels()
java.util.Collection<org.neo4j.gds.collections.primitive.PrimitiveLongIterable>
batchIterables(long batchSize)
boolean
containsOriginalId(long originalNodeId)
Returns true iff the Neo4j id is mapped, otherwise false.void
forEachNode(java.util.function.LongPredicate consumer)
Iterate over each nodeIdvoid
forEachNodeLabel(long mappedNodeId, IdMap.NodeLabelConsumer consumer)
boolean
hasLabel(long mappedNodeId, org.neo4j.gds.NodeLabel label)
long
highestOriginalId()
The highest id that is mapped in this id mapping.long
nodeCount()
Number of mapped nodeIds.long
nodeCount(org.neo4j.gds.NodeLabel nodeLabel)
Number of mapped nodeIds for a specific node label.java.util.PrimitiveIterator.OfLong
nodeIterator()
java.util.PrimitiveIterator.OfLong
nodeIterator(java.util.Set<org.neo4j.gds.NodeLabel> labels)
java.util.List<org.neo4j.gds.NodeLabel>
nodeLabels(long mappedNodeId)
IdMap
rootIdMap()
Returns the original node mapping if the current node mapping is filtered, otherwise it returns itself.java.util.OptionalLong
rootNodeCount()
Number of mapped node ids in the root mapping.long
toMappedNodeId(long originalNodeId)
Maps an original node id to a mapped node id.long
toOriginalNodeId(long mappedNodeId)
Returns the original node id for the given mapped node id.long
toRootNodeId(long mappedNodeId)
Maps a filtered mapped node id to its root mapped node id.java.lang.String
typeId()
A unique identifier for this type of IdMap.java.util.Optional<FilteredIdMap>
withFilteredLabels(java.util.Collection<org.neo4j.gds.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.gds.api.IdMap
safeToMappedNodeId
-
-
-
-
Constructor Detail
-
IdMapAdapter
public IdMapAdapter(IdMap idMap)
-
-
Method Detail
-
typeId
public java.lang.String typeId()
Description copied from interface:IdMap
A unique identifier for this type of IdMap.
-
batchIterables
public java.util.Collection<org.neo4j.gds.collections.primitive.PrimitiveLongIterable> batchIterables(long batchSize)
- Specified by:
batchIterables
in interfaceBatchNodeIterable
- Returns:
- a collection of iterables over every node, partitioned by the given batch size.
-
toMappedNodeId
public long toMappedNodeId(long originalNodeId)
Description copied from interface:PartialIdMap
Maps an original node id to a mapped node id. In case of nested id maps, the mapped node id is always in the space of the innermost mapping.- Specified by:
toMappedNodeId
in interfacePartialIdMap
- Parameters:
originalNodeId
- must be smaller or equal to the id returned byIdMap.highestOriginalId()
-
toOriginalNodeId
public long toOriginalNodeId(long mappedNodeId)
Description copied from interface:IdMap
Returns the original node id for the given mapped node id. The original node id is typically the Neo4j node id. This method is guaranteed to always return the Neo4j id, regardless of the given mapped node id refers to a filtered node id space or a regular / unfiltered node id space.- Specified by:
toOriginalNodeId
in interfaceIdMap
-
toRootNodeId
public long toRootNodeId(long mappedNodeId)
Description copied from interface:IdMap
Maps a filtered mapped node id to its root mapped node id. This is necessary for nested (filtered) id mappings. If this mapping is a nested mapping, this method returns the root mapped node id of the parent mapping. For the root mapping this method returns the given node id.- Specified by:
toRootNodeId
in interfaceIdMap
-
rootIdMap
public IdMap rootIdMap()
Description copied from interface:IdMap
Returns the original node mapping if the current node mapping is filtered, otherwise it returns itself.
-
containsOriginalId
public boolean containsOriginalId(long originalNodeId)
Description copied from interface:IdMap
Returns true iff the Neo4j id is mapped, otherwise false.- Specified by:
containsOriginalId
in interfaceIdMap
-
nodeCount
public long nodeCount()
Description copied from interface:IdMap
Number of mapped nodeIds.
-
nodeCount
public long nodeCount(org.neo4j.gds.NodeLabel nodeLabel)
Description copied from interface:IdMap
Number of mapped nodeIds for a specific node label.
-
rootNodeCount
public java.util.OptionalLong rootNodeCount()
Description copied from interface:PartialIdMap
Number of mapped node ids in the root mapping. This is necessary for nested (filtered) id mappings.- Specified by:
rootNodeCount
in interfacePartialIdMap
-
highestOriginalId
public long highestOriginalId()
Description copied from interface:IdMap
The highest id that is mapped in this id mapping.The value is the upper bound of the original node id space.
- Specified by:
highestOriginalId
in interfaceIdMap
-
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 java.util.PrimitiveIterator.OfLong nodeIterator()
- Specified by:
nodeIterator
in interfaceNodeIterator
-
nodeIterator
public java.util.PrimitiveIterator.OfLong nodeIterator(java.util.Set<org.neo4j.gds.NodeLabel> labels)
- Specified by:
nodeIterator
in interfaceNodeIterator
-
nodeLabels
public java.util.List<org.neo4j.gds.NodeLabel> nodeLabels(long mappedNodeId)
- Specified by:
nodeLabels
in interfaceIdMap
-
forEachNodeLabel
public void forEachNodeLabel(long mappedNodeId, IdMap.NodeLabelConsumer consumer)
- Specified by:
forEachNodeLabel
in interfaceIdMap
-
availableNodeLabels
public java.util.Set<org.neo4j.gds.NodeLabel> availableNodeLabels()
- Specified by:
availableNodeLabels
in interfaceIdMap
-
hasLabel
public boolean hasLabel(long mappedNodeId, org.neo4j.gds.NodeLabel label)
-
addNodeLabel
public void addNodeLabel(org.neo4j.gds.NodeLabel nodeLabel)
Description copied from interface:IdMap
Adds new node label to the available node labels. The labels is not assigned to any nodes at this point.- Specified by:
addNodeLabel
in interfaceIdMap
- Parameters:
nodeLabel
- the node label to add
-
addNodeIdToLabel
public void addNodeIdToLabel(long nodeId, org.neo4j.gds.NodeLabel nodeLabel)
Description copied from interface:IdMap
Assigns a node to the given node label.- Specified by:
addNodeIdToLabel
in interfaceIdMap
- Parameters:
nodeId
- the node id to assignnodeLabel
- the node label to which the node will be assigned to
-
withFilteredLabels
public java.util.Optional<FilteredIdMap> withFilteredLabels(java.util.Collection<org.neo4j.gds.NodeLabel> nodeLabels, int concurrency)
- Specified by:
withFilteredLabels
in interfaceIdMap
-
-