The Witch’s Brew: Gephi

BigVisualData
3 min readJan 3, 2023

--

Better read listening Manilla Road’s “Witches Brew”

In the previous post in The Witch’s Brew series I presented the rationale and motivation behind creating a network with ingredients and potions found in the famous Harry Potter series of books, films and videogames, along with finding data and preprocessing them. Let us now turn to creating the network graphs using the open-source software Gephi.

There are several options for working with networks and my friend Dr. Verónica Espinoza has done excellent work in presenting them in Medium. My first choice is Gephi, an open-source software which is a standard in social network analysis. Importing the data is easy peasy, and then the first visualization of the network appears. Not much can be said so far, except that it resembles a hairball, with some edges prevailing over the others.

Before importing data, it is always useful to hand-draw your idea (image by the author)

A good idea at this point is to save your file and work with a copy. If anything goes wrong, all you got to do is go back to the original, make a new copy and start over. Another is to export a gexf file. This will give a way of easy data entry to the other solutions I will show later on: it contains just the data (nodes and edges), without any processing or statistics. Thus, you will be able to check consistency between software.

The network consists of 375 nodes and 691 edges. In average, nodes are connected to 3.7 other nodes (Average Degree). In fact, a lot of nodes stand alone, therefore the connectedness ranges from 0 to 24.

The hairball sort of network. I used modularity class to give color and degree to resize the nodes, to keep it less intimidating (image by the author)

The Network Diameter, the (geodesic) distance between any two more distant nodes in the network is 8. Its Density, or how far from complete is connectedness of the nodes (where completeness means that every node is connected to all other nodes), is 0.01. It consists of 147 weakly connected Components, with the bigger one consisting of one third of the nodes (34.4%). The algorithm detected 151 communities (modularity classes), i.e. groups of nodes strongly connected between them than with the rest of the network.

Based upon those network metrics, we may choose visualization strategies to present the most important aspects in this Cookbook. I used Force Atlas 2, a force directed algorithm to lay out the network. One should keep in mind that a network is topological and not eucleidian, therefore it may be represented in different ways which don’t impact its characteristics. Nodes are colored according to modularity class (i.e. community). Node size corresponds to the number of connections (Degree), or to their acting as hubs or bridges between diverse communities (Betweenness Centrality).

The network: Nodes are colored according to modularity class. Node size corresponds to the number of connections (Degree). (image by the author)
The network: Nodes are colored according to modularity class. Node size corresponds to their acting as hubs or bridges between diverse communities (Betweenness Centrality). (image by the author)

Flobberworm Mucus, Moondew, Unicorn Horn, Asphodel and Rue, are the five ingredients with most connections (higher Degree) in the network.

Moonstone, Flobberworm Mucus, Porcupine quill, Ashwinder egg and Rose Petals, are connecting diverse parts of the network (higher Betweenness Centrality).

Gephi offers a plugin to export the graph in interactive html form. It needs a server to host the output. You can check the potions’ network made by Gephi in my website.

This is a two-mode network: the nodes belong to two different kinds- ingredients (pink) and potions (green). (image by the author)

Read next The Witch’s Brew: Python fangs.
Previous in The Witch’s Brew — an introduction to brewing networks.

--

--

BigVisualData

Analyzing Visual Corpora with computational methods. It’ll provide pieces on methodology, sociological & semiotics viewpoints. Yannis Skarpelos