如何使用Networkx绘制多个边缘

时间:2020-04-17 19:12:11

标签: python-3.x networkx

我最近看到了这个答案:Matplotlib and Networkx - drawing a self loop node

并尝试了用于绘制无向多图的代码:

from networkx.drawing.nx_agraph import to_agraph 
G = nx.MultiGraph()
G.add_edges_from([('A','C'),('A','C'),('A','C'), ('C', 'C'), ('B', 'C'), ('A', 'B')])
G.graph['edge'] = {'splines': 'curved'}
G.graph['graph'] = {'scale': '3'}
A = to_agraph(G) 
A.layout('dot')                                                                 
A.draw('images/multigraph_example.png')

但是,代码的结果是这样的:

enter image description here

它仅显示从AC的一条边。如何使它显示三个边缘?

0 个答案:

没有答案