Interface GraphComputer
-
public interface GraphComputer
TheGraphComputer
is responsible for the execution of aVertexProgram
and then a set ofMapReduce
jobs over the vertices in theGraph
. It is up to theGraphComputer
implementation to determine the appropriate memory structures given the computing substrate.- Author:
- Marko A. Rodriguez (http://markorodriguez.com), Matthias Broecheler (me@matthiasb.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
GraphComputer.Exceptions
static interface
GraphComputer.Features
static class
GraphComputer.Persist
static class
GraphComputer.ResultGraph
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default GraphComputer
configure(String key, Object value)
Set an arbitrary configuration key/value for the underlyingConfiguration
in theGraphComputer
.GraphComputer
edges(Traversal<Vertex,Edge> edgeFilter)
Add a filter that will limit which edges of the vertices are loaded from the graph source.default GraphComputer.Features
features()
GraphComputer
mapReduce(MapReduce mapReduce)
Add aMapReduce
job to the set of MapReduce jobs to be executed by theGraphComputer
.GraphComputer
persist(GraphComputer.Persist persist)
Set theGraphComputer.Persist
level of the computation.GraphComputer
program(VertexProgram vertexProgram)
Set theVertexProgram
to be executed by theGraphComputer
.GraphComputer
result(GraphComputer.ResultGraph resultGraph)
Set theGraphComputer.ResultGraph
of the computation.Future<ComputerResult>
submit()
GraphComputer
vertices(Traversal<Vertex,Vertex> vertexFilter)
Add a filter that will limit which vertices are loaded from the graph source.GraphComputer
workers(int workers)
Set the desired number of workers to execute theVertexProgram
andMapReduce
jobs.
-
-
-
Method Detail
-
result
GraphComputer result(GraphComputer.ResultGraph resultGraph)
Set theGraphComputer.ResultGraph
of the computation. If this is not set explicitly by the user, then theVertexProgram
can choose the most efficient result for its intended use. If there is no declared vertex program, then theGraphComputer
defaults toGraphComputer.ResultGraph.ORIGINAL
.- Parameters:
resultGraph
- the type of graph to be returned byComputerResult.graph()
- Returns:
- the updated GraphComputer with newly set result graph
-
persist
GraphComputer persist(GraphComputer.Persist persist)
Set theGraphComputer.Persist
level of the computation. If this is not set explicitly by the user, then the\VertexProgram
can choose the most efficient persist for the its intended use. If there is no declared vertex program, then theGraphComputer
defaults toGraphComputer.Persist.NOTHING
.- Parameters:
persist
- the persistence level of the resultant computation- Returns:
- the updated GraphComputer with newly set persist
-
program
GraphComputer program(VertexProgram vertexProgram)
Set theVertexProgram
to be executed by theGraphComputer
. There can only be one VertexProgram for the GraphComputer.- Parameters:
vertexProgram
- the VertexProgram to be executed- Returns:
- the updated GraphComputer with newly set VertexProgram
-
mapReduce
GraphComputer mapReduce(MapReduce mapReduce)
Add aMapReduce
job to the set of MapReduce jobs to be executed by theGraphComputer
. There can be any number of MapReduce jobs.- Parameters:
mapReduce
- the MapReduce job to add to the computation- Returns:
- the updated GraphComputer with newly added MapReduce job
-
workers
GraphComputer workers(int workers)
Set the desired number of workers to execute theVertexProgram
andMapReduce
jobs. This is a recommendation to the underlyingGraphComputer
implementation and is allowed to deviate accordingly by the implementation.- Parameters:
workers
- the number of workers to execute the submission- Returns:
- the updated GraphComputer with newly set worker count
-
vertices
GraphComputer vertices(Traversal<Vertex,Vertex> vertexFilter) throws IllegalArgumentException
Add a filter that will limit which vertices are loaded from the graph source. The providedTraversal
can only check the vertex, its vertex properties, and the vertex property properties. The loaded graph will only have those vertices that pass through the provided filter.- Parameters:
vertexFilter
- the traversal to verify whether or not to load the current vertex- Returns:
- the updated GraphComputer with newly set vertex filter
- Throws:
IllegalArgumentException
- if the provided traversal attempts to access vertex edges
-
edges
GraphComputer edges(Traversal<Vertex,Edge> edgeFilter) throws IllegalArgumentException
Add a filter that will limit which edges of the vertices are loaded from the graph source. The providedTraversal
can only check the local star graph of the vertex and thus, can not access properties/labels of the adjacent vertices. The vertices of the loaded graph will only have those edges that pass through the provided filter.- Parameters:
edgeFilter
- the traversal that determines which edges are loaded for each vertex- Returns:
- the updated GraphComputer with newly set edge filter
- Throws:
IllegalArgumentException
- if the provided traversal attempts to access adjacent vertices
-
configure
default GraphComputer configure(String key, Object value)
Set an arbitrary configuration key/value for the underlyingConfiguration
in theGraphComputer
. Typically, the other fluent methods inGraphComputer
should be used to configure the computation. However, for some custom configuration in the underlying engine, this method should be used. Different GraphComputer implementations will have different key/values and thus, parameters placed here are generally not universal to all GraphComputer implementations. The default implementation simply does nothing and returns theGraphComputer
unchanged.- Parameters:
key
- the key of the configurationvalue
- the value of the configuration- Returns:
- the updated GraphComputer with newly set key/value configuration
-
submit
Future<ComputerResult> submit()
- Returns:
- a
Future
denoting a reference to the asynchronous computation and where to get theDefaultComputerResult
when its is complete.
-
features
default GraphComputer.Features features()
-
-