1目标:统计出一个图中每个顶点的度的情况,并且统计相同度的节点数目
2算法:利用GraphLab的GAS结构
首先利用全局容器记录相同度的节点数目,map<int,int>in_degree统计出度,map<int,int>out_degree统计入度
gather_edges阶段:返回节点的所有边,ALL_EDGES
gather阶段:收集到一条边时,对于当前顶点来说就是度统计的时候,通过重写gather_type类实现度的统计,主要是重载加的操作(gather默认会执行gather_type的加操作),现在给出具体gather_type类degree的实现:
classdegree:graphlab::IS_POD_TYPE
{
public:
inttype;
floatin_degree;
floatout_degree;
degree(inti=-1):type(i),in_degree(0)