public static <M extends MapReduce> M createMapReduce(final Graph graph, final Configuration configuration) {
        try {
            final Class<M> mapReduceClass = (Class) Class.forName(configuration.getString(MAP_REDUCE));
            final Constructor<M> constructor = mapReduceClass.getDeclaredConstructor();
            constructor.setAccessible(true);
            final M mapReduce = constructor.newInstance();
            mapReduce.loadState(graph, configuration);
            return mapReduce;
        } catch (final Exception e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
A helper method to construct a {@link MapReduce} given the content of the supplied configuration.
The class of the MapReduce is read from the {@link MapReduce#MAP_REDUCE} static configuration key.
Once the MapReduce is constructed, {@link MapReduce#loadState} method is called with the provided configuration.

@param graph         The graph that the MapReduce job will run against
@param configuration A configuration with requisite information to build a MapReduce
@return the newly constructed MapReduce
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/MapReduce.java