I am trying to draw a 100 node multi-graph G in graphviz layout in python's networkx so I made two trials so far:
Trial 1 nx.draw_graphviz function as follows nx.draw_graphviz(G)
but I get the following error repeated for all nodes in the graph:
Error: node 1, position [0.127506302389087, 0.3262608552621944], expected two doubles
Then trying to figure a solution I used trial 2 A=nx.to_agraph(G)
to get a pygraphviz graph but when I try to draw with nx.draw_graphviz(A)
I get the following Error:
AttributeError: 'AGraph' object has no attribute 'number_of_selfloops'
nx.graphviz_layout but it gives back a dictionary of positions keyed by nodes, and I do not know how to use it to draw the graphviz layout.
Note I imported graphviz, pygraphviz and pydot modules but I do not know which are the ones really needed for this, but it still does not work.
Is there something missing there to draw the networkx graph in graphviz layout ?
Full Trace of errors for
Trial 1
Traceback (most recent call last):
File "main.py", line 102, in <module>
d.display_graph(sub_normal,NEUTRAL_RANGE)
File "/home/abdallah/stage/Reputation_system/display.py", line 33, in display_graph
nx.draw_graphviz(G)
File "/usr/local/lib/python2.7/dist-packages/networkx-1.10-py2.7.egg/networkx/drawing/nx_pylab.py", line 982, in draw_graphviz
pos = nx.drawing.graphviz_layout(G, prog)
File "/usr/local/lib/python2.7/dist-packages/networkx-1.10-py2.7.egg/networkx/drawing/nx_pydot.py", line 257, in graphviz_layout
return pydot_layout(G=G,prog=prog,root=root,**kwds)
File "/usr/local/lib/python2.7/dist-packages/networkx-1.10-py2.7.egg/networkx/drawing/nx_pydot.py", line 277, in pydot_layout
D=P.create_dot(prog=prog)
File "/usr/lib/python2.7/dist-packages/pydot.py", line 1802, in <lambda>
lambda f=frmt, prog=self.prog : self.create(format=f, prog=prog))
File "/usr/lib/python2.7/dist-packages/pydot.py", line 2023, in create
status, stderr_output) )
pydot.InvocationException: Program terminated with status: 1. stderr follows: Error: node 0, position [0.7145101895899024, 0.9016482786797262], expected two doubles
trial 2
Traceback (most recent call last):
File "main.py", line 102, in <module>
d.display_graph(sub_normal,NEUTRAL_RANGE)
File "/home/abdallah/stage/Reputation_system/display.py", line 33, in display_graph
nx.draw_graphviz(A)
File "/usr/local/lib/python2.7/dist-packages/networkx-1.10-py2.7.egg/networkx/drawing/nx_pylab.py", line 982, in draw_graphviz
pos = nx.drawing.graphviz_layout(G, prog)
File "/usr/local/lib/python2.7/dist-packages/networkx-1.10-py2.7.egg/networkx/drawing/nx_pydot.py", line 257, in graphviz_layout
return pydot_layout(G=G,prog=prog,root=root,**kwds)
File "/usr/local/lib/python2.7/dist-packages/networkx-1.10-py2.7.egg/networkx/drawing/nx_pydot.py", line 273, in pydot_layout
P=to_pydot(G)
File "/usr/local/lib/python2.7/dist-packages/networkx-1.10-py2.7.egg/networkx/drawing/nx_pydot.py", line 192, in to_pydot
strict=N.number_of_selfloops()==0 and not N.is_multigraph()
AttributeError: 'AGraph' object has no attribute 'number_of_selfloops'