Circos-Diagramm
Zum Schluss erstellst du ein Circos-Diagramm des Netzwerks!
Diese Übung ist Teil des Kurses
Einstieg in die Netzwerkanalyse mit Python
Anleitung zur Übung
- Erstelle ein Circos-Diagramm des Netzwerks, wieder mit GitHub-Nutzern, sortiert nach ihrem Grad und gruppiert sowie eingefärbt nach ihrem
'grouping'-Schlüssel. Gehe dazu so vor:- Iteriere über alle Knoten in
G, inklusive Metadaten (durch Angabe vondata=True). - Berechne in jeder Iteration den Grad jedes Knotens
nmitnx.degree()und setze sein'degree'-Attribut. - Erzeuge das
circos-Diagrammc, indem du drei Parameter zusätzlich zum GraphenGangibst: das Argumentsort_by, das'degree'ist, sowie die Argumentegroup_byundnode_color_by, die beide'grouping'sind. - Zeichne das
Circos-Diagramm auf den Bildschirm.
- Iteriere über alle Knoten in
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# 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()