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.charis...@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-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to