Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop vertices from overlapping each other when drawing using graph-tool

I am using graph-tool on Python 3.5.1. I have a graph of words, with edges between words that rhyme. When I use graph-tool's draw function, it causes all the vertices to overlap if I make the vertices too large, but if they are too small, I must make the font smaller, and then it is illegible. Is there any way of setting a minimum edge length or forcing the vertices not to overlap?

Code sample:

import graph_tool.all as gt

G = gt.load_graph("G.gt")
gt.graph_draw(G, vertex_text=G.vertex_properties.word, vertex_font_size=10, output_size=(1000, 1000), output="G.png", vertexsize=10)

See image here

like image 284
Bretsky Avatar asked Oct 30 '22 02:10

Bretsky


1 Answers

Have you tried using graphviz_draw? It has an overlap setting where you can tell the software to prevent vertices from touching. The syntax is different for the function so you may need to do some searching but if you look at the graphviz documentation linked in the graph-tool manual you should be able to find all your attributes (http://www.graphviz.org/doc/info/attrs.html ).

like image 114
P-M Avatar answered Nov 15 '22 05:11

P-M