From 25c71b185de330074674fbc390dab11de108e7ff Mon Sep 17 00:00:00 2001 From: Reynold Xin Date: Tue, 2 Apr 2013 01:26:20 +0800 Subject: [PATCH] Added a vertices method to Graph. --- graph/src/main/scala/spark/graph/Graph.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graph/src/main/scala/spark/graph/Graph.scala b/graph/src/main/scala/spark/graph/Graph.scala index 2719ed0193..1bf36c2e0d 100644 --- a/graph/src/main/scala/spark/graph/Graph.scala +++ b/graph/src/main/scala/spark/graph/Graph.scala @@ -63,6 +63,8 @@ class Graph[VD: Manifest, ED: Manifest]( private val vTable: RDD[(Vid, (VD, Array[Pid]))] = Graph.createVTable( _vertices, eTable, numVertexPartitions) + def vertices: RDD[Vertex[VD]] = vTable.map { case(vid, (data, pids)) => new Vertex(vid, data) } + def edges: RDD[Edge[ED]] = eTable.mapPartitions { iter => iter.next._2.iterator } def edgesWithVertices: RDD[EdgeWithVertices[VD, ED]] = new EdgeWithVerticesRDD(vTable, eTable)