com.netflix.nfgraph.compressed
Class NFCompressedGraph

java.lang.Object
  extended by com.netflix.nfgraph.NFGraph
      extended by com.netflix.nfgraph.compressed.NFCompressedGraph

public class NFCompressedGraph
extends NFGraph

A read-only, memory-efficient implementation of an NFGraph. The connections for all nodes in the graph are encoded into a single byte array. The encoding for each set will be specified as either a CompactOrdinalSet or HashSetOrdinalSet. If it is more efficient, the actual encoding will be a BitSetOrdinalSet.

The offsets into the byte array where connections for each node are encoded are held in the NFCompressedGraphPointers.


Field Summary
 
Fields inherited from class com.netflix.nfgraph.NFGraph
graphSpec, modelHolder
 
Constructor Summary
NFCompressedGraph(NFGraphSpec spec, com.netflix.nfgraph.NFGraphModelHolder modelHolder, byte[] data, com.netflix.nfgraph.compressed.NFCompressedGraphPointers pointers)
           
 
Method Summary
protected  int getConnection(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
           
protected  OrdinalIterator getConnectionIterator(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
           
protected  OrdinalSet getConnectionSet(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
           
static NFCompressedGraph readFrom(java.io.InputStream is)
           
 void writeTo(java.io.OutputStream os)
           
 
Methods inherited from class com.netflix.nfgraph.NFGraph
getConnection, getConnection, getConnectionIterator, getConnectionIterator, getConnectionSet, getConnectionSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NFCompressedGraph

public NFCompressedGraph(NFGraphSpec spec,
                         com.netflix.nfgraph.NFGraphModelHolder modelHolder,
                         byte[] data,
                         com.netflix.nfgraph.compressed.NFCompressedGraphPointers pointers)
Method Detail

getConnection

protected int getConnection(int connectionModelIndex,
                            java.lang.String nodeType,
                            int ordinal,
                            java.lang.String propertyName)
Specified by:
getConnection in class NFGraph

getConnectionSet

protected OrdinalSet getConnectionSet(int connectionModelIndex,
                                      java.lang.String nodeType,
                                      int ordinal,
                                      java.lang.String propertyName)
Specified by:
getConnectionSet in class NFGraph

getConnectionIterator

protected OrdinalIterator getConnectionIterator(int connectionModelIndex,
                                                java.lang.String nodeType,
                                                int ordinal,
                                                java.lang.String propertyName)
Specified by:
getConnectionIterator in class NFGraph

writeTo

public void writeTo(java.io.OutputStream os)
             throws java.io.IOException
Throws:
java.io.IOException

readFrom

public static NFCompressedGraph readFrom(java.io.InputStream is)
                                  throws java.io.IOException
Throws:
java.io.IOException