spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankur Dave <ankurd...@gmail.com>
Subject Re: graph.inDegrees including zero values
Date Sun, 25 Jan 2015 20:51:08 GMT
You can do this using leftJoin, as collectNeighbors [1] does:

graph.vertices.leftJoin(graph.inDegrees) {
  (vid, attr, inDegOpt) => inDegOpt.getOrElse(0)
}

[1] https://github.com/apache/spark/blob/master/graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala#L145

Ankur


On Sun, Jan 25, 2015 at 5:52 AM, scharissis <stefano.charissis@gmail.com> wrote:
> If a vertex has no in-degree then Spark's GraphOp 'inDegree' does not return
> it at all. Instead, it would be very useful to me to be able to have that
> vertex returned with an in-degree of zero.
> What's the best way to achieve this using the GraphX API?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Mime
View raw message