Class ClusterPopulationMapReduce
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.process.computer.util.StaticMapReduce<Serializable,Long,Serializable,Long,Map<Serializable,Long>>
- 
- org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.ClusterPopulationMapReduce
 
 
- 
- All Implemented Interfaces:
- Cloneable,- MapReduce<Serializable,Long,Serializable,Long,Map<Serializable,Long>>
 
 public class ClusterPopulationMapReduce extends StaticMapReduce<Serializable,Long,Serializable,Long,Map<Serializable,Long>> - Author:
- Marko A. Rodriguez (http://markorodriguez.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classClusterPopulationMapReduce.Builder- 
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.computer.MapReduceMapReduce.MapEmitter<K,V>, MapReduce.NullObject, MapReduce.ReduceEmitter<OK,OV>, MapReduce.Stage
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static StringCLUSTER_POPULATION_MEMORY_KEYstatic StringDEFAULT_MEMORY_KEY- 
Fields inherited from interface org.apache.tinkerpop.gremlin.process.computer.MapReduceMAP_REDUCE
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClusterPopulationMapReduce.Builderbuild()voidcombine(Serializable key, Iterator<Long> values, MapReduce.ReduceEmitter<Serializable,Long> emitter)The combine() method is logically executed at all "machines" in parallel.booleandoStage(MapReduce.Stage stage)A MapReduce job can be map-only, map-reduce-only, or map-combine-reduce.Map<Serializable,Long>generateFinalResult(Iterator<KeyValue<Serializable,Long>> keyValues)The key/value pairs emitted by reduce() (or map() in a map-only job) can be iterated to generate a local JVM Java object.StringgetMemoryKey()The results of the MapReduce job are associated with a memory-key to ultimately be stored inMemory.voidloadState(Graph graph, org.apache.commons.configuration2.Configuration configuration)When it is necessary to load the state of a MapReduce job, this method is called.voidmap(Vertex vertex, MapReduce.MapEmitter<Serializable,Long> emitter)The map() method is logically executed at all vertices in the graph in parallel.voidreduce(Serializable key, Iterator<Long> values, MapReduce.ReduceEmitter<Serializable,Long> emitter)The reduce() method is logically on the "machine" the respective key hashes to.voidstoreState(org.apache.commons.configuration2.Configuration configuration)When it is necessary to store the state of a MapReduce job, this method is called.StringtoString()- 
Methods inherited from class org.apache.tinkerpop.gremlin.process.computer.util.StaticMapReduceclone, equals, hashCode
 - 
Methods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.tinkerpop.gremlin.process.computer.MapReduceaddResultToMemory, getMapKeySort, getReduceKeySort, workerEnd, workerStart
 
- 
 
- 
- 
- 
Field Detail- 
CLUSTER_POPULATION_MEMORY_KEYpublic static final String CLUSTER_POPULATION_MEMORY_KEY - See Also:
- Constant Field Values
 
 - 
DEFAULT_MEMORY_KEYpublic static final String DEFAULT_MEMORY_KEY - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
storeStatepublic void storeState(org.apache.commons.configuration2.Configuration configuration) Description copied from interface:MapReduceWhen it is necessary to store the state of a MapReduce job, this method is called. This is typically required when the MapReduce job needs to be serialized to another machine. Note that what is stored is simply the instance state, not any processed data.- Specified by:
- storeStatein interface- MapReduce<Serializable,Long,Serializable,Long,Map<Serializable,Long>>
- Overrides:
- storeStatein class- StaticMapReduce<Serializable,Long,Serializable,Long,Map<Serializable,Long>>
- Parameters:
- configuration- the configuration to store the state of the MapReduce job in.
 
 - 
loadStatepublic void loadState(Graph graph, org.apache.commons.configuration2.Configuration configuration) Description copied from interface:MapReduceWhen it is necessary to load the state of a MapReduce job, this method is called. This is typically required when the MapReduce job needs to be serialized to another machine. Note that what is loaded is simply the instance state, not any processed data. It is important that the state loaded from loadState() is identical to any state created from a constructor. For those GraphComputers that do not need to use Configurations to migrate state between JVMs, the constructor will only be used.- Parameters:
- graph- the graph the MapReduce job will run against
- configuration- the configuration to load the state of the MapReduce job from.
 
 - 
doStagepublic boolean doStage(MapReduce.Stage stage) Description copied from interface:MapReduceA MapReduce job can be map-only, map-reduce-only, or map-combine-reduce. Before executing the particular stage, this method is called to determine if the respective stage is defined. This method should return true if the respective stage as a non-default method implementation.- Parameters:
- stage- the stage to check for definition.
- Returns:
- whether that stage should be executed.
 
 - 
mappublic void map(Vertex vertex, MapReduce.MapEmitter<Serializable,Long> emitter) Description copied from interface:MapReduceThe map() method is logically executed at all vertices in the graph in parallel. The map() method emits key/value pairs given some analysis of the data in the vertices (and/or its incident edges). AllMapReduceclasses must at least provide an implementation ofMapReduce#map(Vertex, MapEmitter).- Parameters:
- vertex- the current vertex being map() processed.
- emitter- the component that allows for key/value pairs to be emitted to the next stage.
 
 - 
combinepublic void combine(Serializable key, Iterator<Long> values, MapReduce.ReduceEmitter<Serializable,Long> emitter) Description copied from interface:MapReduceThe combine() method is logically executed at all "machines" in parallel. The combine() method pre-combines the values for a key prior to propagation over the wire. The combine() method must emit the same key/value pairs as the reduce() method. If there is a combine() implementation, there must be a reduce() implementation. If the MapReduce implementation is single machine, it can skip executing this method as reduce() is sufficient.- Parameters:
- key- the key that has aggregated values
- values- the aggregated values associated with the key
- emitter- the component that allows for key/value pairs to be emitted to the reduce stage.
 
 - 
reducepublic void reduce(Serializable key, Iterator<Long> values, MapReduce.ReduceEmitter<Serializable,Long> emitter) Description copied from interface:MapReduceThe reduce() method is logically on the "machine" the respective key hashes to. The reduce() method combines all the values associated with the key and emits key/value pairs.- Parameters:
- key- the key that has aggregated values
- values- the aggregated values associated with the key
- emitter- the component that allows for key/value pairs to be emitted as the final result.
 
 - 
generateFinalResultpublic Map<Serializable,Long> generateFinalResult(Iterator<KeyValue<Serializable,Long>> keyValues) Description copied from interface:MapReduceThe key/value pairs emitted by reduce() (or map() in a map-only job) can be iterated to generate a local JVM Java object.- Parameters:
- keyValues- the key/value pairs that were emitted from reduce() (or map() in a map-only job)
- Returns:
- the resultant object formed from the emitted key/values.
 
 - 
getMemoryKeypublic String getMemoryKey() Description copied from interface:MapReduceThe results of the MapReduce job are associated with a memory-key to ultimately be stored inMemory.- Returns:
- the memory key of the generated result object.
 
 - 
toStringpublic String toString() - Overrides:
- toStringin class- StaticMapReduce<Serializable,Long,Serializable,Long,Map<Serializable,Long>>
 
 - 
buildpublic static ClusterPopulationMapReduce.Builder build() 
 
- 
 
-