spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dizzy5112 <dave.zee...@gmail.com>
Subject counting degrees graphx
Date Mon, 26 May 2014 01:34:07 GMT
Hi, looking for a little help on counting the degrees in a graph. Currently
my graph consists of 2 subgraphs the and it looks like this:

val vertexArray = Array(
(1L,("101","x")),
(2L,("102","y")),
(3L,("103","y")),
(4L,("104","y")),
(5L,("105","y")),
(6L,("106","x")),
(7L,("107","x")),
(8L,("108","y"))
)

val edgeArray = Array(
Edge(1L,2L,1),
Edge(1L,3L,2),
Edge(3L,4L,3),
Edge(3L,5L,4),
Edge(6L,5L,5),
Edge(7L,8L,6)
)

no i can summarize the graphs using connected components as such:
val cc = userGraph.connectedComponents
userGraph.vertices.leftJoin(cc.vertices) {
case(id,tfn,ent) => s"$tfn is in component $ent"}.collect.foreach{ case
(id,str) => println(str) }
and i get the results i expect
(101,SH,0,2) is in component Some(1)
(102,COY,1,0) is in component Some(1)
(103,COY,1,2) is in component Some(1)
(104,COY,1,0) is in component Some(1)
(105,COY,2,0) is in component Some(1)
(106,SH,0,1) is in component Some(1)
(107,SH,0,1) is in component Some(7)
(108,COY,1,0) is in component Some(7)

this essentially gives me two clusters with the root nodes for each as ID 1
and ID 7. what i really want to do is identify the third cluster that is
built into this graph (the connection between 106 and 105 as another
cluster. My results would identify that 105 was in cluster 1 and the new
cluster. any help appreciated.

cheers 



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/counting-degrees-graphx-tp6370.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

Mime
View raw message