great, thanks! On Tue, Oct 14, 2014 at 5:08 PM, Ankur Dave <ankurd...@gmail.com> wrote:
> On Tue, Oct 14, 2014 at 1:57 PM, Duy Huynh <duy.huynh....@gmail.com> > wrote: > >> a related question, what is the best way to update the values of existing >> vertices and edges? >> > > Many of the Graph methods deal with updating the existing values in bulk, > including mapVertices, mapEdges, mapTriplets, mapReduceTriplets, and > outerJoinVertices. > > To update just a small number of existing values, IndexedRDD would be > ideal, but until it makes it into GraphX the best way is to use one of the > above methods. This will be slower since it's touching all of the vertices, > but it will achieve the same goal. > > For example, if you had a graph and wanted to update the value of vertex 1 > to "a", you could do the following: > > val graph = ... > val updates = sc.parallelize(List((1L, "a"))) > val newGraph = graph.outerJoinVertices(updates) { (id, a, b) => b } > > Ankur <http://www.ankurdave.com/> >