org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank

## Class PageRankMapReduce

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.computer.util.StaticMapReduce<Object,Double,Object,Double,Iterator<KeyValue<Object,Double>>>
  - - org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankMapReduce

- All Implemented Interfaces:
    Cloneable, MapReduce<Object,Double,Object,Double,Iterator<KeyValue<Object,Double>>>

      public class PageRankMapReduce
      extends StaticMapReduce<Object,Double,Object,Double,Iterator<KeyValue<Object,Double>>>

  Author:
    Marko A. Rodriguez (http://markorodriguez.com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PageRankMapReduce.Builder`

    - ### Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.computer.MapReduce

      `MapReduce.MapEmitter<K,V>, MapReduce.NullObject, MapReduce.ReduceEmitter<OK,OV>, MapReduce.Stage`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_MEMORY_KEY`
    `static String` | `PAGE_RANK_MEMORY_KEY`

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.process.computer.MapReduce

      `MAP_REDUCE`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PageRankMapReduce.Builder` | `build()`
    `boolean` | `doStage(MapReduce.Stage stage)` A MapReduce job can be map-only, map-reduce-only, or map-combine-reduce.
    `Iterator<KeyValue<Object,Double>>` | `generateFinalResult(Iterator<KeyValue<Object,Double>> 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.
    `String` | `getMemoryKey()` The results of the MapReduce job are associated with a memory-key to ultimately be stored in `Memory`.
    `void` | `loadState(Graph graph, Configuration configuration)` When it is necessary to load the state of a MapReduce job, this method is called.
    `void` | `map(Vertex vertex, MapReduce.MapEmitter<Object,Double> emitter)` The map() method is logically executed at all vertices in the graph in parallel.
    `void` | `storeState(Configuration configuration)` When it is necessary to store the state of a MapReduce job, this method is called.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.process.computer.util.StaticMapReduce

      `clone, equals, hashCode`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.computer.MapReduce

      `addResultToMemory, combine, createMapReduce, getMapKeySort, getReduceKeySort, reduce, workerEnd, workerStart`

- - ### Field Detail

    - #### PAGE_RANK_MEMORY_KEY

          public static final String PAGE_RANK_MEMORY_KEY

      See Also:
        Constant Field Values

    - #### DEFAULT_MEMORY_KEY

          public static final String DEFAULT_MEMORY_KEY

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### storeState

          public void storeState(Configuration configuration)

      Description copied from interface: `MapReduce`
      When 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:
        `storeState` in interface `MapReduce<Object,Double,Object,Double,Iterator<KeyValue<Object,Double>>>`
      Overrides:
        `storeState` in class `StaticMapReduce<Object,Double,Object,Double,Iterator<KeyValue<Object,Double>>>`
      Parameters:
        `configuration` - the configuration to store the state of the MapReduce job in.

    - #### loadState

          public void loadState(Graph graph,
                                Configuration configuration)

      Description copied from interface: `MapReduce`
      When 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.

    - #### doStage

          public boolean doStage(MapReduce.Stage stage)

      Description copied from interface: `MapReduce`
      A 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.

    - #### map

          public void map(Vertex vertex,
                          MapReduce.MapEmitter<Object,Double> emitter)

      Description copied from interface: `MapReduce`
      The 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). All `MapReduce` classes must at least provide an implementation of `MapReduce#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.

    - #### generateFinalResult

          public Iterator<KeyValue<Object,Double>> generateFinalResult(Iterator<KeyValue<Object,Double>> keyValues)

      Description copied from interface: `MapReduce`
      The 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.

    - #### getMemoryKey

          public String getMemoryKey()

      Description copied from interface: `MapReduce`
      The results of the MapReduce job are associated with a memory-key to ultimately be stored in `Memory`.
      Returns:
        the memory key of the generated result object.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `StaticMapReduce<Object,Double,Object,Double,Iterator<KeyValue<Object,Double>>>`

    - #### build

          public static PageRankMapReduce.Builder build()

Copyright © 2013–2018 Apache Software Foundation. All rights reserved.