Download the Politics Books network (http://www-personal.umich.edu/~mejn/netdata/polbooks.zip (Links to an external site.)Links to an external site.).
It is a network of books about US politics published around the time of the 2004 presidential election and sold by the online bookseller Amazon.com. Edges between books represent frequent co-purchasing of books by the same buyers. Read more about the dataset in the description file.
Q1. Calculate the assortativity for the values attribute of the nodes. Then calculate the degree assortativity. What is your conclusion?
Q2. Create a data frame with four columns: the political view of the book, the degree of the book, the betweenness centrality of the book, and the closeness centrality of the book. Each row represents a book (node). For each political view, find the average degree, betweenness, and closeness centrality of the books. What is your conclusion?
Hint: Start with
node_centrality <- data.frame(politics=V(g)$value,
degree=degree(g),
betweenness=betweenness(g),
closeness=closeness(g))

WhatsApp us