Get startedGet started for free

Finding cliques (II)

Great work! Let's continue by finding a particular maximal clique, and then plotting that clique.

This exercise is part of the course

Introduction to Network Analysis in Python

View Course

Exercise instructions

  • Find the author(s) that are part of the largest maximal clique, and plot the subgraph of that/one of those clique(s) using a Circos plot. To do this:
    • Use the nx.find_cliques() function to calculate the maximal cliques in G. Place this within the provided sorted() function to calculate the largest maximal clique.
    • Create the subgraph consisting of the largest maximal clique using the .subgraph() method and largest_clique.
    • Create the Circos plot object using the subgraph G_lc (without any other arguments) and plot it.

Hands-on interactive exercise

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

# Import necessary modules
import networkx as nx
from nxviz import circos
import matplotlib.pyplot as plt

# Find the author(s) that are part of the largest maximal clique: largest_clique
largest_clique = sorted(____, key=lambda x:len(x))[-1]

# Create the subgraph of the largest_clique: G_lc
G_lc = ____

# Create the Circos plot: c
c = ____

# Draw the Circos plot to the screen
____
plt.show()
Edit and Run Code