Network Analysis Part 2 Exercises

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

diameterIn this set of exercises we shall practice the functions for network statistics, using package igraph.If you don’t have package already installed, install it using the following code:

install.packages("igraph")

and load it into the session using the following code:

library("igraph")

before proceeding. You can find more info about the package and graphs in general here

Answers to the exercises are available here.

If you have different solution, feel free to post it.

A number of employees in a factory was interviewed on a question: “Do you like to work with your co-worker?”. Possible answers are 1 for yes and 0 for no. Each employee gave an answer for each other employee thus creating an adjecancy matrix. You can download the dataset from here.

Exercise 1

Load the data and create an unweighted directed graph from the adjecancy matrix. Name the nodes as letters A to Y. Set node color to yellow and shape to sphere. Set the edge’s color to gray and arrow size to 0.2.

Exercise 2

Plot the graph.

Exercise 3

Calculate network diameter and average closeness.

Exercise 4

Calculate average network betweenness.

Exercise 5

Calculate network density and average degree.

Exercise 6

Calculate network reciprocity and average transitivity.

Exercise 7

Calculate average eccentricity of the vertices. What is the average distance between two nodes?

Exercise 8

Find the hubs and plot graph with node’s size according to their hubs index. Which employee is the biggest hub?

Exercise 9

Find the authorities and plot graph with node’s size according to their authority index. Which employee is the biggest authority?

Exercise 10

Show the nodes that make diameter. Plot these nodes larger and in red. Plot edges on this path thicker in red.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)