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