[graph-tool] Hacking sfdp to properly show large graphs

Tiago de Paula Peixoto tiago at skewed.de
Tue Feb 7 18:14:20 CET 2017

On 06.02.2017 22:13, gogurt wrote:
> Hi all,
> I'm trying to visualize some large (>100k vertices) graphs using graph-tool,
> but I'm having trouble getting a good picture with the sfdp layout. I'm
> unsure about is whether this is due to me not knowing how to use
> sfdp_layout(), or whether it's just impossible lay out large graphs
> efficiently due to the topology.
> Here's a sample graph of what I'm talking about. I'm uploaded it in xml
> format here: https://www.dropbox.com/s/5zg4u9re9rw6s4y/test.xml.gz?dl=0
> It's about 100k vertices and max degree ~ 2400 and average degree ~ 7.8.
> Obviously, this will be hard to graph. Anyway, when I draw the graph using
> the standard method:
> pos = gt.sfdp_layout(G)
> gt.graph_draw(G, pos=pos)
> Then I get a graph that looks like this:
> <http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/file/n4026993/test.png> 
> The vertices are tiny. Which makes sense, because otherwise with the If I
> increase the vertex size by supplying vprops={'size': 2} (for example) to
> gt.graph_draw(), then I just get a huge blob.
> My question: is it possible to force sfdp to space out the vertices more so
> that I can increase the vertex size *and* have them not all coalesce into
> one giant blob?

Visualization of very large graphs is tricky. Note that if you have 100k
vertices, and if you lay them side by side, each occupying one pixel, you
already have a (useless) 316x316 image. If you increase this to 1000x1000,
you still do not have sufficient space to have the vertices not lying on top
of each other in a meaningful way.

But to answer your question more directly: No, graph-tool is not very smart
about node overlaps. The SFDP algorithm does not currently take into account
the size of the vertices.


Tiago de Paula Peixoto <tiago at skewed.de>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.skewed.de/pipermail/graph-tool/attachments/20170207/d61ccd1f/attachment.asc>

More information about the graph-tool mailing list