Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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:

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") 

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