有
向
图
,无
向
图
,网络
图
,加入权重。
import matplotlib.pyplot as plt
import
networkx
as nx
H = nx.path_graph(10)
G.add_nodes_from(H)
nx.draw
0, 1, 2, 3])
nx.add_cycle(G, [10, 11, 12], weight=7)
nx.draw(G, with_labels=True)
plt.show()
import
networkx
(G, pos, node_size=700)
nx.draw_
networkx
_edges(G, pos, edgelist=elarge,
width
='b', style='dashed')
nx.draw_
networkx
_labels(G, pos, font_size=20, font_family='sans-serif')
plt.axis
('off')
plt.show()
from __future__ import division
import matplotlib.pyplot as plt
import
networkx
as