Image by Patricio Betteo

New Networks are Coming!

A more robust analysis of the Song of Ice and Fire

 

Interested in a more thorough analysis of "A Song of Ice and Fire?" Check out the Network of Thrones site where we will analyze all the books, as well as the TV series. We will have all of the books up before the start of Season 7, and we will get the TV seasons up as we finish analyzing them.

Original Network of Thrones Data Set

The Weighted Edges of the Storm of Swords Network

 

Here is the original data set that we used for the Math Horizons article. It is easy to import this data into Gephi or any other network analysis software. Have fun!

  • A Storm of Swords: a CSV file that contains 353 weighted edges connecting 107 characters from "A Storm of Swords."
  • Please use the hashtag #NetworkOfThrones for online discussions about it.
  • For academic work, please cite: A. Beveridge and J. Shan, "Network of Thrones," Math Horizons Magazine , Vol. 23, No. 4 (2016), pp. 18-22.

"When you play the game of thrones, you win or you die." So says Cersei Lanister. Here is a Sporcle quiz where the stakes are a little lower. Finally, someone is reaching the untapped market for math research simulation games! Experience the thrills of mathematical discovery without all that pesky hard work! Hey, it worked for Guitar Hero and Rock Band.

Introduction

Welcome!

 

You're probably here because you read something online about my Math Horizons article with Jie Shan, a recent Macalester graduate, This was his senior capstone project (impressive) that we further developed afterwards. This article was publicshed by the Mathematical Association of America.

If you're wondering, here are my favorite links about "Network of Thrones."

And here are the answers to the top two questions that we're getting.

  • Do you have networks for the other books? We are working on the other books. We'll post those networks soon. We agree with you (and everyone else) that the analysis in our paper doesn't settle the matter. Looking at one book captures the narrative tension of that volume, not the series as a whole. We envisioned this article as an engaging introduction to a new field of applied math. But of course, "Mathematicians Write Introductory Article" isn't an eye-catching headline. We're glad people are interested in we've done, so we're working hard on the other books. We've improved our methods, and will hope to be done before the end of the current seasion.
  • Will you make your data available? Done! See the top of this page.

Network Science

Mathematics is about Finding and Explaining Patterns

 

More generally, you might be here because our analysis of "A Storm of Swords" has made you curious about mathematics. Maybe you are rethinking your impressions on what mathematics is all about. In my interview in the Quartz article about "Network of Thrones", I paraphrase a meme introduced by Keith Devlin in the early 1990s: mathematics is the science of patterns. Devlin revisited this catchy description in his 2012 blog post, where he wrote: "thinking of mathematics in terms of patterns is far more reflective of the bulk of contemporary mathematics than is the computational-centric view of the subject that still seems the dominant one in society at large." Obviously, I agree.

I frequently teach Discrete Mathematics, an introductory college-level course on the kind of pattern-focused mathematics that Devlin talks about. I am keenly aware of the paradigm shift that this course requires, since I de-emphasize computation in favor of understanding and explaining. To help my students with this transition, I tell them: "Imagine that during high school English class, you only got to study grammar, and that you were finally allowed to start reading novels once you got to college. That's kind of how mathematics is taught: you focus on the grammar (computation) rather than the beautiful things that you are able to do with it." This analogy is imperfect (just as Devlin acknowledges about his "science of patterns" catch phrase). But this flawed analogy does help to open students' minds. It encourages them to revisit what they think it means to "do mathematics."

What is Network Science all about? We are surrounded by networks, both visible and invisible. Amazingly, these various network structures display some remarkable similarities. Network Science studies empirical network data with tools to describe these patterns, and develops models to capture the forces that shape them. If you want to know more about Network Science, here are some books that I'd recommend.

In what follows, I will revisit the Game of Thrones network that Jie and I created from "A Storm of Swords," the third book of "A Song of Ice and Fire." There's nothing new here that doesn't appear in the article... at least, not yet.

Westros and Essos

The Complexity of "Game of Thrones"

 

The TV sensation "Game of Thrones" is based on George R. R. Martin's epic fantasy novel series, "A Song of Ice and Fire." The series is famous for its sweeping plotlines, its cast of hundreds of characters, and its complex web of character dynamics. In addition, "Game of Thrones" is an ensemble piece, featuring many prominent characters with intertwined relationships. With so many competing narratives, it's not clear how to rank the importance of the main characters. In this way, the realms of Westros and Essos mirror our own. We turn to mathematics to make sense of the intricate relationships in "Game of Thrones."

We give a quick summary of our exploration of Westros and Essos via Network Science. For more details, you can read the full paper from Math Horizons Magazine, a publication of the Mathematical Association of America.

Creating an Interaction Network

Turning "A Storm of Swords" into a Network

 

We created a character network for "A Storm of Swords," the third book in the series. We represented each character in the book as a vertex. We 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. This visualization was created using the open source Gephi software package.

Like a real-world network, the Storm of Swords network consists of multiple denser subnetworks, held together by a sparser global web of links. It is also organized around a subset of highly influential people.

We used some standard tools from Network Science to investigate these properties. In the network visualization above, the color of a vertex indicates its community. The size of a vertex corresponds to its PageRank value, and the size of its label corresponds to its betweenness centrality. An edge’s thickness represents its weight. We explain these concepts below.

Community Detection

Discovering Densely Connected Subnetworks

 

We 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. We 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.

Character Importance

Centrality Measures Capture Different Types of Influence

 

Next, we investigated character importance using six distinct centrality measures. Each of these measures addresses a different way to measure influence. The results and rankings are shown in the following table.

There is no single "right" centrality measure for a network. Each measure gives complementary information, and taking them in concert can be quite revealing. Here are an intuitive explanations for these measures.

  • Degree Centrality: the number of other characters that you interact with.
  • Weighted Degree Centrality: the number of interactions you participate in.
  • Eigenvector Centrality: weighted degree centrality with a feedback boost for interacting with other important characters. You get full credit for the importance of your neighbors.
  • PageRank Centrality: weighted degree centrality with a feedback boost for interacting with other important characters. The importance of your neighbors is split among its neighbors.
  • Closeness Centrality: the average distance to all other characters (measured by number of links you must traverse). For this measure only, smaller numbers are better.
  • Betweenness Centrality: how often you lie on shortest paths between two other characters, making you a broker of information.

Conclusions

What Does Our Network Analysis Tell Us?

So who is the most important character in "A Storm of Swords?" In our network, three characters stand out consistently.

  • Tyrion Lannister. Acting as the Hand of the King, Tyrion is thrust into the center 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.
  • 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.
  • Sansa Stark. Sansa's high ranking might come as a surprise, since she is a de facto captive in King's Landing. However, other players are aware of her value as a Stark heir and they repeatedly use her as a pawn in their plays for power. If she can develop her cunning, then she can capitalize on her network position to dramatic effect.

Meanwhile, two characters stand out by over performing in certain centrality measures: Daenerys Targaryen and Robert Baratheon. They provide a clear counter-point to one another, and return our attention to the Iron Throne itself. Robert's memory unifies the crumbling network of the recent past, while Daenarys will surely upend the current network when she returns to Westros in pursuit of the Throne.