Introduction

The purpose of this lab is to familiarize yourself with calculating closeness centrality and betweeness centrality scores as well as centralization scores for undirected and directed networks in R. Please review the Closeness Centrality and the Betweeness Centrality chapters of the SNA Textbook as well as Tutorial 6 - Closeness Centrality and Centralization in R and Tutorial 7 - Betweenness Centrality and Centralization in R, prior to beginning this lab.

For this lab, we will revisit the networks we used in Lab 3 - Degree Centrality and Centralization.


Part I: Working with an Undirected Network

For this part of the lab you will again use data from Thomas Grund and James Densley’s study of ties among members of an inner-city gang in London, England. The network is undirected, binary ties collected from anonymized arrests data. We will refer to this network as the LondonGangNet. Note that the object is of class network. To coerce the object to be an object of class matrix, use the as.matrix() function.


For the LondonGangNet network, do the following:

  1. Calculate the degree, closeness, and betweenness centrality scores for each actor.
  2. Calculate the standardized degree, closeness, and betweenness centrality scores for each actor.
  3. Calculate the mean degree, closeness, and betweenness centrality score.
  4. Compare the differences for the three mean centrality scores for each measure of centrality.
  5. Calculate the graph centralization for degree, closeness, and betweenness centrality.
  6. Discuss the graph centralization score for closeness centrality.
  7. Discuss the graph centralization score for betweenness centrality.
  8. Compare the differences for the three graph centralization scores for each measure of centrality.
  9. Plot the network three times using the gplot() function where each plot sizes the nodes by the centrality score (i.e. a plot for degree centrality, a plot for closeness centrality, and a plot for betweenness centrality).
  10. Examine the plots. Describe how the differences you noted between the centrality measures above are seen in the plots.


Part II: Working with a Directed Network

For this part of the lab you will again use data from Mangia Natarajan’s study of a large cocaine trafficking organization in New York City. The network is directed, binary ties of communication between individuals collected from police wiretaps of 151 telephone conversations. We will refer to this network as the CocaineDealingNet. Note that the object is of class network. To coerce the object to be an object of class matrix, use the as.matrix() function.


For the CocaineDealingNet network, do the following:

  1. Calculate the indegree, outdegree, closeness, and betweenness centrality scores for each actor.
  2. Calculate the standardized indegree, outdegree, closeness, and betweenness centrality scores for each actor.
  3. Calculate the mean indegree, outdegree, closeness, and betweenness centrality score.
  4. Compare the differences for the four mean centrality scores for each measure of centrality.
  5. Calculate the graph centralization for indegree, outdegree, closeness, and betweenness centrality.
  6. Discuss the graph centralization score for closeness centrality.
  7. Discuss the graph centralization score for betweenness centrality.
  8. Compare the differences for the four graph centralization scores for each measure of centrality.
  9. Plot the network four times using the gplot() function where each plot sizes the nodes by the centrality score (i.e. a plot for indegree centrality, a plot for outdegree centrality, a plot for closeness centrality, and a plot for betweenness centrality).
  10. Examine the plots. Describe how the differences you noted between the centrality measures above are seen in the plots.


Part III:

In Lab 1 you created two networks and in Lab 2 you imported, created a object of class network, and plotted the networks. In Lab 3 you examined degree centrality for your networks. I would like you to continue working with those networks for this part of the lab.

Pick one of your networks and do the following:

  • If the network is undirected, repeat the steps in Part I.

  • If the network is directed, repeat the steps in Part II.



How to Submit

Download the template for this lab prior to beginning the lab. The template contains code for accessing the data files.


Knitting to HTML

When you have completed your assignment, click the “Knit” button to render your .RMD file into a .HTML report.


Special Instructions

Upload both your .RMD and .HTML files to the appropriate link for this assignment on the Canvas page for this course.


Before You Submit

Remember to ensure the following before submitting your assignment.

  1. Name your files using this format: Lab-##-LastName.rmd and Lab-##-LastName.html
  2. Show both the solution for your code and write out your answers in the body text

See Google’s R Style Guide for examples of common conventions.



Common Knitting Issues

.RMD files are knit into .HTML and other formats procedural, or line-by-line.

  • An error in code when knitting will halt the process; error messages will tell you the specific line with the error
  • Certain functions like install.packages() or setwd() are bound to cause errors in knitting
  • Altering a dataset or variable in one chunk will affect their use in all later chunks
  • If an object is “not found”, make sure it was created or loaded with library() in a previous chunk

If All Else Fails: If you cannot determine and fix the errors in a code chunk that’s preventing you from knitting your document, add eval = FALSE inside the brackets of {r} at the beginning of a chunk to ensure that R does not attempt to evaluate it, that is: {r eval = FALSE}. This will prevent an erroneous chunk of code from halting the knitting process.




Please report any needed corrections to the Issues page. Thanks!