Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
acezen committed Mar 22, 2021
1 parent 6cd06f5 commit 31aaf25
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
6 changes: 2 additions & 4 deletions analytical_engine/apps/pregel/louvain/auxiliary.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
namespace gs {

// aggregators define
constexpr char change_aggregator[] = "change_aggregator";
constexpr char edge_weight_aggregator[] =
"total_edge_weight_aggregator";
constexpr char change_aggregator[] = "change_aggregator";
constexpr char edge_weight_aggregator[] = "total_edge_weight_aggregator";
constexpr char actual_quality_aggregator[] = "actual_quality_aggregator";

// major phase of louvain
Expand All @@ -44,7 +43,6 @@ constexpr int phase_one_minor_step_0 = 0;
constexpr int phase_one_minor_step_1 = 1;
constexpr int phase_one_minor_step_2 = 2;


template <typename VID_T>
struct LouvainNodeState {
using vid_t = VID_T;
Expand Down
10 changes: 4 additions & 6 deletions analytical_engine/apps/pregel/louvain/louvain.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,12 @@ class PregelLouvain
}

// Get the total edge weight of the graph.
edata_t getTotalEdgeWeight(compute_context_t& context,
pregel_vertex_t& v) {
edata_t getTotalEdgeWeight(compute_context_t& context, pregel_vertex_t& v) {
auto& state = v.state();
if (state.reset_total_edge_weight) {
// we just aggregate the total edge weight in previous step.
state.total_edge_weight =
context.template get_aggregated_value<edata_t>(
edge_weight_aggregator);
state.total_edge_weight = context.template get_aggregated_value<edata_t>(
edge_weight_aggregator);
state.reset_total_edge_weight = false;
}
return state.total_edge_weight;
Expand Down Expand Up @@ -397,7 +395,7 @@ class PregelLouvain
}

void compressCommunities(pregel_vertex_t& vertex,
grape::IteratorPair<md_t*>& messages) {
grape::IteratorPair<md_t*>& messages) {
auto community_id = vertex.get_gid();
edata_t weight = 0;
std::map<vid_t, edata_t> edge_map;
Expand Down
12 changes: 6 additions & 6 deletions analytical_engine/apps/pregel/louvain/louvain_app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ class LouvainAppBase
{
// Sync Aggregator
ctx.compute_context().aggregate(change_aggregator,
ctx.GetLocalChangeSum());
ctx.GetLocalChangeSum());
ctx.compute_context().aggregate(edge_weight_aggregator,
ctx.GetLocalEdgeWeightSum());
ctx.GetLocalEdgeWeightSum());
ctx.compute_context().aggregate(actual_quality_aggregator,
ctx.GetLocalQualitySum());
ctx.GetLocalQualitySum());
for (auto& pair : ctx.compute_context().aggregators()) {
grape::InArchive iarc;
std::vector<grape::InArchive> oarcs;
Expand Down Expand Up @@ -202,8 +202,8 @@ class LouvainAppBase
ctx.compute_context().template get_aggregated_value<int64_t>(
change_aggregator);
ctx.change_history().push_back(totalChange);
bool to_halt = decide_to_halt(
ctx.change_history(), ctx.tolerance(), ctx.min_progress());
bool to_halt = decide_to_halt(ctx.change_history(), ctx.tolerance(),
ctx.min_progress());
ctx.set_halt(to_halt);
if (ctx.halt()) {
LOG(INFO) << "super step " << current_super_step << " decided to halt.";
Expand Down Expand Up @@ -296,7 +296,7 @@ class LouvainAppBase
private:
// sync community id from community hub to community members.
void syncCommunity(const fragment_t& frag, context_t& ctx,
message_manager_t& messages) {
message_manager_t& messages) {
auto& vid_parser = ctx.compute_context().vid_parser();
auto& comm_result = ctx.compute_context().vertex_data();
auto inner_vertices = frag.InnerVertices();
Expand Down
4 changes: 1 addition & 3 deletions analytical_engine/core/app/pregel/pregel_compute_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,7 @@ class PregelComputeContext {
}
}

const vineyard::IdParser<vid_t>& vid_parser() const {
return vid_parser_;
}
const vineyard::IdParser<vid_t>& vid_parser() const { return vid_parser_; }

std::unordered_map<std::string, std::shared_ptr<IAggregator>>& aggregators() {
return aggregators_;
Expand Down
4 changes: 1 addition & 3 deletions analytical_engine/core/app/pregel/pregel_vertex.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ class PregelVertex {
compute_context_->set_vertex_value(*this, std::move(value));
}

const VD_T& value() {
return compute_context_->get_vertex_value(*this);
}
const VD_T& value() { return compute_context_->get_vertex_value(*this); }

virtual vertex_t vertex() const { return vertex_; }

Expand Down

0 comments on commit 31aaf25

Please sign in to comment.