spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duy Huynh <duy.huynh....@gmail.com>
Subject Re: graphx - mutable?
Date Tue, 14 Oct 2014 21:24:26 GMT
great, thanks!

On Tue, Oct 14, 2014 at 5:08 PM, Ankur Dave <ankurdave@gmail.com> wrote:

> On Tue, Oct 14, 2014 at 1:57 PM, Duy Huynh <duy.huynh.uiv@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/>
>

Mime
View raw message