当前位置:网站首页>networkx绘制度分布
networkx绘制度分布
2022-07-31 12:47:00 【fK0pS】
networkx绘制度分布
d = nx.degree(g1)
print("网络的度分布为:{}".format(d))d = nx.degree(g1)
print("网络的度分布为:{}".format(d))
degree_sequence = sorted((d for n, d in g1.degree()), reverse=True)
import numpy as np
fig, ax = plt.subplots()
ax.bar(*np.unique(degree_sequence, return_counts=True))
ax.set_title("Degree histogram")
ax.set_xlabel("Degree")
ax.set_ylabel("# of Nodes")
plt.show()
print('plot normal graph finished!')----
Degree Analysis — NetworkX 2.8.5 documentation
import networkx as nx import numpy as np import matplotlib.pyplot as plt G = nx.gnp_random_graph(100, 0.02, seed=10374196) degree_sequence = sorted((d for n, d in G.degree()), reverse=True) dmax = max(degree_sequence) fig = plt.figure("Degree of a random graph", figsize=(8, 8)) # Create a gridspec for adding subplots of different sizes axgrid = fig.add_gridspec(5, 4) ax0 = fig.add_subplot(axgrid[0:3, :]) Gcc = G.subgraph(sorted(nx.connected_components(G), key=len, reverse=True)[0]) pos = nx.spring_layout(Gcc, seed=10396953) nx.draw_networkx_nodes(Gcc, pos, ax=ax0, node_size=20) nx.draw_networkx_edges(Gcc, pos, ax=ax0, alpha=0.4) ax0.set_title("Connected components of G") ax0.set_axis_off() ax1 = fig.add_subplot(axgrid[3:, :2]) ax1.plot(degree_sequence, "b-", marker="o") ax1.set_title("Degree Rank Plot") ax1.set_ylabel("Degree") ax1.set_xlabel("Rank") ax2 = fig.add_subplot(axgrid[3:, 2:]) ax2.bar(*np.unique(degree_sequence, return_counts=True)) ax2.set_title("Degree histogram") ax2.set_xlabel("Degree") ax2.set_ylabel("# of Nodes") fig.tight_layout() plt.show()

边栏推荐
- sqlalchemy 判断一个array 类型的字段是否和一个array有至少一个一致的数据
- Hybrid brain-computer interface system based on steady-state visual evoked potentials and attentional EEG
- 基于生物激励神经网络的室内实时激光SLAM控制方法
- 线性表的基本概念
- NameNode (NN) 和SecondaryNameNode (2NN)工作机制
- 这款悄然崛起的国产API接口管理工具,你一定要晓得
- Fully Dynamically Constrained Robot Efficient Time-Optimal Trajectory Planning
- Json和对象之间转换的封装(Gson)
- JVM 运行时数据区与JMM 内存模型详解
- vivado里那些看不懂的原语
猜你喜欢

PyQt5快速开发与实战10.2 复利计算 && 10.3 刷新博客点击量

go中select语句

CentOS7 installation MySQL graphic detailed tutorial

CentOS7 —— yum安装mysql

电商rpa是什么意思?跟电商rpi是一个意思吗?

How does the SAP ABAP OData service support the $filter (filter) operation trial version
![[CPU Design Practice] Simple Pipeline CPU Design](/img/83/e1dfedfe2b2cfe83a34f86e252caa7.jpg)
[CPU Design Practice] Simple Pipeline CPU Design

Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法

ERROR 1819 (HY000) Your password does not satisfy the current policy requirements

JVM 运行时数据区与JMM 内存模型详解
随机推荐
分布式监视 Zabbix 和 Prometheus 到底怎么选?千万别用错了!
PyQt5快速开发与实战 9.7 UI层的自动化测试
Full GC (Ergonomics)排查分析
Encapsulation of conversion between Json and objects (Gson)
NPM 使用介绍
Architecture Camp | Module 8
Three-Phase PWM Rectifier Predictive Direct Power Control
榕树贷款GPU 硬件架构
跨境电商小知识之跨境电商物流定义以及方式讲解
kernel syscore
Centos7 install mysql5.7 steps (graphical version)
PyQt5快速开发与实战10.2 复利计算 && 10.3 刷新博客点击量
CentOS7 —— yum安装mysql
使用docker搭建mysql主从
LRU缓存[线性表 -> 链表 -> hash定位 -> 双向链表]
imx6ull看门狗使用
栈和队列的基本概念
SAP 电商云 Spartacus UI 和 Accelerator UI 里的 ASM 模块
Indoor real-time laser SLAM control method based on biological excitation neural network
log4j2的使用