Package org.neo4j.gds.core.loading
Class RawCompressor
- java.lang.Object
-
- org.neo4j.gds.core.loading.RawCompressor
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,AdjacencyCompressor
public final class RawCompressor extends java.lang.Object implements AdjacencyCompressor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.neo4j.gds.core.compress.AdjacencyCompressor
AdjacencyCompressor.ValueMapper
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closing this compressor will release some internal data structures, making them eligible for garbage collection.int
compress(long nodeId, byte[] targets, long[][] properties, int numberOfCompressedTargets, int compressedBytesSize, LongArrayBuffer buffer, AdjacencyCompressor.ValueMapper mapper)
Compress a list of target ids into an adjacency list.static AdjacencyCompressorFactory
factory(java.util.function.LongSupplier nodeCountSupplier, AdjacencyListBuilderFactory<long[],? extends AdjacencyList,long[],? extends AdjacencyProperties> adjacencyListBuilderFactory, org.neo4j.gds.PropertyMappings propertyMappings, org.neo4j.gds.core.Aggregation[] aggregations, boolean noAggregation)
-
-
-
Method Detail
-
factory
public static AdjacencyCompressorFactory factory(java.util.function.LongSupplier nodeCountSupplier, AdjacencyListBuilderFactory<long[],? extends AdjacencyList,long[],? extends AdjacencyProperties> adjacencyListBuilderFactory, org.neo4j.gds.PropertyMappings propertyMappings, org.neo4j.gds.core.Aggregation[] aggregations, boolean noAggregation)
-
compress
public int compress(long nodeId, byte[] targets, long[][] properties, int numberOfCompressedTargets, int compressedBytesSize, LongArrayBuffer buffer, AdjacencyCompressor.ValueMapper mapper)
Description copied from interface:AdjacencyCompressor
Compress a list of target ids into an adjacency list. The inputvalues
are an unsorted and separately compressed list of target ids. The providedlong[]
must be able to hold at leastnumberOfCompressedTargets
elements. The inputvalues
might also store properties. Theproperties
has the number of properties in the first dimension, followed by an uncompressedlong[]
for each property. Those values belong to the target id that is stored at the same array index in the uncompressed target list. Implementors need to make sure to maintain that order when re-ordering the target ids. Implementors of this method can use the providedLongArrayBuffer
to reuse existing allocations of along[]
or share newly created buffers with next invocations of this method. The buffer exists solely so that implementors can reduce allocations oflong[]
. It is not expected that the buffer contains any useful data after this method invocation. The providedtargets
array will not be used after this method call. Implementors will need to write the resulting target list somewhere. Where exactly is up to the implementation. The results should end up in the data that is returned by theAdjacencyCompressorFactory.build()
method. The method only needs to return the degree of the compressed adjacency list. This value can be different fromnumberOfCompressedTargets
due to possible deduplication, though it should never be larger. The return value is only used for tracking progress and reporting, it is not stored in the graph. How the degree is stored so that it can be used by the Graph is up the implementor of this method.- Specified by:
compress
in interfaceAdjacencyCompressor
- Parameters:
nodeId
- The node id that is the source node for this adjacency list. The id is from the GDS internal scope, it is *not* the Neo4j ID.targets
- A list of target ids, unsorted and compressed.properties
- A nested list of property values.numberOfCompressedTargets
- The number of targets compressed in `targets`.compressedBytesSize
- The byte size of targets.buffer
- A long array that may or may not be used during the compression.mapper
- A mapper to transform values before compressing them.- Returns:
- the degree of the compressed adjacency list
-
close
public void close()
Description copied from interface:AdjacencyCompressor
Closing this compressor will release some internal data structures, making them eligible for garbage collection. The compressor cannot be used after it has been closed.- Specified by:
close
in interfaceAdjacencyCompressor
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-