Dot directed graph specify length of edges

I just started using graphviz and I use a custom Matlab script to parse our data
into a .gv file.

The preferred Layout engine would be dot and it works quite fine, but it would be very nice to
also show, that some edges are longer than others (or the nodes are further away from the primary node).
As far as I know, the dot engine only allows to rank the nodes, so they are rendered some distance from
the primary node. Unfortunately, all nodes (there can be up to 5000) have a different distance from
the primary node, so I would have to specify a new rank for every single one.

Does anyone know a way around that, other than using neato of fdp?
Let me know you need to know more details, or an example graph.


I'm not exactly sure of your

I'm not exactly sure of your constraints, but if you really want each node a different distance from a fixed node, you would need to specify this via the minlen attribute for one edge (visible or not) between the root node and the given node. As the ranks are distinct, that would create a very tall drawing. You would need to do the same with the len attribute in neato or fdp, but the drawing would be more compact, partly because the edge length constraints in neato and fdp are soft, while in dot they are hard, and directed edges are not required to all go down.

Also, keep in mind that the ranking in dot is transitive, so if you have a->b and b->c, b will be below a and c will be below b regardless of the minlen attribute (barring cycles).

You might also consider bucketing the nodes, so that, say, all nodes whose distance from the root is between 100 and 200 can be on the same level. Or you could color the edges to indicate the relative lengths. Finally, mode=ipsep in neato can br used to encode directionality constraints and edge lengths, but without using discrete ranks.

If you could explain a bit more as to what you want, I might be able to offer other possibilities.

Recent comments