4.5 Import data into software

After all these explorations in the past weeks, it’s time to play with some SNA data and generate some graphs!!

Open Dataset: Les Miserables, containing co-appearance weighted network of characters in the novel Les Miserables. Note: The dataset is the 5th on the page.

Two Tracks. To accommodate your learning preferences, I provide two tracks of learning based on what SNA software you wish to learn.

  • R is a statistical language that involves a little bit of coding. It may have a steep learning curve if you’ve never coded before, but I believe everyone of us can learn it and the benefits of knowing R is huge. So I recommend R in this course.
  • Gephi is a wonderful SNA software package coming with a graphical user interface. If you’re more comfortable with tools like MS Word or SPSS, and if you’ll never want to try R, it would be a good option for you. There are many similar software applications out there, many of which you’ve already encountered in readings. You can use them, but they’re not officially supported in the class.

If you have questions, please post in the home channel.

4.5.1 Track R

If you’ve not used R before, please take Module 1 of this free course on Introduction to R. If you have questions, post them in the home channel or DM Bodong.

Below are R codes to get you started. I’ve invited you all to an RStudio Cloud space where you can open a project named Week 4, which has the R code for you to get started. See the screenshot below.

You can go far beyond the codes. And make sure you share what you make to our Slack assignment channel.

# Load igraph
library(igraph)

# Read data
lesmis <- read.csv("https://raw.githubusercontent.com/meefen/sna-ed/master/assets/lesmis/lesmis.csv")
# check the head (first 6 rows) of the dataset
head(lesmis)

# Create a graph using the graph_from_data_frame function
g <- graph_from_data_frame(lesmis)

# Plot the graph
plot(g)
# make the graph a little prettier
plot(g, edge.arrow.size=.2, vertex.label=NA, vertex.size=8)

Below is a great video made by James Cook (a professor from University of Maine) that would be helpful as well.

4.5.2 Track Gephi

To begin, download the .gml file directly from the dataset page. You can directly open this .gml file using Gephi.

Follow this really nice tutorial on network visualization and analysis with Gehpi. You only need to get through the first 10 minutes. Given the nature of the dataset, you may want to filter edges to leave out those edges with a weight of 0.

Like folks from Track R, please share what you make to our Slack assignment channel.