Graphx connectComponents API

2014-10-22 Thread Manoj Awasthi
Hi Guys,

I am trying something very basic. I am using GraphX to load a graph from an
edge list file which is like this:

*220 224*
*400 401*
*220 221*

So it has following nodes (just for the sake of understanding - bear with
me for drawing):

*220 = 224  400 = 401 *
* ||*

* v 221*

Clearly, there are two connected components in this graph (please CMIIW).
Following is my code:


*val graph = GraphLoader.edgeListFile(sc, inputFile)*

*val componentLowestVertexGraph = graph.connectedComponents*
*componentLowestVertexGraph.vertices.collect.foreach(x = {*
*  println(x._1) // print node id's*
*  })*

gives me following result:

*224*
*401*
*220*
*221*
*400*

Per the documentation of connectedComponents:

*return a graph with the vertex value containing the lowest vertex id in
the connected component containing that vertex.*

So I was expecting to get two vertices returned for above cases.

Can some one point out if I am missing something?

Manoj


Re: Graphx connectComponents API

2014-10-22 Thread Manoj Awasthi
Well - resolved.

The problem was in my understanding. It returns the graph with vertex
data set to the connected components.

Thanks.

On Wed, Oct 22, 2014 at 6:56 PM, Manoj Awasthi awasthi.ma...@gmail.com
wrote:

 Hi Guys,

 I am trying something very basic. I am using GraphX to load a graph from
 an edge list file which is like this:

 *220 224*
 *400 401*
 *220 221*

 So it has following nodes (just for the sake of understanding - bear with
 me for drawing):

 *220 = 224  400 = 401 *
 * ||*

 * v 221*

 Clearly, there are two connected components in this graph (please
 CMIIW). Following is my code:


 *val graph = GraphLoader.edgeListFile(sc, inputFile)*

 *val componentLowestVertexGraph = graph.connectedComponents*
 *componentLowestVertexGraph.vertices.collect.foreach(x = {*
 *  println(x._1) // print node id's== HERE IT
 SHOULD BE ._2 *
 *  })*

 gives me following result:

 *224*
 *401*
 *220*
 *221*
 *400*

 Per the documentation of connectedComponents:

 *return a graph with the vertex value containing the lowest vertex id in
 the connected component containing that vertex.*

 So I was expecting to get two vertices returned for above cases.

 Can some one point out if I am missing something?

 Manoj