2

I recently saw this answer: Matplotlib and Networkx - drawing a self loop node

And tried the code for drawing an undirected multigraph:

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')

However, the result from the code is this:

enter image description here

It only shows one edge from A to C. How can I make it show the three edges?

davidaap
  • 1,569
  • 1
  • 18
  • 43
  • Voting to close as not reproducible. Running your code verbatim shows this: https://i.stack.imgur.com/FGgxu.png I'm using networkx v2.4 and pygraphviz 1.5. – wim Apr 17 '20 at 19:24
  • Does this answer your question? [how to draw multigraph in networkx using matplotlib or graphviz](https://stackoverflow.com/questions/14943439/how-to-draw-multigraph-in-networkx-using-matplotlib-or-graphviz) – mkrieger1 Apr 17 '20 at 19:25
  • @wim it's weird... I am also using those versions of networkx and pygraphviz and still get the graph shown. – davidaap Apr 17 '20 at 22:47

0 Answers0