Edge ordering for use with graph attribute 'ordering'

95 views
Skip to first unread message

Greg

unread,
Oct 3, 2010, 3:15:47 AM10/3/10
to pygraphviz-discuss
Hi Everyone,

Is there any way to specify an ordering on the edges? I'm trying to
make use of the 'ordering=out' attribute, but when adding edges to an
instance of AGraph(), there does not seem to be a way to guarantee the
order in which they appear in the dot file.

Is there any way to do this?

Regards,
-Greg-

Aric Hagberg

unread,
Oct 3, 2010, 7:30:37 AM10/3/10
to pygraphvi...@googlegroups.com

I thought the order was supposed to be the order of addition to the graph.
But this ticket, https://networkx.lanl.gov/trac/ticket/300 , shows
that isn't true.

I thought this was a Graphviz issue but it could be a Pygraphviz bug too
(which I don't know how to fix).

Aric

Greg

unread,
Oct 4, 2010, 11:48:50 AM10/4/10
to pygraphviz-discuss
You're right, it looks like the cause is libcgraph is using
dictionaries from libcdt for storing edges.

Maybe there could be an "order=<n>" optional argument passed to
add_edge? Or an "ordered=True" flag passed to AGraph upon creation?

I would enjoy implementing something like this, how would I go about
discussing it and the submitting the patch?

-Greg-

On Oct 3, 7:30 am, Aric Hagberg <ahagb...@gmail.com> wrote:
> On Sun, Oct 3, 2010 at 1:15 AM, Greg <borisb0...@gmail.com> wrote:
> > Hi Everyone,
>
> > Is there any way to specify an ordering on the edges? I'm trying to
> > make use of the 'ordering=out' attribute, but when adding edges to an
> > instance of AGraph(), there does not seem to be a way to guarantee the
> > order in which they appear in the dot file.
>
> > Is there any way to do this?
>
> I thought the order was supposed to be the order of addition to the graph.
> But this ticket,https://networkx.lanl.gov/trac/ticket/300, shows

Aric Hagberg

unread,
Oct 6, 2010, 9:04:41 AM10/6/10
to pygraphvi...@googlegroups.com
On Mon, Oct 4, 2010 at 9:48 AM, Greg <boris...@gmail.com> wrote:
> You're right, it looks like the cause is libcgraph is using
> dictionaries from libcdt for storing edges.
>
> Maybe there could be an "order=<n>" optional argument passed to
> add_edge? Or an "ordered=True" flag passed to AGraph upon creation?

I don't think that could work. Pygraphviz stores the data using libcgraph
and the dot file is written by libcgraph too. So there is no way to influence
the output order in the dot file from Pygraphviz.

If libcgraph is supposed to output nodes and edges to the dot file in
the order they were added then there is either a bug in libcgraph or
pygraphviz. If you can reproduce the bug using a little bit of c code
and libcgraph
the Graphviz team might be able to fix it (post bug at graphviz.org).
If it works correctly with a c program then it's a Pygraphviz bug and we should
be able to fix that.

Aric

Reply all
Reply to author
Forward
0 new messages