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:
and load it into the session using the following code:
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.
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.
Find the largest cliques in the group.
How many maximal cliques are there?
Calculate the network cohesion.
Find the clusters based on betweenness.
Find the components of a graph.
Find the loop edges.
How many triangles are there in the graph? In how many of them is vertex
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.
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
- Become a Top R Programmer Fast with our Individual Coaching Program
- Explore all our (>4000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below