本文整理汇总了C++中icontext_type类的典型用法代码示例。如果您正苦于以下问题:C++ icontext_type类的具体用法?C++ icontext_type怎么用?C++ icontext_type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了icontext_type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: finalize
static void finalize(icontext_type& context, error_aggregator& agg) {
ASSERT_GT(agg.ntrain, 0);
agg.train_error = std::sqrt(agg.train_error / agg.ntrain);
context.cout() << context.elapsed_seconds() << "\t" << agg.train_error;
if(agg.nvalidation > 0) {
const double validation_error =
std::sqrt(agg.validation_error / agg.nvalidation);
context.cout() << "\t" << validation_error;
}
context.cout() << std::endl;
}
开发者ID:carriercomm,项目名称:DPDK-Graph,代码行数:11,代码来源:als_vertex_program.hpp
示例2: 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 {
//
}
}
开发者ID:tudelft-atlarge,项目名称:graphalytics-platforms-powergraph,代码行数:15,代码来源:lcc.cpp
示例3: 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;
}
开发者ID:pkuwalter,项目名称:evaluation,代码行数:7,代码来源:PageRank.cpp
示例4: 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;
}
}
开发者ID:tudelft-atlarge,项目名称:graphalytics-platforms-powergraph,代码行数:7,代码来源:lcc.cpp
示例5: apply
void proxy_updater::apply(icontext_type& context){
jobject vertex = context.const_vertex_data().obj();
if (NULL == vertex) return; // BUG?
JNIEnv *env = core::get_jni_env();
env->CallVoidMethod(obj(), java_apply, vertex);
handle_exception(env);
}
开发者ID:3upperm2n,项目名称:PowerGraph,代码行数:7,代码来源:org_graphlab_Updater.cpp
示例6: aggregate
void aggregate(icontext_type& context, const vertex_type& vertex){
if (!marked) {
marked = true;
saedb::IAggregator* active_node = context.getAggregator("active_node");
float t = vertex.data();
active_node->reduce(&t);
}
}
开发者ID:HongleiZhuang,项目名称:saedb,代码行数:8,代码来源:inf_max.cpp
示例7: 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;
}
开发者ID:pkuwalter,项目名称:evaluation,代码行数:17,代码来源:PageRank.cpp
示例8: scatter
/**
* \brief The scatter function just signal adjacent pages
*/
void scatter(icontext_type& context, const vertex_type& vertex,
edge_type& edge) const {
const vertex_type other = get_other_vertex(edge, vertex);
distance_type newd = vertex.data().dist + edge.data().dist;
if (other.data().dist > newd) {
const min_distance_type msg(newd);
context.signal(other, msg);
}
} // end of scatter
开发者ID:YosubShin,项目名称:PowerGraph,代码行数:12,代码来源:sssp.cpp
示例9: scatter
void scatter(icontext_type& context, const vertex_type& vertex,
edge_type& edge) const
{
const vertex_type other = edge.target();
distance_type newd = vertex.data().dist + edge.data().dist;
const min_distance_type msg(newd);
context.signal(other, msg);
}
开发者ID:ddmbr,项目名称:pregelplus-code,代码行数:9,代码来源:SSSP.cpp
示例10: scatter
void scatter(icontext_type& context, const vertex_type& vertex,
edge_type& edge) const {
const vertex_type other = edge.target();
pagerank_type value = vertex.data().pagerank / vertex.num_out_edges();
assert(other.id() != vertex.id());
const sum_pagerank_type msg(value);
context.signal(other, msg);
}
开发者ID:pkuwalter,项目名称:evaluation,代码行数:9,代码来源:PageRank.cpp
示例11: 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";
}
开发者ID:HybridGraph,项目名称:GraphLab-PowerGraph,代码行数:22,代码来源:sssp.cpp
示例12: scatter
// Scatter to scatter_edges edges with the new message value.
void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
bool isEdgeSource = (vertex.id() == edge.source().id());
bool hasSameData = isEdgeSource ? (vertex.data() == edge.target().data()) : (vertex.data() == edge.source().data()) ;
if (!hasSameData) {
min_combiner combiner;
combiner.value = message_value;
context.signal(isEdgeSource ? edge.target() : edge.source(), combiner);
}
}
开发者ID:3upperm2n,项目名称:PowerGraph,代码行数:11,代码来源:concomp.cpp
示例13: operator
void proxy_aggregator::operator()(icontext_type& context){
// forward call to org.graphlab.Aggregator#exec
JNIEnv *env = core::get_jni_env();
env->CallVoidMethod (obj(), java_exec,
&context,
context.vertex_data().obj());
handle_exception(env);
}
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:10,代码来源:org_graphlab_Aggregator.cpp
示例14: scatter
/**
* \brief The scatter function just signal adjacent pages
*/
void scatter(icontext_type& context, const vertex_type& vertex,
edge_type& edge) const {
const vertex_type other = edge.target();
/*if (USE_DELTA_CACHE) {
gather_data_type delta;
delta.dist = lastchange;
context.post_delta(other, delta);
}*/
context.signal(other);
}
开发者ID:HybridGraph,项目名称:GraphLab-PowerGraph,代码行数:14,代码来源:sssp.cpp
示例15: scatter
void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
EData ed = edge.data();
float weight = ed.weight;
if ( !edge.source().data().actived && ((double)rand() / RAND_MAX) < weight){
// if ( !edge.source().data().actived && 0.5 <= weight){
context.signal(edge.source());
}
}
开发者ID:xiaojingzi,项目名称:saedb,代码行数:11,代码来源:inf_max.hpp
示例16: 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();
}
}
开发者ID:tudelft-atlarge,项目名称:graphalytics-platforms-powergraph,代码行数:11,代码来源:lcc.cpp
示例17: operator
void proxy_updater::operator()(icontext_type& context){
jobject vertex = context.const_vertex_data().obj();
if (NULL == vertex) return; // BUG?
// forward call to org.graphlab.Updater#update
JNIEnv *env = core::get_jni_env();
env->CallVoidMethod (obj(), java_update,
&context,
vertex);
handle_exception(env);
}
开发者ID:3upperm2n,项目名称:PowerGraph,代码行数:13,代码来源:org_graphlab_Updater.cpp
示例18: 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;
}
}
开发者ID:tudelft-atlarge,项目名称:graphalytics-platforms-powergraph,代码行数:15,代码来源:lcc.cpp
示例19: scatter
void scatter(icontext_type& context, const vertex_type& vertex,
edge_type& edge) const {
context.signal(edge.target());
}
开发者ID:neozhangthe1,项目名称:saedb,代码行数:4,代码来源:pagerank.cpp
示例20: scatter
void scatter(icontext_type& context, const vertex_type& vertex, edge_type& edge) const {
float weight = edge.data();
if ( ((double)rand() / RAND_MAX) < weight){
context.signalVid(edge.target().id());
}
}
开发者ID:HongleiZhuang,项目名称:saedb,代码行数:6,代码来源:inf_max.cpp
注:本文中的icontext_type类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论