Gephi

To get started, download Gephi from https://gephi.org/ and install it locally on your machine. At the time of writing this book, the stable version is 0.9.1, which we will use throughout. Upon opening the Gephi application, you will be prompted a welcome message and can choose from a few examples to explore. We will use Les Miserables.gexf to familiarize ourselves with the tool. We will discuss the GEXF file format in more detail later; for now, let's just focus on the application. The underlying graph data of this example consists of vertices representing characters of the piece, Les Miserables, and edges denoting the association of characters, weighted by an assessment of the importance of the connection.

Gephi is a very rich tool and we can only discuss a few basics here. Once you open the preceding file you should already see a preview of the example graph. Gephi has three main views:

  • Overview: This is the view in which we can manipulate all the visual attributes of the graph and get a preview. For our purposes, this is the most important view, and we will discuss it in more detail.
  • Data Laboratory: This view shows raw graph data in a table format, split into Nodes and Edges, which can also be extended and modified as needed.
  • Preview: The preview view is used to see the result, that is, the graph visualization, as it can also be exported to various formats, such as SVG, PDF, and PNG.

If it is not already active, select Overview to proceed. In the main menu of the application, filed under Window, you can choose various tabs. Make sure to have Graph, Preview Settings, Appearance, Layout, and Statistics open, as indicated in the following image:

Figure 12: Gephi's three main views and the essential tabs used in the Overview view

The Graph tab, in which you should already see a visual representation of the sample les miserables graph, can be used for final touch-ups and visual inspection. For instance, the Rectangle selection on the left of the respective window allows you to select subgraphs by selecting vertices, whereas with Drag, you can move around vertices to your aesthetic needs.

In Preview settings, potentially the most interesting tab for us, we can configure most of the visual aspects of the graph. Presets allow you to change the general style of the graph, such as curved versus straight edges. We will keep the Default setting as is. You may have noticed that the graph preview has no vertex or edge labels, so it's impossible to see what each vertex stands for. We can change this by selecting Show Labels in the Node Labels category and then deselecting the Proportional size checkbox so that all the labels have the same size. If you now go to the Preview view, the graph you see should look as shown in the following image:

 

Figure 13: Les miserables example graph, slightly modified with Gephi. Vertices are characters of the piece and edges represent importance of connection by means of edge thickness. Vertex size is determined by degree and vertices are additionally grouped by colour to indicate family membership, the latter of which can't be seen in print.

Note that the preceding graph comes with visual attributes that we did not specifically set. The vertex size is proportional to the vertex degree, the edge thickness is determined by the weight, and the graph is color-coded to show which family the individual characters belong to. To understand how this is done, we discuss the Appearance tab next, which also distinguishes between Nodes and Edges. In the top-right corner of this tab, there are four options to choose from, and we select Size, which is depicted by an icon showing several circles. Having done so, we can first select Nodes in the top-left corner and then Ranking right below it. In the drop-down menu, we can choose an attribute to determine the node size by, which, in the preceding example, is degree. Similarly, the other two attributes discussed previously can be configured.

Moving on, the next tab we discuss is Layout, in which we can select methods to automatically arrange the graph. Interesting layouts to play with are the two available Force Atlas schemes, which simulate vertices gravitating toward each other with configurable vertex attraction and repulsion properties. In Figure 13, no layout was chosen, but it can be interesting to explore them a little. Whatever layout you choose, activate them by hitting the Run button.

Using the Statistics tab, we can explore graph properties from within Gephi, such as connected components and PageRank. Since we will discuss how to do this with GraphX, which is also much more performant, we will just leave it at that, although you are encouraged to experiment with the functionality in this tab, as it can help build intuition quickly.

Having configured the attributes to our needs, we can now switch to the Preview view to see if the resulting graph is what we expect it to be. Assuming that everything worked out, the SVG/PDF/PNG button of the Preview settings tab can be used to export our final infographic to be used in your product, be it reports, further analyses, or other use cases.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.74.189