|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.nfgraph.NFGraph
public abstract class NFGraph
NFGraph represents a directed graph and is the base class for the two flavors of NetflixGraph
(NFBuildGraph and NFCompressedGraph). It defines the operations for retrieving connections
in the graph, given some node and property.
OrdinalMap for each type to create and maintain a mapping between objects
and their ordinals. The OrdinalMap has been optimized with this use case in mind.
Use of the NFGraph is expected to generally follow some lifecycle:
NFGraphSpec, which serves as the schema for the graph data.NFBuildGraph, then populate it with connections.NFBuildGraph, which will return a representation of the data as an NFCompressedGraph.NFCompressedGraph to a stream. Netflix, for example, has a use case which streams this graph to Amazon Web Service's S3.
NFGraphSpec spec = new NFGraphSpec( ... );
NFBuildGraph buildGraph = new NFBuildGraph(spec);
for( ... each connection between nodes ... ) {
graph.addConnection( ... );
}
NFCompressedGraph compressedGraph = buildGraph.compress();
OutputStream os = ... stream to where you want the serialized data ...;
compressedGraph.writeTo(os);
And your consumer code will resemble:
InputStream is = ... stream from where the serialized data was written ...;
NFGraph graph = NFCompressedGraph.readFrom(is);
NFGraphSpec,
NFBuildGraph,
NFCompressedGraph| Field Summary | |
|---|---|
protected NFGraphSpec |
graphSpec
|
protected com.netflix.nfgraph.NFGraphModelHolder |
modelHolder
|
| Constructor Summary | |
|---|---|
protected |
NFGraph(NFGraphSpec graphSpec)
|
protected |
NFGraph(NFGraphSpec graphSpec,
com.netflix.nfgraph.NFGraphModelHolder modelHolder)
|
| Method Summary | |
|---|---|
protected abstract int |
getConnection(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
|
int |
getConnection(java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
Retrieve a single connected ordinal, given the type and ordinal of the originating node, and the property by which this node is connected. |
int |
getConnection(java.lang.String connectionModel,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
Retrieve a single connected ordinal in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected. |
protected abstract OrdinalIterator |
getConnectionIterator(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
|
OrdinalIterator |
getConnectionIterator(java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
Retrieve an OrdinalIterator over all connected ordinals, given the type and ordinal of the originating node, and the property by which this node is connected. |
OrdinalIterator |
getConnectionIterator(java.lang.String connectionModel,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
Retrieve an OrdinalIterator over all connected ordinals in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected. |
protected abstract OrdinalSet |
getConnectionSet(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
|
OrdinalSet |
getConnectionSet(java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
Retrieve an OrdinalSet over all connected ordinals, given the type and ordinal of the originating node, and the property by which this node is connected. |
OrdinalSet |
getConnectionSet(java.lang.String connectionModel,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
Retrieve an OrdinalSet over all connected ordinals in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final NFGraphSpec graphSpec
protected final com.netflix.nfgraph.NFGraphModelHolder modelHolder
| Constructor Detail |
|---|
protected NFGraph(NFGraphSpec graphSpec)
protected NFGraph(NFGraphSpec graphSpec,
com.netflix.nfgraph.NFGraphModelHolder modelHolder)
| Method Detail |
|---|
public int getConnection(java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
public int getConnection(java.lang.String connectionModel,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
public OrdinalIterator getConnectionIterator(java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
OrdinalIterator over all connected ordinals, given the type and ordinal of the originating node, and the property by which this node is connected.
OrdinalIterator over all connected ordinals
public OrdinalIterator getConnectionIterator(java.lang.String connectionModel,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
OrdinalIterator over all connected ordinals in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected.
OrdinalIterator over all connected ordinals
public OrdinalSet getConnectionSet(java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
OrdinalSet over all connected ordinals, given the type and ordinal of the originating node, and the property by which this node is connected.
OrdinalSet over all connected ordinals
public OrdinalSet getConnectionSet(java.lang.String connectionModel,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
OrdinalSet over all connected ordinals in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected.
OrdinalSet over all connected ordinals
protected abstract int getConnection(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
protected abstract OrdinalSet getConnectionSet(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
protected abstract OrdinalIterator getConnectionIterator(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||