开始使用免费开始使用

查找团(II)

做得很好!接下来请找到一个特定的极大团,然后将其绘制出来。

本练习是课程的一部分

Python 网络分析入门

查看课程

练习说明

  • 找出属于最大极大团的作者,并使用 Circos 图绘制该团对应的子图。具体步骤:
    • 使用 nx.find_cliques() 计算图 G 中的极大团。将其放入给定的 sorted() 函数中,以得到"最大"的极大团。
    • 使用 .subgraph() 方法和 largest_clique 创建由最大极大团组成的子图。
    • 使用子图 G_lc(不带其他参数)创建 Circos plot 对象并将其绘制出来。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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()
编辑并运行代码