In [1]:

```
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import scipy.special
# You do not need this part
%matplotlib inline
import warnings
warnings.filterwarnings("ignore")
```

We will do two things: first we will use python to compute the descriptive network statistics that we encountered in the lecture.

Second, we will have a quick look at ho to create networks in python artificially.

This is something that I already did for you, but for the sake of completeness I provide this code as well.

I downloaded the data set as such from here.

Remember: the **vertices** in the data correspond to characters in Game of Thrones, the **edges** are weighted and represent the number of co-occurences of the characters in the book.
A co-occurence happens if the names of the characters occured withn within 15 words.

It is always absolutely essential to keep in mind how vertices and edges are defined!

Here we will use data only from the first seven seasons.

In [2]:

```
G_series_all = nx.read_gml("data/GoT_series_all.gml")
G_series_1 = nx.read_gml("data/GoT_series_1.gml")
G_series_2 = nx.read_gml("data/GoT_series_2.gml")
G_series_3 = nx.read_gml("data/GoT_series_3.gml")
G_series_4 = nx.read_gml("data/GoT_series_4.gml")
G_series_5 = nx.read_gml("data/GoT_series_5.gml")
G_series_6 = nx.read_gml("data/GoT_series_6.gml")
G_series_7 = nx.read_gml("data/GoT_series_7.gml")
graphs = [G_series_1, G_series_2, G_series_3, G_series_4,
G_series_5, G_series_6, G_series_7]
```

This visualization is in itself not really useful...

In [3]:

```
fig, ax = plt.subplots(figsize=(30,30))
nx.draw(G_series_all,
with_labels=True,
node_color="#00a3cc",
ax=ax)
```