Get startedGet started for free

Cliques

Identifying cliques is a common practice in undirected networks. In a clique every two unique nodes are adjacent - that means that every individual node is connected to every other individual node in the clique. In this exercise you will identify the largest cliques in the Forrest Gump network. You will also identify the number of maximal cliques of various sizes. A clique is maximal if it cannot be extended to a larger clique.

This exercise is part of the course

Network Analysis in R

View Course

Exercise instructions

  • Identify the largest cliques in the network using the function largest_cliques().
  • Determine all the maximal cliques in the network using the function max_cliques(). Assign the output of this function to the list object clq.
  • Calculate the length of each of the maximal cliques. Use lapply() to loop through the object clq determining the length() of each object in the list. Then unlist() and use table() to observe how large each of the maximal cliques are.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

library(igraph)

# Identify the largest cliques in the network
___(g)

# Determine all maximal cliques in the network and assign to object 'clq'
clq <- ___(g)

# Calculate the size of each maximal clique.
table(unlist(lapply(___, length)))
Edit and Run Code