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.
Cet exercice fait partie du cours
Network Analysis in R
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 objectclq
. - Calculate the length of each of the maximal cliques. Use
lapply()
to loop through the objectclq
determining thelength()
of each object in the list. Thenunlist()
and usetable()
to observe how large each of the maximal cliques are.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de 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)))