Package org.neo4j.gds.core.loading
Class FilteredLabeledIdMap
- java.lang.Object
-
- org.neo4j.gds.api.LabeledIdMap
-
- org.neo4j.gds.core.loading.FilteredLabeledIdMap
-
- All Implemented Interfaces:
BatchNodeIterable
,FilteredIdMap
,IdMap
,NodeIterator
,PartialIdMap
public class FilteredLabeledIdMap extends LabeledIdMap implements FilteredIdMap
-
-
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 class org.neo4j.gds.api.LabeledIdMap
labelInformation
-
Fields inherited from interface org.neo4j.gds.api.IdMap
NOT_FOUND, START_NODE_ID
-
-
Constructor Summary
Constructors Constructor Description FilteredLabeledIdMap(IdMap originalToRootIdMap, LabeledIdMap rootToFilteredIdMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNodeIdToLabel(long filteredNodeId, 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.boolean
contains(long originalNodeId)
Returns true iff the Neo4j id is mapped, otherwise false.boolean
containsRootNodeId(long rootNodeId)
Checks if the rootNodeId (mappedNodeId) is present in the IdMaps mapping information.void
forEachNodeLabel(long filteredNodeId, IdMap.NodeLabelConsumer consumer)
boolean
hasLabel(long filteredNodeId, org.neo4j.gds.NodeLabel label)
long
highestOriginalId()
The highest id that is mapped in this id mapping.java.util.List<org.neo4j.gds.NodeLabel>
nodeLabels(long filteredNodeId)
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
toFilteredNodeId(long rootNodeId)
Maps a root mapped node id to a filtered mapped node id.long
toMappedNodeId(long originalNodeId)
Maps an original node id to a mapped node id.long
toOriginalNodeId(long filteredNodeId)
Returns the original node id for the given mapped node id.long
toRootNodeId(long filteredNodeId)
Maps a filtered mapped node id to its root mapped node id.-
Methods inherited from class org.neo4j.gds.api.LabeledIdMap
availableNodeLabels, batchIterables, forEachNode, labelInformation, nodeCount, nodeCount, nodeIterator, nodeIterator
-
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.BatchNodeIterable
batchIterables
-
Methods inherited from interface org.neo4j.gds.api.IdMap
availableNodeLabels, nodeCount, nodeCount, safeToMappedNodeId, withFilteredLabels
-
Methods inherited from interface org.neo4j.gds.api.NodeIterator
forEachNode, nodeIterator, nodeIterator
-
-
-
-
Constructor Detail
-
FilteredLabeledIdMap
public FilteredLabeledIdMap(IdMap originalToRootIdMap, LabeledIdMap rootToFilteredIdMap)
-
-
Method Detail
-
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
-
toRootNodeId
public long toRootNodeId(long filteredNodeId)
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
-
toFilteredNodeId
public long toFilteredNodeId(long rootNodeId)
Description copied from interface:FilteredIdMap
Maps a root mapped node id to a filtered mapped node id. This is necessary for nested (filtered) id mappings. If this mapping is a nested mapping, this method returns the mapped id corresponding to the mapped id of the parent mapping. For the root mapping this method returns the given node id.- Specified by:
toFilteredNodeId
in interfaceFilteredIdMap
-
toOriginalNodeId
public long toOriginalNodeId(long filteredNodeId)
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
-
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()
-
contains
public boolean contains(long originalNodeId)
Description copied from interface:IdMap
Returns true iff the Neo4j id is mapped, otherwise false.
-
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
-
containsRootNodeId
public boolean containsRootNodeId(long rootNodeId)
Description copied from interface:FilteredIdMap
Checks if the rootNodeId (mappedNodeId) is present in the IdMaps mapping information.- Specified by:
containsRootNodeId
in interfaceFilteredIdMap
-
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.
-
nodeLabels
public java.util.List<org.neo4j.gds.NodeLabel> nodeLabels(long filteredNodeId)
- Specified by:
nodeLabels
in interfaceIdMap
- Overrides:
nodeLabels
in classLabeledIdMap
-
forEachNodeLabel
public void forEachNodeLabel(long filteredNodeId, IdMap.NodeLabelConsumer consumer)
- Specified by:
forEachNodeLabel
in interfaceIdMap
- Overrides:
forEachNodeLabel
in classLabeledIdMap
-
hasLabel
public boolean hasLabel(long filteredNodeId, org.neo4j.gds.NodeLabel label)
- Specified by:
hasLabel
in interfaceIdMap
- Overrides:
hasLabel
in classLabeledIdMap
-
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
- Overrides:
addNodeLabel
in classLabeledIdMap
- Parameters:
nodeLabel
- the node label to add
-
addNodeIdToLabel
public final void addNodeIdToLabel(long filteredNodeId, org.neo4j.gds.NodeLabel nodeLabel)
Description copied from interface:IdMap
Assigns a node to the given node label.- Specified by:
addNodeIdToLabel
in interfaceIdMap
- Overrides:
addNodeIdToLabel
in classLabeledIdMap
- Parameters:
filteredNodeId
- the node id to assignnodeLabel
- the node label to which the node will be assigned to
-
-