Package org.neo4j.gds.api
Interface IdMap
-
- All Superinterfaces:
BatchNodeIterable
,NodeIterator
,PartialIdMap
- All Known Subinterfaces:
CSRGraph
,FilteredIdMap
,Graph
- All Known Implementing Classes:
ArrayIdMap
,CSRGraphAdapter
,FilteredLabeledIdMap
,GraphAdapter
,HighLimitIdMap
,HugeGraph
,IdMapAdapter
,LabeledIdMap
,NodeFilteredGraph
,UnionGraph
public interface IdMap extends PartialIdMap, NodeIterator, BatchNodeIterable
Bidirectional mapping between two id spaces. Usually the IdMap is used to map between neo4j node ids and consecutive mapped node ids.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
IdMap.NodeLabelConsumer
-
Nested classes/interfaces inherited from interface org.neo4j.gds.api.BatchNodeIterable
BatchNodeIterable.BitSetIdIterator, BatchNodeIterable.IdIterable, BatchNodeIterable.IdIterator
-
-
Field Summary
Fields Modifier and Type Field Description static long
NOT_FOUND
Defines the value for unmapped idsstatic long
START_NODE_ID
Defines the lower bound of mapped ids
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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()
boolean
contains(long originalNodeId)
Returns true iff the Neo4j id is mapped, otherwise false.void
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.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.default long
safeToMappedNodeId(long originalNodeId)
Map original nodeId to mapped nodeId Returns org.neo4j.gds.api.IdMap#NOT_FOUND if the nodeId is not mapped.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.default java.util.Optional<FilteredIdMap>
withFilteredLabels(java.util.Collection<org.neo4j.gds.NodeLabel> nodeLabels, int concurrency)
-
Methods inherited from interface org.neo4j.gds.api.BatchNodeIterable
batchIterables
-
Methods inherited from interface org.neo4j.gds.api.NodeIterator
forEachNode, nodeIterator, nodeIterator
-
Methods inherited from interface org.neo4j.gds.api.PartialIdMap
rootNodeCount, toMappedNodeId
-
-
-
-
Field Detail
-
START_NODE_ID
static final long START_NODE_ID
Defines the lower bound of mapped ids- See Also:
- Constant Field Values
-
NOT_FOUND
static final long NOT_FOUND
Defines the value for unmapped ids- See Also:
- Constant Field Values
-
-
Method Detail
-
safeToMappedNodeId
default long safeToMappedNodeId(long originalNodeId)
Map original nodeId to mapped nodeId Returns org.neo4j.gds.api.IdMap#NOT_FOUND if the nodeId is not mapped.
-
toOriginalNodeId
long toOriginalNodeId(long mappedNodeId)
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.
-
toRootNodeId
long toRootNodeId(long mappedNodeId)
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.
-
contains
boolean contains(long originalNodeId)
Returns true iff the Neo4j id is mapped, otherwise false.
-
nodeCount
long nodeCount()
Number of mapped nodeIds.
-
nodeCount
long nodeCount(org.neo4j.gds.NodeLabel nodeLabel)
Number of mapped nodeIds for a specific node label.
-
highestOriginalId
long highestOriginalId()
The highest id that is mapped in this id mapping.The value is the upper bound of the original node id space.
-
nodeLabels
java.util.List<org.neo4j.gds.NodeLabel> nodeLabels(long mappedNodeId)
-
forEachNodeLabel
void forEachNodeLabel(long mappedNodeId, IdMap.NodeLabelConsumer consumer)
-
availableNodeLabels
java.util.Set<org.neo4j.gds.NodeLabel> availableNodeLabels()
-
hasLabel
boolean hasLabel(long mappedNodeId, org.neo4j.gds.NodeLabel label)
-
addNodeLabel
void addNodeLabel(org.neo4j.gds.NodeLabel nodeLabel)
Adds new node label to the available node labels. The labels is not assigned to any nodes at this point.- Parameters:
nodeLabel
- the node label to add
-
addNodeIdToLabel
void addNodeIdToLabel(long nodeId, org.neo4j.gds.NodeLabel nodeLabel)
Assigns a node to the given node label.- Parameters:
nodeId
- the node id to assignnodeLabel
- the node label to which the node will be assigned to
-
rootIdMap
IdMap rootIdMap()
Returns the original node mapping if the current node mapping is filtered, otherwise it returns itself.
-
withFilteredLabels
default java.util.Optional<FilteredIdMap> withFilteredLabels(java.util.Collection<org.neo4j.gds.NodeLabel> nodeLabels, int concurrency)
-
-