Skip to content

weight = 0 raises IOError (migrated from Trac #150) #152

Closed

Description

@networkx-trac

Original ticket https://networkx.lanl.gov/trac/ticket/150
Reported 2008-03-18 by trac user steko, assigned to @hagberg.

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

  1. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    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
    '''

  2. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Comment in Trac by @hagberg, 2008-05-27

  3. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Comment in Trac by @hagberg, 2009-02-08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions