import matplotlib.pyplot as plt #导入科学绘图的matplotlib包 degree = nx.degree_histogram(G) #返回图中所有节点的度分布序列 x = range(len(degree)) #生成x轴序列,从1到最大度 y = [z / float(sum(degree)) for z in degree] #将频次转换为频率,这用到Python的一个小技巧:列表内涵,Python的确很方便:) plt.loglog(x,y,color="blue",linewidth=2) #在双对数坐标轴上绘制度分布曲线 plt.show() #显示图表
Degree centrality measures.(点度中心性?) degree_centrality(G) Compute the degree centrality for nodes. in_degree_centrality(G) Compute the in-degree centrality for nodes. out_degree_centrality(G) Compute the out-degree centrality for nodes.
Current-flow betweenness centrality measures.(流介数中心性?) current_flow_betweenness_centrality(G[, ...]) Compute current-flow betweenness centrality for nodes. edge_current_flow_betweenness_centrality(G) Compute current-flow betweenness centrality for edges.
Eigenvector centrality.(特征向量中心性?) eigenvector_centrality(G[, max_iter, tol, ...]) Compute the eigenvector centrality for the graph G. eigenvector_centrality_numpy(G) Compute the eigenvector centrality for the graph G.