Network Analysis Part 3 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.

star-graph

This is the third set of exercises on networks in which we practice the functions for graph structure, using package igraph. The first and second part are available here:

Part 1
Part 2

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 interview on question: “Do you like to work with your co-worker?”. Possible answers are 1 for yes and 0 for no. Each employee gave answer for each other employee thus creating adjacency matrix. You can download data set from here.

Exercise 1

Load the data and create un-directed graph from adjacency matrix. Name nodes as letters A to Y. Set node color to orange and shape to square. Set edge’s color to blue and arrow size to 0.2. Plot the graph.

Exercise 2

Find the largest cliques in the group.

Exercise 3

How many maximal cliques are there?

Exercise 4

Calculate the network cohesion.

Exercise 5

Find the clusters based on betweenness.

Exercise 6

Find the components of a graph.

Exercise 7

Find the loop edges.

Exercise 8

How many triangles are there in the graph? In how many of them is vertex S included?

Exercise 9

What is the global clustering coefficient of this network? Can we say that clustering is statistically significant for this network.Tip: in order to determine if clustering coefficient is significant, it should be much larger than the random network with the same number of vertices and edges.

Exercise 10

Create and draw the following types of networks:

  • Random with 10 nodes and probability of an edge of 0.4 (Erdos-Renyi random graph)
  • Full un-directed graph with 15 nodes
  • Star network with 20 nodes
  • Directed ring network with 15 nodes and mutual edges

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)