Assignment5

Zoe Bean
3/2/2022

Part 1: The Data

source("./Import Scripts/Game of Thrones Interactions.R")

Note: I believe that I have fixed the issue with statnet by commenting out the line “delete.edge.attribute(network_statnet,”na“)” that was after the igraph to statnet conversion. This means that the network now has edges, but I am unsure if they are the correct ones.

This is an edgelist dataset. It has 298 vertices and 9131 edges, it is not directed or bipartite, and it is weighted. The vertices are the people, with attributes regarding the time and location of their appearances, as well as the point of view the story is in for these appearances.

The dataset is the Game of Thrones Interactions dataset, with characters as nodes, and instances of characters being mentioned in the same vicinity are the edges.

Here is the best network plot I have managed to create with this data so far:

V(network_igraph)$size<-5
plot(network_igraph, layout_with_lgl(network_igraph), vertex.label=NA)

Part 2

Betweenness

centr_betw(network_igraph,directed=F)$centralization #centralization
[1] 0.04738167
between<-data.frame(igraph::betweenness(network_igraph, directed=FALSE, weights=NA)) #centrality list

head(arrange(between, desc(between)), 10) #top 10 most betweenness central nodes
                  igraph..betweenness.network_igraph..directed...FALSE..weights...NA.
Robert Baratheon                                                            2201.4513
the Others                                                                  1815.0708
Robb Stark                                                                  1787.4981
Eddard Stark                                                                1665.9894
Tywin Lannister                                                             1654.3540
Stannis Baratheon                                                           1473.8467
Arya Stark                                                                  1458.7710
Jaime Lannister                                                             1179.1043
Jon Snow                                                                     935.7536
Roose Bolton                                                                 930.4197

This list of nodes is fairly consistent with the other lists from other methods of finding centrality, so it is not very surprising- except for maybe Roose Bolton making the list, when he has not appeared in any previous lists of top ten most central.

The betweenness value for the whole network is ~0.05, meaning that these centralities are not concentrated on one or few nodes.

Brokerage

This network is an undirected network, so for this last part I will use the Game of Thrones Like/Dislike network, which is directed and similar to the interactions network.

source("C:/Users/zabea/OneDrive/Documents/DACSS/spring2022/Political Networks/Import Scripts/Game of Thrones LikeDislike.R")
#################################################################################################
"Game of Thrones Like-Dislike.R" has imported the Like-Dislike Network from the Game of Thrones
Dataset. 

It is a small, weighted, directed network showing characters affinity for one another. The degree
to which a character likes another is held by the "weight" attribute and ranges between -5 and 5.

The import script has created four objects that represent the network:
     -network_adjacency2     (an adjacency matrix)
     -network_nodes2         (a dataframe of node attributes)
     -network_igraph2        (an igraph object)
     -network_statnet2       (a network object compatable with statnet packages like sna & ergm)

Each object name starts, quite generically, with "network_" and ends with the type of object it 
is. Note that the names are generic so that this import script is compatable with other scripts
we will use with this course.
################################################################################################

The basic data for this network:

#network size, weighted, directed, bipartite
print(network_statnet2)
 Network attributes:
  vertices = 46 
  directed = TRUE 
  hyper = FALSE 
  loops = FALSE 
  multiple = FALSE 
  bipartite = FALSE 
  total edges= 1143 
    missing edges= 0 
    non-missing edges= 1143 

 Vertex attribute names: 
    Current.house Former.house vertex.names 

 Edge attribute names not shown 
#attributes

#vertices
network::list.vertex.attributes(network_statnet2)
[1] "Current.house" "Former.house"  "na"            "vertex.names" 
head(network_statnet2 %v% "vertex.names")
[1] "Lysa.Arryn"        "Petyr.Baelish"     "Joffrey.Baratheon"
[4] "Margaery.Tyrell"   "Renly.Baratheon"   "Robert.Baratheon" 
#edges
network::list.edge.attributes(network_statnet2)
[1] "na"     "weight"
head(network_statnet2 %e% "weight")
[1]  3  2  1 -1 -1  2

There are much less nodes in this network- only 46 compared to our previous 298.

broker<-data.frame(brokerage(network_statnet2, cl =
                               network_nodes2$Current.house)$z.nli)
network_nodes2<-network_nodes2 %>%
  mutate(broker.tot = broker$t,
         broker.coord = broker$w_I,
         broker.itin = broker$w_O,
         broker.rep = broker$b_IO,
         broker.gate = broker$b_OI,
         broker.lia = broker$b_O)


head(arrange(network_nodes2, desc(network_nodes2$broker.tot)), 10)
                 Name Current.house Former.house broker.tot
1   Joffrey Baratheon     Lannister    Baratheon  4.4280731
2    Cersei Lannister     Lannister    Baratheon  4.3525892
3       Catelyn Stark         Stark        Tully  3.8996860
4          Robb Stark         Stark               3.2580731
5  Daenerys Targaryen     Targaryen               2.5598472
6       Theon Greyjoy       Greyjoy               1.8427504
7     Tywin Lannister     Lannister               1.4464601
8         Sansa Stark         Stark               1.0690407
9          Arya Stark         Stark               0.9180729
10         Bran Stark         Stark               0.9180729
   broker.coord broker.itin broker.rep broker.gate broker.lia
1     1.1793625  -0.5165196  3.5503530   3.7333268   3.594505
2    -0.4021732   0.2883724  3.1234143   2.3915193   4.490194
3    -1.1969890  -0.8095261  3.3445779   3.3445779   3.508737
4    -1.1969890  -0.8095261  2.9008395   2.8374483   2.921579
5    -0.5623731   0.5010289  1.2621034   1.2621034   2.623248
6           NaN  -1.6744801  0.1706807   0.1706807   2.562505
7    -0.4021732  -1.0531144  1.2326856   1.1716944   1.515227
8    -1.1969890  -2.2856053  1.3794505   1.3160593   1.191010
9    -1.1969890  -2.5316185  1.1258857   1.2526681   1.160107
10   -1.1969890  -2.5316185  1.1258857   1.2526681   1.160107

I decided to use Current.house because most people have a current house, while few have a former house.

This, too, is fairly consistant with the centrality lists from the interactions data. Joffrey Baratheon is on top of this list- and was almost universally hated by every other character in the books, save his own mother, who is number two on this list, is Queen for all or almost all of the series, and was also fairly unpopular amongst the other characters. the majority of the people on this list generally have a lot of supporters, or a lot of detractors. It should be noted that five of the ten people on this list are currently Starks, which is also unsurprising.

The books written mostly from the point of view of the Starks, their allies, their enemies, and their enemies turned allies. Three of the remaining five are Lannisters, and since this story has a lot of Stark/Lannister conflicts, tentative allyships, and betrayals it is no surprise that there is a lot of brokerage happening with these families.