Walking through Gephi
If you have Gephi installed and tested, when you launch the application you should see a screen similar to the following:
For purposes of this tutorial, we want to use the original (unprocessed/prettified) version of the Les Miserables network file. It can be downloaded at: http://digitalnomad.ie/lesmiserables.gml
This file contains an entity recognised version extract of data from the novel mapping whenever two characters speak with one another and has edges measured by the frequency that two characters interact.
Load this file by File > Open and navigate to where you have downloaded it. When you do so you should see a screen similar to this:
You will note that it summarises the records imported and provides us with some options. It has deduced that we have a combination of directed and undirected relationships, but we will set Graph Type: to Undirected.
When you do this, the data is imported into Gephi for your use and you should see a messy graphical representation on the screen. If you do not, ensure that you have selected Overview and not Preview in the uppermost menu in Gephi.
The data underlying this graph can be viewed by choosing Data Laboratory. This editable table shows us both the nodes and the edges and can be modified, exported and shows any calculations we undertake on the data we are working with.
For now, we will return to the Overview so that we can start to work with our graph data and see what this literary network can tell us.
From the Layout Panel, we can choose a means to apply algorithms to help structure our visualisation. One of the more common layouts is Force Atlas. Choose it from the drop-down menu and note that there are a variety of variables we can adjust. Generally, the defaults will give a useful display, but for the purpose of this demonstration, change the Repulsion Strength to 10000. Do so by clicking in the value box, typing the new value and hitting return.
Although nothing seems to happen, Gephi is waiting for us to ‘Run’ the routine. Click the Run button to see what happens. Then click the Stop button When you do so you should have a result similar to:
It’s getting better, but what we want to do now is start to highlight the various attributes of our nodes and edges to find patterns in the graph. One of the statistics that is calculated automatically for each node is its degree. So, let’s change the colours of each node based on the degree of the characters from the novel. Choose from the Appearance Panel > Nodes > Colour > Ranking (the little palette symbol).
The resulting visualisation begins to reveal patterns immediately and we can see that the main node in the centre is darker than many of the peripheral nodes (those with lesser degrees). We can start to identify key characters. Let’s see if we can add some size to the visualisation to expose more patterns.
To do so, we need to calculate the Network Diameter from the Statistics panel on the right side. Click on the Statistics tab beside the Filters tab. From here we can choose a variety of measures to make of our graph. To explore betweenness and possible influence, choose Network Diameter and click the run button.
Gephi will explain what we are about to do and ask us to confirm the operation. Accept the defaults and click OK.
We will get a report back providing us with statistical summaries of the operation.
We will size rather than colour our nodes with the new value. In the Appearance panel choose Nodes > Sizing (the concentric circles) and from Ranking drop-down Betweenness Centrality. Cool! To help improve the visual layout now that we have sized nodes, choose the Adjust by Sizes checkbox from the Layout panel and Run and Stop the layout again. You should now see a graph visualisation that is really starting to look a lot clearer.
Now let’s see if we can find communities and clusters within our network. To do this we need to calculate Modularity. On the Statistics Panel again, choose to Run Modularity and dismiss the resulting report when it is presented,
Much in the same way we sized our nodes, we can now choose to colours those nodes based on their communities – we have identified cliques in the novel. To do so, choose Nodes > Partition > Colour and select Modularity Class.
If the default palette of colours used in this operation is not that distinct. We can modify the colours used for colouring operations tan any time by using the small button beside the colour ramp for the Modularity Class. Choose a palette with more diversity.
Now we can add labels to see who the characters are. Choose the Label tag at the foot of the window (It’s the large T).
Nice, but we can scale the labels by the sized nodes themselves to lend more clarity. Choose the first ‘A’ which presents a drop-down menu and select Scale by Node Size. It may also prove useful to use the Type paramters dialog and select 20 rather than 32 points as the font size. This should look closer to the screen below.
We are now getting very close to a picture that we would be proud to share with our colleagues. For an added clarity to this, let’s remove the characters who only interact with one other character – that is, those that are not as closely drawn into the network that is the novel. To do this we can filter for those nodes with a degree of 1. To do this, got to the Filter Panel (we selected the Statistics one beside it, now go back to Filter.
To filter, we select Topology from the library of available filters and then drag the Degree Range filter below to the Queries panel.
We can either drag the left slider to 3, or select the 1 by clicking it and typing 3 and hitting return. Then select the Filter button and inspect the results – you should have a simpler visualisation similar to below.
Now we can Preview our Image. This allows us to see what the finished product will look like. The Overview is a workbench with fast rendering so we can see our results as we create our visualisation. Preview allows us to finalise the appearance and render it for sharing. Click the Preview Button. Your screen should be initially blank. As before, we need to tell Gephi to start the rendering process. When we click the Refresh Button we should see something similar to below.
At this stage you can click the Show Labels checkbox to add back the labels that we added to the Overview as well as adjust a variety of node and edge parameters, refreshing to see the resulting output.
When you find the visualisation you would like to share, you can export it as a PDF, PNG or SVG file, or export the dataset for further manipulation in Illustrator (SVG), Photoshop (PNG or SVG) or even to frameworks such as sigma.js that allow you to share the dynamic network visualisation on the web.