Circos plot
आखिर में, आप नेटवर्क का एक Circos plot बनाएँगे!
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में नेटवर्क विश्लेषण का परिचय
अभ्यास निर्देश
- नेटवर्क का Circos plot बनाएँ, जिसमें GitHub users को उनके degree के अनुसार sort किया गया हो, और
'grouping'key के आधार पर group और color किया गया हो. ऐसा करने के लिए:Gके सभी nodes पर, metadata सहित, iterate करें (इसके लिएdata=Truespecify करें).- लूप की हर iteration में,
nx.degree()से प्रत्येक nodenका degree निकालें और उसका'degree'attribute सेट करें. - ग्राफ
Gके अलावा तीन parameters specify करकेcircosplotcबनाएँ:sort_byआर्ग्युमेंट, जो'degree'है, औरgroup_byतथाnode_color_byआर्ग्युमेंट्स, जो दोनों'grouping'हैं. Circosplot को स्क्रीन पर draw करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import necessary modules
from nxviz import circos
import matplotlib.pyplot as plt
# Iterate over all the nodes, including the metadata
for n, d in ____:
# Calculate the degree of each node: G.node[n]['degree']
____ = ____
# Create the Circos plot: c
c = ____
# Draw the Circos plot to the screen
____
plt.show()