subgraph layout in dot


We run a biography system which generates family trees using dot (graphviz 2.36.0) and I have a query about an odd line crossing/layout problem.

I don't understand why dot generates the layout it does (see for the attached dot file as it's usually quite good at generating balanced hierarchical graphs. The lines shouldn't cross as Annie Bertha Fraser (node 19712) is the tail node of her siblings, as is Amy Woolf (node 19664) - dot seems to want to transpose each siblings group's positions (each sibling group is a subgraph). Can anyone see anything wrong with the dot file that might be causing this, is this a dot bug, or just a random vagary of dot that I'll just have to live with?

Note that making adjustments to individual dot files is not an option as the system generates the dot files as a generic process. I only have come across line crossing in cases of inter-generational relationships or other less common familial relations, as opposed the straight-forward tree in this example.


tree.txt5.25 KB

Re: subgraph layout in dot

Not sure specifically what was expected, but there are invisible flat edges in the tree.txt graph that affect the layout. The layout algorithm performs a lot of local optimization; it's not aimed at globally reorganizing layouts that well, and when you add special constraints it tends to hinder other automatic optimization.


Re: subgraph layout in dot

The invisible lines are just husband/wife/partner relations, they're invisible just so that they don't clutter the graph (the labels and node positioning negate the need for viewable lines, and this also makes the lines connecting siblings/parents/children clearer to the user). I was just wondering whether there was a reason as to why the position of the four siblings of each in the third level from the bottom were "exchanged" when the cleaner layout would have not had lines crossed. That is, Amy Woolf's siblings should be to the right (i.e. the 19666->19675->19693->19665->19664 subgraph) and Anna Bertha's sibling's to the right (i.e. the 19733->237->3343->19734->19712 subgraph) as that would minimise line crossing and not affect the balance of the graph as well as honour the node order as specified in the dot file.

Since I can't force the order as part of the layout, I guess it's just one of those things. Thanks.

Recent comments