本文整理汇总了Java中org.apache.giraph.aggregators.LongSumAggregator类的典型用法代码示例。如果您正苦于以下问题:Java LongSumAggregator类的具体用法?Java LongSumAggregator怎么用?Java LongSumAggregator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongSumAggregator类属于org.apache.giraph.aggregators包,在下文中一共展示了LongSumAggregator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerPersistentAggregator(
INPUT_VERTEX_PERSISTENT_AGG, LongSumAggregator.class);
registerPersistentAggregator(
INPUT_EDGE_PERSISTENT_AGG, LongSumAggregator.class);
registerAggregator(REGULAR_AGG, LongSumAggregator.class);
registerPersistentAggregator(PERSISTENT_AGG,
LongSumAggregator.class);
registerAggregator(MASTER_WRITE_AGG, LongSumAggregator.class);
for (int i = 0; i < NUM_OF_AGGREGATORS_IN_ARRAY; i++) {
registerAggregator(ARRAY_PREFIX_AGG + i, LongSumAggregator.class);
}
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:17,代码来源:AggregatorsTestComputation.java
示例2: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
/**
* Creates capacity and demand aggregators for each partition.
*
* @throws IllegalAccessException
* @throws InstantiationException
*/
@Override
public void initialize() throws IllegalAccessException,
InstantiationException {
int k = getConf().getInt(ARPComputation.NUMBER_OF_PARTITIONS,
ARPComputation.DEFAULT_NUMBER_OF_PARTITIONS);
for (int i = 0; i < k; i++) {
registerAggregator(ARPComputation.DEMAND_AGGREGATOR_PREFIX + i, LongSumAggregator
.class);
registerPersistentAggregator(ARPComputation.CAPACITY_AGGREGATOR_PREFIX + i, LongSumAggregator.class);
}
}
开发者ID:dbs-leipzig,项目名称:giraph-algorithms,代码行数:18,代码来源:ARPMasterComputation.java
示例3: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException, IllegalAccessException {
this.registerAggregator(LouvainComputation.CHANGE_AGG, LongSumAggregator.class);
this.registerPersistentAggregator(LouvainComputation.TOTAL_EDGE_WEIGHT_AGG, LongSumAggregator.class);
this.registerPersistentAggregator(LouvainComputation.ACTUAL_Q_AGG, DoubleSumAggregator.class);
DGALoggingUtil.setDGALogLevel(this.getConf());
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:8,代码来源:LouvainMasterCompute.java
示例4: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException, IllegalAccessException {
this.registerAggregator(LouvainVertex.CHANGE_AGG, LongSumAggregator.class);
this.registerPersistentAggregator(LouvainVertex.TOTAL_EDGE_WEIGHT_AGG, LongSumAggregator.class);
//for (int i =0; i < LouvainVertex.getNumQAggregators(getConf()); i++){
this.registerPersistentAggregator(LouvainVertex.ACTUAL_Q_AGG, DoubleSumAggregator.class);
//}
}
开发者ID:Sotera,项目名称:distributed-louvain-modularity,代码行数:10,代码来源:LouvainMasterCompute.java
示例5: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerAggregator(RandomWalkComputation.NUM_DANGLING_VERTICES,
LongSumAggregator.class);
registerAggregator(RandomWalkComputation.CUMULATIVE_DANGLING_PROBABILITY,
DoubleSumAggregator.class);
registerAggregator(RandomWalkComputation.CUMULATIVE_PROBABILITY,
DoubleSumAggregator.class);
registerAggregator(RandomWalkComputation.L1_NORM_OF_PROBABILITY_DIFFERENCE,
DoubleSumAggregator.class);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:13,代码来源:RandomWalkVertexMasterCompute.java
示例6: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerAggregator(SUM_AGG, LongSumAggregator.class);
registerPersistentAggregator(MIN_AGG, DoubleMinAggregator.class);
registerPersistentAggregator(MAX_AGG, DoubleMaxAggregator.class);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:8,代码来源:SimplePageRankComputation.java
示例7: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
int n = getNumAggregators(getConf());
for (int i = 0; i < n; i++) {
registerAggregator("w" + i, LongSumAggregator.class);
registerAggregator("m" + i, LongSumAggregator.class);
registerPersistentAggregator("p" + i, LongSumAggregator.class);
}
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:11,代码来源:AggregatorsBenchmark.java
示例8: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerAggregator(AGG_SUPERSTEP_TOTAL_BYTES,
LongSumAggregator.class);
registerAggregator(AGG_SUPERSTEP_TOTAL_MESSAGES,
LongSumAggregator.class);
registerAggregator(AGG_SUPERSTEP_TOTAL_MILLIS,
LongSumAggregator.class);
registerAggregator(WORKERS_NUM,
LongSumAggregator.class);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:13,代码来源:RandomMessageBenchmark.java
示例9: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException, IllegalAccessException {
r = new Random();
registerPersistentAggregator(Constants.MIN, MinimumPointWritableAggregator.class);
registerPersistentAggregator(Constants.MAX, MaximumPointWritableAggregator.class);
registerAggregator(Constants.UPDATES, LongSumAggregator.class);
k = getConf().getInt(Constants.K, 0);
for(int i = 0; i < k; i++) {
registerAggregator(Constants.POINT_PREFIX + i, AveragePointWritableAggregator.class);
}
}
开发者ID:paulmw,项目名称:giraph-examples,代码行数:13,代码来源:MasterCompute.java
示例10: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerAggregator(RandomWalkVertex.NUM_DANGLING_VERTICES,
LongSumAggregator.class);
registerAggregator(RandomWalkVertex.CUMULATIVE_DANGLING_PROBABILITY,
DoubleSumAggregator.class);
registerAggregator(RandomWalkVertex.CUMULATIVE_PROBABILITY,
DoubleSumAggregator.class);
registerAggregator(RandomWalkVertex.L1_NORM_OF_PROBABILITY_DIFFERENCE,
DoubleSumAggregator.class);
}
开发者ID:zfighter,项目名称:giraph-research,代码行数:13,代码来源:RandomWalkVertexMasterCompute.java
示例11: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerAggregator(REGULAR_AGG, LongSumAggregator.class);
registerPersistentAggregator(PERSISTENT_AGG,
LongSumAggregator.class);
registerAggregator(MASTER_WRITE_AGG, LongSumAggregator.class);
for (int i = 0; i < NUM_OF_AGGREGATORS_IN_ARRAY; i++) {
registerAggregator(ARRAY_PREFIX_AGG + i, LongSumAggregator.class);
}
}
开发者ID:zfighter,项目名称:giraph-research,代码行数:13,代码来源:AggregatorsTestVertex.java
示例12: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
LOG.info("Registering aggregator: zombe.count");
registerAggregator("zombe.count", LongSumAggregator.class);
}
开发者ID:amitchmca,项目名称:hadooparchitecturebook,代码行数:7,代码来源:ZombieMasterCompute.java
示例13: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException, IllegalAccessException {
registerPersistentAggregator(PageRankVertex.VERTEX_COUNT_AGG, LongSumAggregator.class);
//registerAggregator(PageRankVertex.VERTEX_VOTE,LongSumAggregator.class);
registerAggregator(PageRankVertex.MAX_EPSILON,DoubleMaxAggregator.class);
}
开发者ID:Sotera,项目名称:page-rank,代码行数:7,代码来源:PRMasterCompute.java
示例14: compute
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void compute(
Vertex<LongWritable, IntWritable, FloatWritable> vertex,
Iterable<FloatWritable> messages) throws IOException {
SimpleCheckpointVertexWorkerContext workerContext = getWorkerContext();
boolean enableFault = workerContext.getEnableFault();
int supersteps = workerContext.getSupersteps();
if (enableFault && (getSuperstep() == FAULTING_SUPERSTEP) &&
(getContext().getTaskAttemptID().getId() == 0) &&
(vertex.getId().get() == FAULTING_VERTEX_ID)) {
LOG.info("compute: Forced a fault on the first " +
"attempt of superstep " +
FAULTING_SUPERSTEP + " and vertex id " +
FAULTING_VERTEX_ID);
System.exit(-1);
}
if (getSuperstep() > supersteps) {
vertex.voteToHalt();
return;
}
long sumAgg = this.<LongWritable>getAggregatedValue(
LongSumAggregator.class.getName()).get();
LOG.info("compute: " + sumAgg);
aggregate(LongSumAggregator.class.getName(),
new LongWritable(vertex.getId().get()));
LOG.info("compute: sum = " + sumAgg +
" for vertex " + vertex.getId());
float msgValue = 0.0f;
for (FloatWritable message : messages) {
float curMsgValue = message.get();
msgValue += curMsgValue;
LOG.info("compute: got msgValue = " + curMsgValue +
" for vertex " + vertex.getId() +
" on superstep " + getSuperstep());
}
int vertexValue = vertex.getValue().get();
vertex.setValue(new IntWritable(vertexValue + (int) msgValue));
LOG.info("compute: vertex " + vertex.getId() +
" has value " + vertex.getValue() +
" on superstep " + getSuperstep());
for (Edge<LongWritable, FloatWritable> edge : vertex.getEdges()) {
FloatWritable newEdgeValue = new FloatWritable(edge.getValue().get() +
(float) vertexValue);
Edge<LongWritable, FloatWritable> newEdge =
EdgeFactory.create(edge.getTargetVertexId(), newEdgeValue);
LOG.info("compute: vertex " + vertex.getId() +
" sending edgeValue " + edge.getValue() +
" vertexValue " + vertexValue +
" total " + newEdgeValue +
" to vertex " + edge.getTargetVertexId() +
" on superstep " + getSuperstep());
vertex.addEdge(newEdge);
sendMessage(edge.getTargetVertexId(), newEdgeValue);
}
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:58,代码来源:SimpleCheckpoint.java
示例15: postApplication
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void postApplication() {
setFinalSum(this.<LongWritable>getAggregatedValue(
LongSumAggregator.class.getName()).get());
LOG.info("FINAL_SUM=" + FINAL_SUM);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:7,代码来源:SimpleCheckpoint.java
示例16: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerAggregator(LongSumAggregator.class.getName(),
LongSumAggregator.class);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:7,代码来源:SimpleCheckpoint.java
示例17: postApplication
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void postApplication() {
LongWritable sumAggregatorValue =
getAggregatedValue(LongSumAggregator.class.getName());
FINAL_SUM = sumAggregatorValue.get();
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:7,代码来源:VerifyMessage.java
示例18: compute
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void compute(
Vertex<LongWritable, IntWritable, FloatWritable> vertex,
Iterable<VerifiableMessage> messages) throws IOException {
String sumAggregatorName = LongSumAggregator.class.getName();
if (getSuperstep() > SUPERSTEPS) {
vertex.voteToHalt();
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("compute: " + getAggregatedValue(sumAggregatorName));
}
aggregate(sumAggregatorName, new LongWritable(vertex.getId().get()));
if (LOG.isDebugEnabled()) {
LOG.debug("compute: sum = " +
this.<LongWritable>getAggregatedValue(sumAggregatorName).get() +
" for vertex " + vertex.getId());
}
float msgValue = 0.0f;
for (VerifiableMessage message : messages) {
msgValue += message.value;
if (LOG.isDebugEnabled()) {
LOG.debug("compute: got msg = " + message +
" for vertex id " + vertex.getId() +
", vertex value " + vertex.getValue() +
" on superstep " + getSuperstep());
}
if (message.superstep != getSuperstep() - 1) {
throw new IllegalStateException(
"compute: Impossible to not get a messsage from " +
"the previous superstep, current superstep = " +
getSuperstep());
}
if ((message.sourceVertexId != vertex.getId().get() - 1) &&
(vertex.getId().get() != 0)) {
throw new IllegalStateException(
"compute: Impossible that this message didn't come " +
"from the previous vertex and came from " +
message.sourceVertexId);
}
}
int vertexValue = vertex.getValue().get();
vertex.setValue(new IntWritable(vertexValue + (int) msgValue));
if (LOG.isDebugEnabled()) {
LOG.debug("compute: vertex " + vertex.getId() +
" has value " + vertex.getValue() +
" on superstep " + getSuperstep());
}
for (Edge<LongWritable, FloatWritable> edge : vertex.getEdges()) {
FloatWritable newEdgeValue = new FloatWritable(
edge.getValue().get() + (float) vertexValue);
Edge<LongWritable, FloatWritable> newEdge =
EdgeFactory.create(edge.getTargetVertexId(), newEdgeValue);
if (LOG.isDebugEnabled()) {
LOG.debug("compute: vertex " + vertex.getId() +
" sending edgeValue " + edge.getValue() +
" vertexValue " + vertexValue +
" total " + newEdgeValue +
" to vertex " + edge.getTargetVertexId() +
" on superstep " + getSuperstep());
}
vertex.addEdge(newEdge);
sendMessage(edge.getTargetVertexId(),
new VerifiableMessage(
getSuperstep(), vertex.getId().get(), newEdgeValue.get()));
}
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:68,代码来源:VerifyMessage.java
示例19: initialize
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void initialize() throws InstantiationException,
IllegalAccessException {
registerAggregator(Constants.UPDATES, LongSumAggregator.class);
registerPersistentAggregator(Constants.PHASE, PhaseWritableAggregator.class);
}
开发者ID:paulmw,项目名称:giraph-examples,代码行数:7,代码来源:MasterCompute.java
示例20: compute
import org.apache.giraph.aggregators.LongSumAggregator; //导入依赖的package包/类
@Override
public void compute(Iterable<FloatWritable> messages) {
SimpleCheckpointVertexWorkerContext workerContext =
(SimpleCheckpointVertexWorkerContext) getWorkerContext();
boolean enableFault = workerContext.getEnableFault();
int supersteps = workerContext.getSupersteps();
if (enableFault && (getSuperstep() == FAULTING_SUPERSTEP) &&
(getContext().getTaskAttemptID().getId() == 0) &&
(getId().get() == FAULTING_VERTEX_ID)) {
LOG.info("compute: Forced a fault on the first " +
"attempt of superstep " +
FAULTING_SUPERSTEP + " and vertex id " +
FAULTING_VERTEX_ID);
System.exit(-1);
}
if (getSuperstep() > supersteps) {
voteToHalt();
return;
}
long sumAgg = this.<LongWritable>getAggregatedValue(
LongSumAggregator.class.getName()).get();
LOG.info("compute: " + sumAgg);
aggregate(LongSumAggregator.class.getName(),
new LongWritable(getId().get()));
LOG.info("compute: sum = " + sumAgg +
" for vertex " + getId());
float msgValue = 0.0f;
for (FloatWritable message : messages) {
float curMsgValue = message.get();
msgValue += curMsgValue;
LOG.info("compute: got msgValue = " + curMsgValue +
" for vertex " + getId() +
" on superstep " + getSuperstep());
}
int vertexValue = getValue().get();
setValue(new IntWritable(vertexValue + (int) msgValue));
LOG.info("compute: vertex " + getId() +
" has value " + getValue() +
" on superstep " + getSuperstep());
for (Edge<LongWritable, FloatWritable> edge : getEdges()) {
FloatWritable newEdgeValue = new FloatWritable(edge.getValue().get() +
(float) vertexValue);
Edge<LongWritable, FloatWritable> newEdge =
EdgeFactory.create(edge.getTargetVertexId(), newEdgeValue);
LOG.info("compute: vertex " + getId() +
" sending edgeValue " + edge.getValue() +
" vertexValue " + vertexValue +
" total " + newEdgeValue +
" to vertex " + edge.getTargetVertexId() +
" on superstep " + getSuperstep());
addEdge(newEdge);
sendMessage(edge.getTargetVertexId(), newEdgeValue);
}
}
开发者ID:zfighter,项目名称:giraph-research,代码行数:57,代码来源:SimpleCheckpointVertex.java
注:本文中的org.apache.giraph.aggregators.LongSumAggregator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论