本文整理汇总了C++中graphchi_vertex::remove_edge方法的典型用法代码示例。如果您正苦于以下问题:C++ graphchi_vertex::remove_edge方法的具体用法?C++ graphchi_vertex::remove_edge怎么用?C++ graphchi_vertex::remove_edge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphchi_vertex
的用法示例。
在下文中一共展示了graphchi_vertex::remove_edge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
/**
* Vertex update function.
*/
void update(graphchi_vertex<VertexDataType, EdgeDataType> &v, graphchi_context &gcontext) {
if (gcontext.iteration % 2 == 0) {
adjcontainer->grab_adj(v);
} else {
uint32_t oldcount = v.get_data();
uint32_t newcounts = 0;
v.sort_edges_indirect();
vid_t lastvid = 0;
/**
* Iterate through the edges, and if an edge is from a
* pivot vertex, compute intersection of the relevant
* adjacency lists.
*/
for(int i=0; i<v.num_edges(); i++) {
graphchi_edge<uint32_t> * e = v.edge(i);
if (e->vertexid > v.id() && e->vertexid >= adjcontainer->pivot_st) {
assert(!is_deleted_edge_value(e->get_data()));
if (e->vertexid != lastvid) { // Handles reciprocal edges (a->b, b<-a)
if (adjcontainer->is_pivot(e->vertexid)) {
uint32_t pivot_triangle_count = adjcontainer->intersection_size(v, e->vertexid, i);
newcounts += pivot_triangle_count;
/* Write the number of triangles into edge between this vertex and pivot */
if (pivot_triangle_count == 0 && e->get_data() == 0) {
/* ... or remove the edge, if the count is zero. */
v.remove_edge(i);
} else {
e->set_data(e->get_data() + pivot_triangle_count);
}
} else {
break;
}
}
lastvid = e->vertexid;
}
assert(newcounts >= 0);
}
if (newcounts > 0) {
v.set_data(oldcount + newcounts);
}
}
/* Collect triangle counts matched by vertices with id lower than
his one, and delete */
if (gcontext.iteration % 2 == 0) {
int newcounts = 0;
for(int i=0; i < v.num_edges(); i++) {
graphchi_edge<uint32_t> * e = v.edge(i);
if (e->vertexid < v.id()) {
newcounts += e->get_data();
e->set_data(0);
// This edge can be now deleted. Is there some other situations we can delete?
if (v.id() < adjcontainer->pivot_st && e->vertexid < adjcontainer->pivot_st) {
v.remove_edge(i);
}
}
}
v.set_data(v.get_data() + newcounts);
}
}