1
0
Fork 0

Revert "Changing PageRank"

This reverts commit 93a03c923a.
This commit is contained in:
Simon Grätzer 2017-03-01 23:20:38 +01:00
parent 93a03c923a
commit 27098e9e4f
2 changed files with 11 additions and 13 deletions

View File

@ -45,21 +45,19 @@ struct PRComputation : public VertexComputation<float, float, float> {
PRComputation() {}
void compute(MessageIterator<float> const& messages) override {
float* ptr = mutableVertexData();
//float copy = *ptr;
float copy = *ptr;
//if (globalSuperstep() == 0) {
// *ptr = 1.0 / context()->vertexCount();
//} else {
if (globalSuperstep() > 0) {
if (globalSuperstep() == 0) {
*ptr = 1.0 / context()->vertexCount();
} else {
float sum = 0.0;
for (const float* msg : messages) {
sum += *msg;
}
*ptr = 0.85 * sum + 0.15;
}// / context()->vertexCount();
//}
//float diff = fabs(copy - *ptr);
//aggregate<float>(kConvergence, diff);
*ptr = 0.85 * sum + 0.15 / context()->vertexCount();
}
float diff = fabs(copy - *ptr);
aggregate<float>(kConvergence, diff);
RangeIterator<Edge<float>> edges = getEdges();
float val = *ptr / edges.size();
@ -93,8 +91,8 @@ struct PRMasterContext : public MasterContext {
};
bool postGlobalSuperstep() override {
//float const* diff = getAggregatedValue<float>(kConvergence);
return globalSuperstep() < 20;// || *diff > _threshold;
float const* diff = getAggregatedValue<float>(kConvergence);
return globalSuperstep() < 1 || *diff > _threshold;
};
};

View File

@ -37,7 +37,7 @@ struct PageRank : public SimpleAlgorithm<float, float, float> {
PageRank(arangodb::velocypack::Slice const& params);
GraphFormat<float, float>* inputFormat() const override {
return new VertexGraphFormat<float, float>(_resultField, 1);
return new VertexGraphFormat<float, float>(_resultField, 0);
}
MessageFormat<float>* messageFormat() const override {