You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
weight = 0 raises IOError (migrated from Trac #150) #152
I'm trying to create a basic directed graph like this one:
'''
from pygraphviz import *
A=AGraph(directed=True)
A.add_edge(1,2)
A.add_edge(2,3)
A.add_edge(1,3)
A.add_edge(3,4)
A.add_edge(3,5)
A.add_edge(3,6)
A.add_edge(4,6)
A.add_edge(6,4)
edge=A.get_edge(4,6)
edge.attr['weight']='0' # this makes the IOError show up
B = A.add_subgraph([4,6],name='s1')
B.graph_attr['rank'] = 'same'
print A.string() # print to screen
A.layout()
A.draw('simple.png',prog='dot') # draw png
'''
I add the weight=0 attribute to the 6 -> 4 edge. But when I run the script:
'''
Traceback (most recent call last):
File "sub.py", line 19, in ?
A.draw('simple.png',prog='dot') # draw png
File "/var/lib/python-support/python2.4/pygraphviz/agraph.py", line 1296, in draw
data=self._run_prog(prog,args)
File "/var/lib/python-support/python2.4/pygraphviz/agraph.py", line 1147, in _run_prog
raise IOError("".join(errors))
IOError
'''
But in the DOT docs, the weight attribute can have a minumum value of 0 if using the dot renderer. I know it's not that that much useful, but it's a surprising error.
Activity
networkx-trac commentedon Jul 20, 2012
Comment in Trac by @hagberg, 2008-03-18
I'm getting a different error (trouble in init_rank).
If you save the dot file and run 'dot' on it you'll see
that graphviz is failing. This may be a known bug in graphviz
https://mailman.research.att.com/pipermail/graphviz-interest/2006q3/003775.html
'''
$ cat foo.dot
strict digraph {
subgraph s1 {
graph [rank=same];
4 -> 6 [weight=0];
6 -> 4;
}
1 -> 2;
1 -> 3;
2 -> 3;
3 -> 4;
3 -> 5;
3 -> 6;
4 -> 6 [weight=0];
6 -> 4;
}
$ dot -Tps foo.dot >foo.ps
Error: trouble in init_rank
5 1
virtual 1
Bus error
'''
networkx-trac commentedon Jul 20, 2012
Comment in Trac by @hagberg, 2008-05-27
networkx-trac commentedon Jul 20, 2012
Comment in Trac by @hagberg, 2009-02-08