pysparkvisualizationgraphframes

How to display/visualize a graph created by GraphFrame?


I have created a graph using GraphFrame

g = GraphFrame (vertices, edges)

Apart from analyzing the graph using the queries and the properties offered by the GraphFrame, I would like to visualize the graph to use in a presentation.

Do you know of any tool/library / API / code that allows this visualization in a simple way?


Solution

  • Not a simple way, but you can use python-igraph library, https://igraph.org/. I used it from R but python should be similar. See simple example below. The main problem with all that tool, you should carefully select small subgraph to draw.

    Install it:

    #>pip install python-igraph
    

    The simplest visualisation:

    g = GraphFrame (vertices, edges)
    from igraph import *
    ig = Graph.TupleList(g.edges.collect(), directed=True)
    plot(ig)