Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
294 views
in Technique[技术] by (71.8m points)

Convert networkx graph to dot format in python

I am converting my networkx graph using the following code.

nx.drawing.nx_pydot.write_dot(G,path)

It creates a correct dot format which I can visualize later using graphviz interface. However, instead of adding multiple existing lines(Arcs, edges whatever you say), it creates a single (or two if there is an edge in the opposite direction). I just want to have all lines to be preserved in the dot format. How can I do that?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The creation of Networkx graph in the first place was not correct. I changed the line G=nx.DiGraph(directed=True) to G=nx.MultiDiGraph(directed=True). Now I do not have that problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...