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.
本练习是课程的一部分
Introduction to Network Analysis in Python
练习说明
- 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 ofGand converting it into a list. - Passing the list of degree distributions to
plt.hist(). - Displaying the histogram with
plt.show().
- Calculating the degree centrality of
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Import necessary modules
import matplotlib.pyplot as plt
import networkx as nx
# Plot the degree distribution of the GitHub collaboration network
____(list(____.____().____()))
____