Python networkx,如何改变节点大小?

问题描述

我有一个简单的配置模型,我想更改图中节点的大小。

我的代码是:

import networkx as nx
import matplotlib.pyplot as plt
hosts = 100
H=nx.configuration_model([2]*hosts)
nx.draw_random(H)

enter image description here

我尝试包含 node_size 但这是未定义的,我收到错误

TypeError: configuration_model() got an unexpected keyword argument 'node_size'

如何更改节点的大小?

非常感谢。

解决方法

node_size 中使用 draw_random 参数

nx.draw_random(H,node_size=100)

enter image description here