graphx and counting degrees

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

graphx and counting degrees

daze5112
This post has NOT been accepted by the mailing list yet.
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