Assignment_6

Roles and Blockmodels (Marriages between characters in the Game of Thrones Novels)

Walid Medani https://walidmedani.github.io/networks-blog/
2022-03-10

Game of Thrones Marriages

plot.igraph(gotmarr.ig, 
            vertex.label.cex=1)

Network Size

vcount(gotmarr.ig)
[1] 18
ecount(gotmarr.ig)
[1] 61

Attributes

is_bipartite(gotmarr.ig)
[1] FALSE
is_directed(gotmarr.ig)
[1] FALSE
is_weighted(gotmarr.ig)
[1] TRUE
vertex_attr_names(gotmarr.ig)
[1] "color"        "na"           "region"       "vertex.names"
[5] "name"        
edge_attr_names(gotmarr.ig)
[1] "na"     "weight"

Centrality Measures

Betweenness Centrality

igraph::betweenness(gotmarr.ig, directed=TRUE)
      Arryn       Tully        Vale   Baratheon   Lannister 
   0.000000   32.222222    0.000000   37.038889    2.705556 
    Martell       Reach       Stark  Stormlands      Tyrell 
   1.250000   21.988889   52.366667    0.000000    0.000000 
 Crownlands       Essos  Riverlands Westerlands        Frey 
   8.000000    2.833333    0.000000   12.358333    7.063889 
      North   Targaryen       Dorne 
   0.000000   16.569444    0.000000 

Betweeness Centralization

centr_betw(gotmarr.ig,directed=T)$centralization
[1] 0.2765138

Closeness Centralization

centr_clo(gotmarr.ig)$centralization
[1] 0.4240252

Structural Equivalance

gotmarr.nodes<-data.frame(name=gotmarr.stat%v%"vertex.names",
        degree=sna::degree(gotmarr.stat,gmode="graph"),
        degree.wt=strength(gotmarr.ig),
        bonpow=bonpow(gotmarr.stat),
        betweenness=betweenness(gotmarr.stat, gmode="graph"),
        close=sna::closeness(gotmarr.stat, gmode="graph"),
        constraint=constraint(gotmarr.ig))

#got partners
gotmarr.se<-equiv.clust(gotmarr.stat, equiv.fun="sedist", method="hamming",mode="graph")

#plot equivalence clustering
plot(gotmarr.se,labels=gotmarr.se$glabels)
rect.hclust(gotmarr.se$cluster,h=15)

plot.block<-function(x=blk_mod, main=NULL, cex.lab=1){
  plot.sociomatrix(x$blocked.data, labels=list(x$plabels,x$plabels),
                   main=main, drawlines = FALSE, cex.lab=cex.lab)
  for (j in 2:length(x$plabels)) if (x$block.membership[j] !=
                                     x$block.membership[j-1]) 
    abline(v = j - 0.5, h = j - 0.5, lty = 3, xpd=FALSE)
}

#blockmodel and select partitions
blk_mod<-blockmodel(gotmarr.stat,gotmarr.se,k=4)
#print blockmodel object
blk_mod$block.model
           Block 1    Block 2   Block 3   Block 4
Block 1 0.40000000 0.04166667 0.6666667 0.8333333
Block 2 0.04166667 0.17857143 0.5000000 0.6250000
Block 3 0.66666667 0.50000000 0.3333333 0.6666667
Block 4 0.83333333 0.62500000 0.6666667       NaN
#plot blockmodel partitions
plot.block(blk_mod,main="GoT Marriages, 4 Partitions", cex.lab=.5)
#blockmodel and select partitions
blk_mod2<-blockmodel(gotmarr.stat,gotmarr.se,k=6)
#print blockmodel object
blk_mod2$block.model
           Block 1    Block 2    Block 3   Block 4   Block 5
Block 1 0.40000000 0.03333333 0.05555556 0.3333333 0.8333333
Block 2 0.03333333 0.30000000 0.06666667 1.0000000 0.6000000
Block 3 0.05555556 0.06666667 0.33333333 0.0000000 0.1666667
Block 4 0.33333333 1.00000000 0.00000000       NaN 0.5000000
Block 5 0.83333333 0.60000000 0.16666667 0.5000000 0.0000000
Block 6 0.83333333 0.40000000 1.00000000 1.0000000 0.5000000
          Block 6
Block 1 0.8333333
Block 2 0.4000000
Block 3 1.0000000
Block 4 1.0000000
Block 5 0.5000000
Block 6       NaN
#plot blockmodel partitions
plot.block(blk_mod2,main="GoT Marriages, 6 Partitions", cex.lab=.5)

Plotting the block role assignments gives us easy insight into observing marriages between the houses. We see that eastern continents and houses didn’t have many marriage connections between northern houses such as Tully, Vale, and Arryn yet they do with other northern houses such as the Starks and Frey.