graphviz_draw() cannot plot loops anymore

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

graphviz_draw() cannot plot loops anymore

Rolf Sander
Hello,

I get a segmentation fault when trying to plot a loop with
graphviz_draw(). Here is a minimal example to reproduce the error:

import graph_tool.all as gt
g = gt.Graph()
v0 = g.add_vertex()
v1 = g.add_vertex()
e01 = g.add_edge(v0,v1)
e11 = g.add_edge(v1,v1) # loop
gt.graphviz_draw(g)

I have version 2.33 of python3-graph-tool installed on my computer which
runs on Linux Mint 19.2 Tina (based on Ubuntu 18.04 LTS, bionic). My
graphviz version is 2.40.1-2.

It works fine if I don't add the loop e11 to the graph.

It works fine if I use gt.graph_draw() instead of gt.graphviz_draw()

It works fine if I use graphviz directly (via a .dot file).

It did work fine in earlier versions of graph_tool.

Can anyone reproduce this?

Best regards
Rolf

--
-----------------------------------------------------------------------
   Rolf Sander                              phone: [+49] 6131/305-4610
   Max-Planck Institute of Chemistry        email: [hidden email]
   PO Box 3060, 55020 Mainz, Germany     homepage: www.rolf-sander.net
-----------------------------------------------------------------------
               https://www.encyclopedia-of-geosciences.net
             https://www.geoscientific-model-development.net
-----------------------------------------------------------------------
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: graphviz_draw() cannot plot loops anymore

Jeff Trull
I can reproduce this.

On Mon, Aug 17, 2020 at 1:29 AM Rolf Sander <[hidden email]> wrote:
Hello,

I get a segmentation fault when trying to plot a loop with
graphviz_draw(). Here is a minimal example to reproduce the error:

import graph_tool.all as gt
g = gt.Graph()
v0 = g.add_vertex()
v1 = g.add_vertex()
e01 = g.add_edge(v0,v1)
e11 = g.add_edge(v1,v1) # loop
gt.graphviz_draw(g)

I have version 2.33 of python3-graph-tool installed on my computer which
runs on Linux Mint 19.2 Tina (based on Ubuntu 18.04 LTS, bionic). My
graphviz version is 2.40.1-2.

It works fine if I don't add the loop e11 to the graph.

It works fine if I use gt.graph_draw() instead of gt.graphviz_draw()

It works fine if I use graphviz directly (via a .dot file).

It did work fine in earlier versions of graph_tool.

Can anyone reproduce this?

Best regards
Rolf

--
-----------------------------------------------------------------------
   Rolf Sander                              phone: [+49] 6131/305-4610
   Max-Planck Institute of Chemistry        email: [hidden email]
   PO Box 3060, 55020 Mainz, Germany     homepage: www.rolf-sander.net
-----------------------------------------------------------------------
               https://www.encyclopedia-of-geosciences.net
             https://www.geoscientific-model-development.net
-----------------------------------------------------------------------
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: graphviz_draw() cannot plot loops anymore

Tiago Peixoto
Administrator
I can also reproduce this, but this code has not been changed in several
years.

I consider graphviz_draw() to be largely deprecated (in favor of
graph_draw()), since the graphviz interface is fairly buggy and
inconvenient.

I'm planning to remove this function altogether in new releases, and I'm
not very inclined to debug it.

Best,
Tiago

Am 17.08.20 um 17:44 schrieb Jeff Trull:

> I can reproduce this.
>
> On Mon, Aug 17, 2020 at 1:29 AM Rolf Sander <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello,
>
>     I get a segmentation fault when trying to plot a loop with
>     graphviz_draw(). Here is a minimal example to reproduce the error:
>
>     import graph_tool.all as gt
>     g = gt.Graph()
>     v0 = g.add_vertex()
>     v1 = g.add_vertex()
>     e01 = g.add_edge(v0,v1)
>     e11 = g.add_edge(v1,v1) # loop
>     gt.graphviz_draw(g)
>
>     I have version 2.33 of python3-graph-tool installed on my computer which
>     runs on Linux Mint 19.2 Tina (based on Ubuntu 18.04 LTS, bionic). My
>     graphviz version is 2.40.1-2.
>
>     It works fine if I don't add the loop e11 to the graph.
>
>     It works fine if I use gt.graph_draw() instead of gt.graphviz_draw()
>
>     It works fine if I use graphviz directly (via a .dot file).
>
>     It did work fine in earlier versions of graph_tool.
>
>     Can anyone reproduce this?
>
>     Best regards
>     Rolf
>
>     --
>     -----------------------------------------------------------------------
>        Rolf Sander                              phone: [+49] 6131/305-4610
>        Max-Planck Institute of Chemistry        email:
>     [hidden email] <mailto:[hidden email]>
>        PO Box 3060, 55020 Mainz, Germany     homepage:
>     www.rolf-sander.net <http://www.rolf-sander.net>
>     -----------------------------------------------------------------------
>                    https://www.encyclopedia-of-geosciences.net
>                  https://www.geoscientific-model-development.net
>     -----------------------------------------------------------------------
>     _______________________________________________
>     graph-tool mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.skewed.de/mailman/listinfo/graph-tool
>
>
> _______________________________________________
> graph-tool mailing list
> [hidden email]
> https://lists.skewed.de/mailman/listinfo/graph-tool
>

--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: graphviz_draw() cannot plot loops anymore

Jeff Trull
I tracked this down and I believe the issue is related to the interpretation of the global variables Agdirected and Agundirected from libgvc. If you replace lines 75 and 76 of graphviz_draw.py from:

        libgv_directed = libgv.Agdirected
        libgv_undirected = libgv.Agundirected 
to:

        libgv_directed = ctypes.c_int.in_dll(libgv, "Agdirected")
        libgv_undirected = ctypes.c_int.in_dll(libgv, "Agundirected")


these values are interpreted correctly (as bit fields, not function pointers) and the test case works again.

Best,
Jeff


On Mon, Aug 17, 2020 at 8:54 AM Tiago de Paula Peixoto <[hidden email]> wrote:
I can also reproduce this, but this code has not been changed in several
years.

I consider graphviz_draw() to be largely deprecated (in favor of
graph_draw()), since the graphviz interface is fairly buggy and
inconvenient.

I'm planning to remove this function altogether in new releases, and I'm
not very inclined to debug it.

Best,
Tiago

Am 17.08.20 um 17:44 schrieb Jeff Trull:
> I can reproduce this.
>
> On Mon, Aug 17, 2020 at 1:29 AM Rolf Sander <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello,
>
>     I get a segmentation fault when trying to plot a loop with
>     graphviz_draw(). Here is a minimal example to reproduce the error:
>
>     import graph_tool.all as gt
>     g = gt.Graph()
>     v0 = g.add_vertex()
>     v1 = g.add_vertex()
>     e01 = g.add_edge(v0,v1)
>     e11 = g.add_edge(v1,v1) # loop
>     gt.graphviz_draw(g)
>
>     I have version 2.33 of python3-graph-tool installed on my computer which
>     runs on Linux Mint 19.2 Tina (based on Ubuntu 18.04 LTS, bionic). My
>     graphviz version is 2.40.1-2.
>
>     It works fine if I don't add the loop e11 to the graph.
>
>     It works fine if I use gt.graph_draw() instead of gt.graphviz_draw()
>
>     It works fine if I use graphviz directly (via a .dot file).
>
>     It did work fine in earlier versions of graph_tool.
>
>     Can anyone reproduce this?
>
>     Best regards
>     Rolf
>
>     --
>     -----------------------------------------------------------------------
>        Rolf Sander                              phone: [+49] 6131/305-4610
>        Max-Planck Institute of Chemistry        email:
>     [hidden email] <mailto:[hidden email]>
>        PO Box 3060, 55020 Mainz, Germany     homepage:
>     www.rolf-sander.net <http://www.rolf-sander.net>
>     -----------------------------------------------------------------------
>                    https://www.encyclopedia-of-geosciences.net
>                  https://www.geoscientific-model-development.net
>     -----------------------------------------------------------------------
>     _______________________________________________
>     graph-tool mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.skewed.de/mailman/listinfo/graph-tool
>
>
> _______________________________________________
> graph-tool mailing list
> [hidden email]
> https://lists.skewed.de/mailman/listinfo/graph-tool
>


--
Tiago de Paula Peixoto <[hidden email]>

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: graphviz_draw() cannot plot loops anymore

Tiago Peixoto
Administrator
Am 17.08.20 um 22:20 schrieb Jeff Trull:

> I tracked this down and I believe the issue is related to the
> interpretation of the global variables Agdirected and Agundirected from
> libgvc. If you replace lines 75 and 76 of graphviz_draw.py from:
>
> libgv_directed = libgv.Agdirected
> libgv_undirected = libgv.Agundirected 
>
> to:
>
>         libgv_directed = ctypes.c_int.in_dll(libgv, "Agdirected")
>         libgv_undirected = ctypes.c_int.in_dll(libgv, "Agundirected")
>
> these values are interpreted correctly (as bit fields, not function
> pointers) and the test case works again.
Thanks for the fix, and the patch in gitlab, which has been merged.

Best,
Tiago


--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: graphviz_draw() cannot plot loops anymore

Rolf Sander
Jeff: Thanks very much for finding and fixing the bug! Plotting loops
works fine for me now.

Tiago: I can understand very well that it is a lot of work to maintain
the two similar functions graphviz_draw() and graph_draw() at the same
time. Still, it would be a pity if graphviz_draw() disappears completely
in future versions of graph-tool. I'm using graphviz_draw() a lot
because it has some features that graph_draw() doesn't have. In
particular, graphviz can put text nicely into oval-shaped vertices.
Cairo, however, produces large circles that hide much of the graph.
Using the vertex property "aspect" is very slow and does not improve the
plots much. Examples are available here:

http://www.rolf-sander.net/tmp/graphviz.pdf
http://www.rolf-sander.net/tmp/cairo.pdf

Best regards
Rolf




--
Sent from: https://nabble.skewed.de/
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: graphviz_draw() cannot plot loops anymore

Tiago Peixoto
Administrator
Am 18.08.20 um 12:38 schrieb Rolf Sander:
> Tiago: I can understand very well that it is a lot of work to maintain
> the two similar functions graphviz_draw() and graph_draw() at the same
> time. Still, it would be a pity if graphviz_draw() disappears completely
> in future versions of graph-tool. I'm using graphviz_draw() a lot
> because it has some features that graph_draw() doesn't have. In
> particular, graphviz can put text nicely into oval-shaped vertices.
> Cairo, however, produces large circles that hide much of the graph.
> Using the vertex property "aspect" is very slow and does not improve the
> plots much. Examples are available here:

Indeed, we still need some form of non-overlapping heuristics in
graph_draw().

I'll leave graphviz_draw() for the time being.

Best,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: graphviz_draw() cannot plot loops anymore

Rolf Sander
> I'll leave graphviz_draw() for the time being.

Thanks, Tiago!

Best regards
Rolf



--
Sent from: https://nabble.skewed.de/
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool