作者:白松
1.在Vertex类中,顶点的存储方式采用邻接表形式。每个顶点有 VertexId、VertexValue、OutgoingEdges和Halt,boolean型的halt变量用于记录顶点的状态,false时表示active,true表示inactive状态。 片段代码如下。
2.org.apache.giraph.edge.Edge 接口,用于存储顶点的边,每条边包含targetVertexId和edgeValue两个属性。类关系图如下:
Giraph默认使用DefaultEdge类存储边,该类中有两个变量: I targetVertexId和 E value,I为顶点ID的类型,E为边的类型。注意,DefaultEdge类同时继承ReusableEdge<I,E>接口,在ReusableEdge<I,E>类的定义中,有如下说明文字:
A complete edge, the target vertex and the edge value. Can only be one edge with a destination vertex id per edge map. This edge can be reused, that is you can set it’s target vertex ID and edge value. Note: this class is useful for certain optimizations, but it’s not meant to be exposed to the user. Look at MutableEdge instead.
从上述说明文字可知,edge可以被重用,只需要修改targetVertexId和