use of com.baidu.hugegraph.computer.core.allocator.Allocator in project hugegraph-computer by hugegraph.
the class ComputerContextUtil method initContext.
public static Config initContext(Map<String, String> params) {
// Set algorithm's parameters
String algorithmParamsName = params.get(ComputerOptions.ALGORITHM_PARAMS_CLASS.name());
AlgorithmParams algorithmParams;
try {
algorithmParams = (AlgorithmParams) Class.forName(algorithmParamsName).newInstance();
} catch (Exception e) {
throw new ComputerException("Can't create algorithmParams, " + "algorithmParamsName = {}", algorithmParamsName);
}
algorithmParams.setAlgorithmParameters(params);
Config config = new DefaultConfig(params);
GraphFactory graphFactory = new BuiltinGraphFactory();
Allocator allocator = new DefaultAllocator(config, graphFactory);
ComputerContext.initContext(config, graphFactory, allocator);
return config;
}
Aggregations