I am looking for a way to visualize the graph constructed in Spark\'s Graphx. As far as I know Graphx doesn\'t have any visualization methods so I need to export the data from G
If you're using grpahFrames, then I've modified the code provided by @Karol Sudol in his answer for GraphFrames:
def drawGraph[vertices:ClassTag,relations:ClassTag](g:GraphFrame) = {
val u = java.util.UUID.randomUUID
val v = g.vertices.select("id")
val vertexes: Array[String] = g.vertices.select("id").rdd.map(x => x(0).toString).collect()
val edges: Array[Array[String]] = g.edges.select("src", "dst").rdd.map(r => Array(r(0).toString, r(1).toString)).collect()
val edgeCreation = edges.map{ edgeArray =>
"{source:nodes["+ vertexes.indexOf(edgeArray(0).trim()) +"],target:nodes["+ vertexes.indexOf(edgeArray(1).trim())+"]}"
}
println("""
Graph
""")
}