python - "TypeError: 'in <string>' requires string as left operand, not int" when using graphviz dot layout -
i'm trying use pygraphviz' dot layout networkx. error
file "c:\users\msi\anaconda3\lib\site-packages\pyparsing.py", line 1028, in preparse while loc < instrlen , instring[loc] in wt: typeerror: 'in <string>' requires string left operand, not int
could graphviz not work python 3. i'm using?
here code:
import networkx nx import matplotlib.pyplot plt g=nx.digraph() n = [1,2,3,4,5,6,7,8,9,10,11,12,13,14] e = [(1,2),(1,3),(2,4),(2,5),(3,6),(3,7), (8,9),(8,10),(9,11),(9,12),(10,13),(10,14),(7,8)] g.add_nodes_from(n) g.add_edges_from(e) pos=nx.graphviz_layout(g,prog='dot') nx.draw(g, pos=pos, with_labels=true) plt.show()
Comments
Post a Comment