LoslegenKostenlos loslegen

Finding cliques (II)

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

Diese Übung ist Teil des Kurses

Introduction to Network Analysis in Python

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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()
Code bearbeiten und ausführen