本文整理汇总了C++中icontext_type::iteration方法的典型用法代码示例。如果您正苦于以下问题:C++ icontext_type::iteration方法的具体用法?C++ icontext_type::iteration怎么用?C++ icontext_type::iteration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类icontext_type
的用法示例。
在下文中一共展示了icontext_type::iteration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gather_edges
edge_dir_type gather_edges(icontext_type& context, const vertex_type& vertex) const {
if (context.iteration() == 0) {
return graphlab::ALL_EDGES;
} else {
return graphlab::NO_EDGES;
}
}
示例2: scatter_edges
edge_dir_type scatter_edges(icontext_type& context,
const vertex_type& vertex) const {
if (context.iteration() < ROUND)
return graphlab::OUT_EDGES;
else
return graphlab::NO_EDGES;
}
示例3: apply
void apply(icontext_type& context, vertex_type& vertex,
const graphlab::empty& empty) {
if (context.iteration() < ROUND)
{
context.signal(vertex);
}
if(context.iteration() == 0)
{
return;
}
pagerank_type new_pagerank = 0.15 + 0.85 * sum_pagerank;
vertex.data().pagerank = new_pagerank;
}
示例4: gather
gather_type gather(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
if (context.iteration() == 0) {
if (vertex.id() == edge.source().id()) {
return gather_type(edge.target().id());
} else {
return gather_type(edge.source().id());
}
} else {
return gather_type();
}
}
示例5: apply
void apply(icontext_type& context, vertex_type& vertex, const gather_type &total) {
if (context.iteration() == 0) {
vertex.data().neighbors = total.get();
} else {
size_t d = vertex.data().neighbors.size();
size_t t = last_msg;
// Due to rounding errors, the results is sometimes not exactly
// 0.0 even when it should be. Explicitly set LCC to 0 if that
// is the case, other calculate it as tri / (degree * (degree - 1))
double lcc = (d < 2 || t == 0) ? 0.0 : double(t) / (d * (d - 1));
vertex.data().clustering_coef = lcc;
}
}
示例6: scatter
void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
if (context.iteration() == 0) {
pair<size_t, size_t> p = count_triangles(edge.source(), edge.target());
if (p.first > 0) {
context.signal(edge.source(), p.first);
}
if (p.second > 0) {
context.signal(edge.target(), p.second);
}
} else {
//
}
}
示例7: apply
/**
* \brief If the distance is smaller then update
*/
void apply(icontext_type& context, vertex_type& vertex,
const gather_type& total) {
changed = false;
if(context.iteration() == 0) {
changed = true;
vertex.data().dist = 0;
context.setUpdateFlag(changed);
return;
//lastchange = vertex.data().dist;
}
if(vertex.data().dist > total.dist) {
changed = true;
vertex.data().dist = total.dist;
//lastchange = vertex.data().dist;
}
context.setUpdateFlag(changed);
//std::cout << "vid=" << vertex.id() << ", val=" << vertex.data().dist << "\n";
}