클리크 찾기 (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()