])#添加节点2,3
两个命令是不一样的需要注意一下哦
3.添加边
当然边也可以单个添加和多个添加
G.add_edge('x', 'y') # 添加一条边起点为x,终点为y
G.add_edges_from..., , , ]) # 添加节点2,3
G.add_edge('x', 'y') # 添加一条边起点为x,终点为y
G.add_edges_from([(, ), (, ), (, ), (, )])...下面我们来使用一下这些属性,看看会有什么效果。...给节点添加不同的颜色
import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph() # 无多重边无向图
G.add_edges_from...(list_net_nodes)
net_grid.add_edges_from(list_net_edges)
pos = nx.random_layout(net_grid)#随机分布
nx.draw_networkx_nodes