Accounting for vertex size when setting the layout
I just started playing around with graphtool. I can create and draw a twitter graph fairly easily. However, I would like the size of each vertex to be a function of the vertex's degree. I can map the size of each vertex, but then when I use the sfdp layout, there is significant overlap. What is the best way around this? -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
So it looks like draw_graph cannot avoid overlap. I would have to use graphviz_draw which has that capability, however when I use graphviz_draw, depending on the parameters I will often get just a blank canvas unless I set the vertex size ridiculously small. Seeing as there is no error or output from this, I have no idea where the problem stems from. -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 29.03.2016 22:24, Andrew wrote:
So it looks like draw_graph cannot avoid overlap.
Indeed there is no way to completely avoid node overlaps with graph_draw().
I would have to use graphviz_draw which has that capability, however when I use graphviz_draw, depending on the parameters I will often get just a blank canvas unless I set the vertex size ridiculously small. Seeing as there is no error or output from this, I have no idea where the problem stems from.
It is very difficult to know what the problem might be without seeing an example. Cal you please post a minimal, self-contained program that shows the undesired behavior? Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Here is a quick example. I also just noticed I get a warning if overlap='prism'. Thanks for the help. import graph_tool.all as gt #Setup graph g = gt.Graph(directed=False) center = g.add_vertex() for _ in xrange(150): v = g.add_vertex() g.add_edge(v, center) #Set node properties vertex_size = g.new_vertex_property('int32_t') vertex_size.a = 1 vertex_size[center] = 10 # Draw graphs - 5 examples # Ex 1 - All nodes size 1 -> works gt.graphviz_draw(g, vsize=1, output='ex_size1.pdf', overlap='scale') # Ex 2 - All nodes size 4 -> 1 node may be drawn, typically a blank canvas gt.graphviz_draw(g, vsize=4, output='ex_size4.pdf', overlap='scale') # Ex 3 - Large center vertex -> works with 'scale' gt.graphviz_draw(g, vsize=vertex_size, output='ex_scale.pdf', overlap='scale') # Ex 4 - Large center vertex -> blank canvas with False gt.graphviz_draw(g, vsize=vertex_size, output='ex_False.pdf', overlap='False') # Ex 5 - Prism warning -> still draws gt.graphviz_draw(g, output='example_prism.pdf', overlap="prism") # --> Warning: Overlap value "prism" unsupported - ignored # I thought Prism was the default value. Why do I only get this message # if I set it explicitly? -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
participants (2)
-
Andrew -
Tiago de Paula Peixoto