# Survivor Alliance Networks Visualized

Now that we have defined the alliance index to quantify the relationship between castaways, what can we do next? We can build a Survivor alliance network by taking castaways as nodes and the alliance index between a pair of castaways as the edge. The Survivor alliance networks can then be used as a visual summary of the relationships in every season.

In this post, I’ll demonstrate how we can construct alliance networks and then I’ll show what they look like.

This is the third article in my *Survivor Alliance Analysis* series. The other articles in the series are:

- Scraping the Survivor Wiki with Beautiful Soup
- Computational Analysis of Survivor Alliances
- Survivor Alliance Networks Visualized
- Network Analysis of Survivor Alliances

Before moving on, check out my brief introduction to networks and network metrics to familiarize yourself with networks. You don’t have to read the network metrics part until the next article in the series.

## Building Survivor Alliance Networks with NetworkX

Consider a single season of Survivor. We can extract a network out of this season by considering the castaways as our set of nodes and the alliance index between each pair of castaways as the set of edges. Note that our interpretation of the alliance index is relationship strength, so the resulting network is not just a plain, unweighted network, but a weighted network with relationship strength given by the alliance index. Later on, we will visualize relationship strength with edge thickness.

We can use the NetworkX module in Python to build the network in a really easy manner. In order to define a network in NetworkX, we construct a network object using nx.Graph(). Let’s call the resulting network G. To add nodes to G, we do G.add_nodes_from(node_list) where node_list is, naturally, the list of nodes. To add an edge to G, we do G.add_edge(edge_pair) where edge_pair is a pair of nodes we want to connect.

We then define a function plot_network() which takes as input the season name and outputs the network of relationships as a png file. This function relies on the scraping code and the alliance index code from Scraping the Survivor Wiki and Computational Analysis of Survivor Alliances, respectively. We set the parameters *m*=50 and *k*=3 by default. For a discussion on what these parameters mean, check out the second article in the series.

To arrange the nodes in space, we use the spring layout since it accentuates clustering of nodes.

Using the function defined above, we can plot the network for each Survivor season using the following for loop:

## Survivor Alliance Networks, Visualized

Let’s look at the Survivor alliance network of several past seasons of Survivor.

First, let me give three notes.

1. Remember that edge thickness denotes the alliance index (or the strength of the relationship). A thicker edge corresponds to a higher alliance index, while a thinner edge corresponds to a lower alliance index.

2. More often than not, pre-merge boots do not appear in the alliance networks since they get filtered out by the parameter *k*.

3. The alliance networks are a function of *m* and *k*. For our analysis, we focus solely on the case *m*=50 and *k*=3. Changing *m* and *k* will give different results.

Here are the Survivor alliance networks.

I haven’t watched every season of the show, so I can’t give a detailed analysis of the resulting networks. One thing we notice is that there are some seasons which have distinct, non-connected clusters (Thailand and Palau) while some seasons have a single, connected cluster (Worlds Apart and Cambodia). There are seasons wherein alliances lines are drawn from the get-go, whereas in other seasons alliances are much more fluid and can change from one tribal council to the next.

The alliance networks highlight situations wherein a castaway had two distinct alliances during the season, perhaps one pre-merge and one post-merge, or if the castaway flipped on his alliance. This can be seen with Shii-Ann in All-Stars, Cochran in South Pacific, and Sherri in Caramoan.

So what is the point of these networks? Apart from them being nice to look at, the alliance networks that we created summarize the relationships of each season of the show in a neat image.

I would really appreciate it if you give your thoughts on the Survivor alliance networks. Do they make sense? What’s your interpretation of the networks?

## What Can Still Be Done

One major issue I have with the networks we have made is that time element gets removed from the equation. We all know that **Survivor alliances are dynamic**. That is, they change over time. Heck, they may even change several times within an episode. An interesting project we can do in the future is to look at the time-dynamics of the alliance network. In other words, we look at how the network of relationships change over each voting round, from the first tribal to the pre-final boot.

Another thing that we can do is to **make the plots prettier**. Perhaps we can put the faces of the castaways on the nodes. I don’t know how to do this in NetworkX, but I’m sure that a more sophisticated network plotting tool like Gephi can do this.

P.S. Survivor Blood vs. Water is breaking my algorithm for some reason. I’m getting a key error with Gervase, and I don’t really want to deal with it right now.

## In Conclusion

In this post, we were able to construct Survivor alliance networks out of voting history data. The next thing I’m going to do is compare the different seasons of Survivor using some network metrics I discussed in Network Metrics Explained. This will hopefully enable us to contrast the different seasons of Survivor from one another.

Again, the complete code can be found on my Github. Don’t forget to like the FB page to keep updated on the next post!