0

I defined a forest (a set of trees) in DOT. I am using dot for layouting.

Now the problem: The trees have different depths. I would like to align the root nodes on the same level, however on default the nodes are aligned by the leaves.

enter image description here

knub
  • 3,892
  • 8
  • 38
  • 63
  • The very first picture in the Graphviz documentation at http://www.graphviz.org/Documentation/dotguide.pdf does what I want. Unfortunately, they only show the graph, no code/explanation. – knub Sep 02 '15 at 12:07

1 Answers1

1

I think you mixed up actual with expected in your question

digraph {

 // create a forest hanging from the ceiling
 node[shape=box]
 edge[dir=back]
 a->b->c
 d->e->f->g
 h->i

 // ground the forest
 ground_node[style=invis]
 subgraph {
  c;g;i
 } -> ground_node [style=invis]

}
stefan
  • 3,681
  • 15
  • 25
  • No, I did not mix that up. What caused the confusion probably is that I want the arrows going towards the root, i.e. the nodes at the top of the images are the roots and the yellow ones are the leaves. – knub Sep 04 '15 at 16:14
  • 1
    top alignment is default while *grounding* is extra code as shown in my example. – stefan Sep 05 '15 at 12:13