Assignment6

assignment for political and social network analysis

Zoe Bean
3/9/2022
library(tidyverse)
library(GGally)

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

The Network

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 network plots that 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)
#a subset of the data with a lot of weight on the edges- meaning more interactions between the characters
#weight chosen by rerunning until the cluster dendrogram was somewhat readable 
sub_stat<-get.inducedSubgraph(network_statnet,eid=which(network_statnet%e%'weight'>=18))
plot(sub_stat)

Structural Equivalence

got_net_se<-equiv.clust(sub_stat, equiv.fun="sedist", method="hamming",mode="graph")
plot(got_net_se, labels=got_net_se$glabels)

For this network, I found that clustering remains the same regardless of equivalence method, so I only need the default method.

Clustering

plot(got_net_se, labels=got_net_se$glabels)
rect.hclust(got_net_se$cluster,h=20)

This dendrogram does seem to be split up in a way that makes sense. The first partition is Jon Snow + the Others, which makes sense because the Others are almost solely Jon’s plotline. Bran Stark in on his own, and has a unique storyline. The third partition does seem to be more of an ‘and everyone else’ category so it is hard to say much about it other than to be a little surprised that Daenerys Targaryen is in this category. Next, we have Cersei Lannister, also on her own, also uniquely powerful throughout the story. My memory of the plot is not good enough for me to come up with the reason why Robb Stark, Stannis Baratheon, Eddard Stark, and Robert Baratheon are ‘related’ by this measure, but I am unsurprised by it. This next cluster has people I would consider to be powerful BECAUSE they serve more powerful people, whilst managing to appease them even as the people in those more powerful positions change rapidly due to the political upheaval that occurs constantly throughout the novels.

Blockmodeling

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)
}

blk_mod<-blockmodel(sub_stat,got_net_se,k=5)
blk_mod$block.model
           Block 1    Block 2   Block 3   Block 4    Block 5
Block 1 0.01846154 0.02564103 0.2307692 0.1153846 0.23076923
Block 2 0.02564103 0.50000000 1.0000000 0.7291667 0.04166667
Block 3 0.23076923 1.00000000       NaN 1.0000000 0.00000000
Block 4 0.11538462 0.72916667 1.0000000 1.0000000 1.00000000
Block 5 0.23076923 0.04166667 0.0000000 1.0000000 1.00000000
plot.block(blk_mod,main="Game of Thrones Interactions, 5 Partitions", cex.lab=.3)

Since this is an undirected graph, every relationship is mirrored, and there are no self-loops so there is not much that can be said about the relationships themselves that are shown here. As for the blocks, there are a few block that are almost completely full, but even the most empty[Block 2-1 aka Block 1-2] have a few relationships within them.

Roles

sub_stat%v%"role"<-blk_mod$block.membership[match(sub_stat%v%"vertex.names", blk_mod$glabels)]
GGally::ggnet2(sub_stat,
               node.color="role", 
               node.size=sna::degree(sub_stat, gmode="graph"),
               node.label = "vertex.names",
               node.alpha = .5,
               label.size = 2.5)

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY-NC 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Bean (2022, March 12). Data Analytics and Computational Social Science: Assignment6. Retrieved from https://github.com/DACSS/dacss_course_website/posts/httpsrpubscombean22z875971/

BibTeX citation

@misc{bean2022assignment6,
  author = {Bean, Zoe},
  title = {Data Analytics and Computational Social Science: Assignment6},
  url = {https://github.com/DACSS/dacss_course_website/posts/httpsrpubscombean22z875971/},
  year = {2022}
}