Visualizing Game of Thrones: A song of ice and fire. (Bookwise analysis) using Gephi

Preet Gangrade
6 min readFeb 9, 2021

--

Introduction

Game of Thrones, a series of novels written by George R.R. Martin and its television counterpart, have deeply enticed several fans all over the world. With a plethora of characters and plots, the story is highly intricate and incredibly alluring.

I’ve been a Game of Thrones fan since the time it’s being aired and participated in some quiz competitions as well, for this lab report I thought it was an exciting opportunity for me to perform a Game of Thrones character network analysis using Gephi to figure out who are the main protagonists that emerge and how their interactions have been with others throughout the series of books.

Inspiration

I began my research with a simple google search and I came across two very interesting visualizations which stood out –

  1. Network of Thrones

Andrew Beveridge created a character network for “A Storm of Swords,” the third book in the series. He represented each character in the book as a vertex. Then added a link between two characters whenever their names appeared within 15 words of one another. So a link between characters means that they interacted, spoke of one another, or that another character spoke of them together. Characters that interacted frequently are connected multiple times. The result was the network shown below

Network of Thrones — Andrew Beveridge

2. My Experience with Gephi — Visualizing Game of Thrones: A Song of Ice and Fire

Sanchit Kumar — performed a Game of Thrones character network analysis using Gephi to figure out who are the main protagonists that emerge and how their interactions have been with others throughout the series of books. The dataset was created by connecting two characters whenever their names (or nicknames) appeared within 15 words of one another in the series of “A Song of Ice and Fire” novels (volumes 1 through 5). The edge weights correspond to the number of interactions between these characters.

Gephi Visualization — Game of Thrones: A Song of Ice and Fire — Sanchit Kumar

Materials

  1. Gephi — The Open Graph Viz Platform (Gephi 0.9.2 for Mac OS X ) An open-source software for network visualization and analysis. I used this software to create and analyze my network data visualization.
  2. Google Sheets: Free Online Spreadsheets for Personal Use — Google Sheets makes your data pop with colorful charts and graphs. Built-in formulas, pivot tables and conditional formatting options save time and simplify common spreadsheet tasks. I used this to edit my data.
  3. Photoshop — Adobe Photoshop is a raster graphics editor. I used this to combine the final visualizations.

Data Set

mathbeveridge/asoiaf: Character Interaction Networks for George RR Martin’s “A Song of Ice and Fire” saga

These networks were created by connecting two characters whenever their names (or nicknames) appeared within 15 words of one another in one of the books in “A Song of Ice and Fire.” The edge weight corresponds to the number of interactions

Process

The first step of the process was to import data into google sheets so that it could make sense to me as well as the software. Then I exported the data as a csv file which is accepted by Gephi.

The next step was to import the nodes of edges files of each book separately into Gephi. Once I was done with that, Gephi has its default visualization but it did not seem to make sense as all the nodes were in one cluttered mess. Therefore, in order to improve the usability, I needed to perform some layout improvements as well as aesthetic improvements.

I started with the Forced Atlas 2 projection which looked better, However I was curious as to what the other adjustments meant, so I played around with the values and then checked the “Dissuade Hubs” and “Prevent overlap” option which gave me a better understanding of the visualization. The next step was to expand the nodes so that we get a clearer understanding of how the connections worked; this was done using the “Expansion” Layout. Running it on 2x multiple times gave me a clearer understanding of the data.

The statistics that were used here are –

  1. Average Degree
  2. Average Weighted Degree
  3. Graph Density
  4. Network Diameter
  5. Modularity

The next step was to work on the appearance of the data since it looked all grey and black. A color partition on the nodes by ‘modularity class’ and selected an appropriate palette for them. This gave the same color to the nodes that were more densely connected together as compared to the others. I also set the node size ranking on the ‘degree’ to make those nodes larger that had more connections. I set the labels to grow in proportion to the node size as well so that more prominent nodes were easier to read. The background was chosen to be dark since the colour palette looks way more intriguing and understandable with the dark contrast.

Screenshot of Book 1–5 — Layout Adjustments, Statistics.

Visuals

The final visualization rendered on Gephi. Download high-resolution files below – Network Analysis — GoT

Gephi Visualization — Game of Thrones: A Song of Ice and Fire — Book 1–5

Result

By looking at the visualization it gets easier for a user to understand the book wise analysis of the game of thrones network. Looking at the book 1 analysis it’s clear the first season was all about the stark kingdom and Eddard Stark was the guy with the most number of interactions. Similarly, looking at the other visualizations you can identify the characters with the most number of interactions.

The most important character in our network, two characters stand out consistently.

  1. Tyrion Lannister. Acting as the Hand of the King, Tyrion is thrust into the centre of the political machinations of the capitol city. He comes out on top in 5 of the 6 centrality measures. This suggests that he is the true protagonist of the book.
  2. Jon Snow. Jon Snow is the second most important character in the network. Indeed, he holds a unique position, with connections to highborn Lords, the Night’s Watch militia, and the savage wildlings beyond the Wall.

One more interesting conclusion was I wanted to find a natural division of the network into coherent communities, meaning that there are many links within communities and few links between communities. I optimized a measure called modularity, which captures this idea pretty well. This mathematical optimization splits the network into seven communities, as shown by the colors above. Note that we didn’t tell the algorithm how many communities there were, or what their sizes were. These numbers were determined by the structure of the network itself. The resulting communities make sense to anyone familiar with the saga: they are heavily influenced by the geographic location of the characters.

Reflection & Future Direction

Gephi is open-source software and I really appreciate its ability to render network visualizations so quickly and effectively, free of cost! However, the user interface is way too updated for 2020. It still has no undo button because of this I had to redo the steps once again all the time if I wanted any changes with my visualizations.
The software crashes are very frequent, the data processing could heat up your device. This slightly suppressed my desire to explore the tool in depth.

I believe furthermore I could do a game of thrones analysis based on the TV series and then compare the results with the books.

References

Network of Thrones

My Experience with Gephi — Visualizing Game of Thrones: A Song of Ice and Fire

--

--

No responses yet