LoslegenKostenlos loslegen

Characterizing the network (II)

Let's continue recalling what you've learned before about node importances, by plotting the degree distribution of a network. This is the distribution of node degrees computed across all nodes in a network.

Diese Übung ist Teil des Kurses

Introduction to Network Analysis in Python

Kurs anzeigen

Anleitung zur Übung

  • Plot the degree distribution of the GitHub collaboration network G. Recall that there are four steps involved here:
    • Calculating the degree centrality of G.
    • Using the .values() method of G and converting it into a list.
    • Passing the list of degree distributions to plt.hist().
    • Displaying the histogram with plt.show().

Interaktive Übung

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

# Import necessary modules
import matplotlib.pyplot as plt
import networkx as nx

# Plot the degree distribution of the GitHub collaboration network
____(list(____.____().____()))
____
Code bearbeiten und ausführen