Interface AdjacencyCompressor

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    DeltaVarLongCompressor, RawCompressor

    public interface AdjacencyCompressor
    extends java.lang.AutoCloseable
    • Method Detail

      • compress

        int compress​(long nodeId,
                     CompressedLongArray values,
                     LongArrayBuffer buffer)
        Compress a list of target ids into an adjacency list. The input values are an unsorted and separately compressed list of target ids. Those ids can be unpacked into a long[] using CompressedLongArray.uncompress(long[]). The provided long[] must be able to hold at least CompressedLongArray.length() elements. The input values might also store properties (called 'weights'). This can be checked with CompressedLongArray.hasWeights() and read with CompressedLongArray.weights(). The returned long[][] has the number of properties in the first dimension, followed by an uncompressed long[] 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 provided LongArrayBuffer to reuse existing allocations of a long[] or share newly created buffers with next invocations of this method. The buffer exists solely so that implementors can reduce allocations of long[]. It is not expected that the buffer contains any useful data after this method invocation. The provided values array will not be used after this method call and should be released at the end using CompressedLongArray.release(). 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 the AdjacencyCompressorBlueprint.build() method. The method only needs to return the degree of the compressed adjacency list. This value can be different from CompressedLongArray.length() 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.
        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.
        values - A list of target ids, unsorted and compressed.
        buffer - A long array that may or may not be used during the compression.
        Returns:
        the degree of the compressed adjacency list
      • close

        void close()
        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 interface java.lang.AutoCloseable