Have the nodes spread apart in graph_draw output

dear all,

I have an attributed graph and want to display it using graph_draw. You can see the result I obtain in the attached PDF file. It is hardly readable,
and still there is a lot of empty space in the PDF page. The command I used is the following:

graph_draw(g, vertex_text=labelv, output_size=(2000,2000), vertex_fill_color=typev, edge_text=labele, output="test.pdf")

How can I get the vertices spread apart in order to increase readability?

Additional question: there must be some random part in graph_draw because every time I run it I get a completely different visual representation.
Is there some way to insure that I get the same (or very close, if the data have changed slightly) output between two runs?

Thanks in advance

Yannis (not Panagis but Haralambous :slight_smile:

test.pdf (98.7 KB)

dear all,

I have an attributed graph and want to display it using graph_draw. You can see the result I obtain in the attached PDF file. It is hardly readable,
and still there is a lot of empty space in the PDF page. The command I used is the following:

graph_draw(g, vertex_text=labelv, output_size=(2000,2000), vertex_fill_color=typev, edge_text=labele, output="test.pdf")

How can I get the vertices spread apart in order to increase readability?

Graph_draw() does not attempt to remove vertex overlaps. One option is
to use the graphviz_draw() function, that uses graphviz to do the
layout, which has the possibility of avoiding vertex overlaps.

Additional question: there must be some random part in graph_draw because every time I run it I get a completely different visual representation.
Is there some way to insure that I get the same (or very close, if the data have changed slightly) output between two runs?

From the graph_draw() documentation:

    pos : PropertyMap (optional, default: None)

        Vector-valued vertex property map containing the x and y
        coordinates of the vertices. If not given, it will be computed
        using sfdp_layout().

So, if you do not specify the positions by hand, they are computed via
the sfdp_layout(), which starts from a random configuration. If you want
to preserve the same position across runs, you have to compute the
positions once, and pass them every time as the "pos" parameter.

Best,
Tiago