本文整理汇总了C++中graphchi_vertex::remove_inedge方法的典型用法代码示例。如果您正苦于以下问题:C++ graphchi_vertex::remove_inedge方法的具体用法?C++ graphchi_vertex::remove_inedge怎么用?C++ graphchi_vertex::remove_inedge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphchi_vertex
的用法示例。
在下文中一共展示了graphchi_vertex::remove_inedge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
/**
* Vertex update function.
*/
void update(graphchi_vertex<VertexDataType, EdgeDataType> &vertex, graphchi_context &gcontext) {
int ninedges = 0;
if (gcontext.iteration == 0) {
for(int i=0; i < vertex.num_inedges(); i++) {
vertex.inedge(i)->set_data(vertex.id());
ninedges++;
}
} else {
// Keep track of the number of edegs to ensure that
// deletion works fine.
if (vertex.get_data() != vertex.num_inedges()) {
logstream(LOG_ERROR) << "Discrepancy in edge counts: " << vertex.get_data() << " != " << vertex.num_inedges() << std::endl;
}
assert(vertex.get_data() == vertex.num_inedges());
for(int i=0; i < vertex.num_outedges(); i++) {
graphchi_edge<vid_t> * edge = vertex.outedge(i);
vid_t outedgedata = edge->get_data();
vid_t expected = edge->vertex_id() + gcontext.iteration - (edge->vertex_id() > vertex.id());
if (!is_deleted_edge_value(edge->get_data())) {
if (outedgedata != expected) {
logstream(LOG_ERROR) << outedgedata << " != " << expected << std::endl;
assert(false);
}
}
}
for(int i=0; i < vertex.num_inedges(); i++) {
vertex.inedge(i)->set_data(vertex.id() + gcontext.iteration);
if (std::rand() % 4 == 1) {
vertex.remove_inedge(i);
__sync_add_and_fetch(&ndeleted, 1);
} else {
ninedges++;
}
}
}
if (gcontext.iteration == gcontext.num_iterations - 1) {
vertex.set_data(gcontext.iteration + 1);
} else {
vertex.set_data(ninedges);
}
}