is this a valid graph for graphviz?

dot read this gv file and produced a layout that is quite difficult to read and grasp.
is that because this graph topology is unsuitable for graphviz?

thanks much


inspire1.txt11.13 KB

This graph is tricky to draw

This graph is tricky to draw well because it is fairly dense (138 edges with only 16 nodes) with lots of backedges plus all of the edge labels. There are various ways you can tweak the graph to get better, or at least, different drawings.

By default, dot treats edge labels as a type of node. For graphs that are faily dense, you end up with lots of twists and turns. You might try changing the labels to xlabels, so they will be placed after the edges are routed.

WIth the fairly long edge labels, it is sometimes cleaner to use a left-right layout, so you could try rankdir=LR.

You can also add more space by setting nodesep and ranksep.

Reducing the fontsize of the edge labels may also help.

You might also try using splines=ortho (but only with xlabels).

For example, the following pipeline will use the first three suggestions:

  gvpr -c 'E{$.xlabel=$.label;$.label="";}' inspire1.txt | dot -Grankdir=LR -Granksep=1 -Tpdf > out.pdf

Is there a natural linear order or partial order to the nodes? If so, you should use this order for declaring the nodes. Also, if there are back edges in this order, it might be helpful to flip the order of these edges and use dir=back. During layout, dot has to decide which edges to reverse using heuristics. If you can provide this explicitly, you'll get a better layout.

Recent comments