You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Robineast <Ro...@xense.co.uk> on 2015/09/16 08:58:01 UTC

Re: Get all the Nodes connected to a Node

You need the connected components algorithm which creates a new graph with
the same structure but has vertex attributes that identify the connected
component (identity in this case is the smallest vertex id in the
component).

val cc = g.connectedComponents

cc.vertices.collect

gives:

Array((1,1), (2,1), (3,1), (4,1), (5,5), (6,5))

-------------------------------------------------------------------------------
Robin East
Spark GraphX in Action Michael Malak and Robin East
Manning Publications Co.
http://www.manning.com/books/spark-graphx-in-action




--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Get-all-the-Nodes-connected-to-a-Node-tp24704p24705.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

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