What is in your graph K?
It works for me with this configuration:
In [1]: import networkx
In [2]: G=networkx.path_graph(4)
In [3]: networkx.pydot_layout(G,prog='twopi',root=0)
Out[3]: {0: (28.0, 19.0), 1: (28.0, 91.0), 2: (28.0, 163.0), 3: (28.0, 235.0)}
In [4]: networkx.__version__
Out[4]: '1.0.dev1487'
In [5]: import pydot
In [6]: pydot.__version__
Out[6]: '1.0.2'
In [7]: !dot -V
dot - Graphviz version 2.20.2 (Wed Sep 16 11:12:21 UTC 2009)
Aric
I checked in what I hope is a fix:
https://networkx.lanl.gov/trac/changeset/1490
Aric
Might be a bug - here are some things to try:
In [1]: import networkx
In [2]: import pydot
In [3]: G=networkx.MultiGraph()
In [4]: G.add_edge(1,2,foo='bar')
In [5]: G.add_edge(1,2,foo='baz')
In [6]: P=networkx.to_pydot(G) # convert to pydot object
In [7]: D=P.create_dot() # dot-file as a string (with positions)
In [8]: D
Out[8]: 'graph G {\n\tnode [label="\\N"];\n\tgraph
[bb="0,0,54,112"];\n\t1 [pos="27,93", width="0.75",
height="0.51389"];\n\t2 [pos="27,19", width="0.75",
height="0.51389"];\n\t1 -- 2 [key=0, foo=bar, pos="21.084,74.708
19.965,63.238 19.972,48.512 21.105,37.082"];\n\t1 -- 2 [key=1,
foo=baz, pos="32.916,74.708 34.035,63.238 34.028,48.512
32.895,37.082"];\n}\n'
In [9]: Q=pydot.graph_from_dot_data(D) # convert back to pydot object
In [11]: Q.get_node('1').get_pos() # position of node 1
Out[11]: '"27,93"'
In [12]: Q.get_node('1').get_pos()[1:-1] # quotes stripped
Out[12]: '27,93'
Aric