If someone is aware of Graphchi and tried to understand the communitydetection.cpp code I need help in understanding what this piece of code is doing in the step by tep fashion:
for(int i=0; i < vertex.num_edges(); i++) {
bidirectional_label edgelabel = vertex.edge(i)->get_data();
vid_t nblabel = neighbor_label(edgelabel, vertex.id(), vertex.edge(i)->vertex_id());
std::map<vid_t, int>::iterator existing = counts.find(nblabel);
int newcount = 0;
if(existing == counts.end()) {
counts.insert(std::pair<vid_t,int>(nblabel, 1));
newcount = 1;
} else {
existing->second++;//map iterator
newcount = existing->second;
}
if (newcount > maxcount || (maxcount == newcount && nblabel > maxlabel)) {
maxlabel = nblabel;
maxcount = newcount;
}
}
newlabel = maxlabel;
}