Generate a directory tree with dot

Hello,
I want to generate a simple directory tree, but i can not move the nodes under there root nodes.
This is what I get (Tree with Graphviz):

This is what I want (Tree with Paint):

 
Has anybody an idea?
Here ist the source:

digraph tree
{
    nodesep=0.5;            
 
    charset="latin1";     
    rankdir=LR;    
    fixedsize=true;          
    node [style="rounded,filled", width=0, height=0, shape=box, fillcolor="#E5E5E5", concentrate=true]
 
    a_dir_1 [label="Software-Qualität" shape=box, width=3]

    a_point_1 [shape=point]
    b_dir_1 [label="Produktqualität", width=3]
    a_point_1 -> b_dir_1

    b_point_1 [shape=point]
    c_dir_1 [label="Konstruktive Qualitätssicherung", width=3]
    b_point_1 -> c_dir_1

    c_point_1 [shape=point]
    d_dir_1 [label="Software-Richtlinien", width=3]
    c_point_1 -> d_dir_1

    c_point_2 [shape=point]
    d_dir_2 [label="Typisierung\l", width=3]
    c_point_2 -> d_dir_2

    c_point_3 [shape=point]
    d_dir_3 [label="Vertragsbasierte Programmierung", width=3]
    c_point_3 -> d_dir_3

    c_point_4 [shape=point]
    d_dir_4 [label="Fehlertolerante Programmierung", width=3]
    c_point_4 -> d_dir_4

    c_point_5 [shape=point]
    d_dir_5 [label="Portabilität", width=3]
    c_point_5 -> d_dir_5

    c_point_6 [shape=point]
    d_dir_6 [label="Dokumentation", width=3]
    c_point_6 -> d_dir_6
 
    b_point_2 [shape=point]
    c_dir_2 [label="Analytische Qualitätssicherung", width=3]
    b_point_2 -> c_dir_2
 
    {
        rank=same;
        a_dir_1 -> a_point_1 [arrowhead=none]
    }
    {
        rank=same;
        b_dir_1 -> b_point_1 -> b_point_2 [arrowhead=none]
    }
    {
        rank=same;
        c_dir_1 -> c_point_1 -> c_point_2 -> c_point_3 -> c_point_4 -> c_point_5 -> c_point_6 [arrowhead=none]
    }
}

Sorry for my bad english!
Thank you!

AttachmentSize
Tree with Paint40.67 KB
Tree with Graphviz31.96 KB

Generate a directory tree

Dot is always going to place nodes in ranks (you see them as columns in Tree with Graphviz), so getting Tree with Paint using rankdir=LR won't work.
There are two ways to go. One is to remove the rankdir attribute and rotate your constraints 90 degrees:
digraph tree
{

    charset="latin1";
    fixedsize=true;
    node [style="rounded,filled", width=0, height=0, shape=box, fillcolor="#E5E5E5", concentrate=true]

    a_dir_1 [label="Software-Qualität" shape=box, width=3]

    {rank=same
      a_point_1 [shape=point]
      b_dir_1 [label="Produktqualität", width=3]
    }
    a_dir_1 -> a_point_1 [arrowhead=none]
    a_point_1 -> b_dir_1

    {rank=same
      b_point_1 [shape=point]
      c_dir_1 [label="Konstruktive Qualitätssicherung", width=3]
    }
    b_point_1 -> c_dir_1
    b_dir_1 -> b_point_1 [arrowhead=none]

    {rank=same
    c_point_1 [shape=point]
    d_dir_1 [label="Software-Richtlinien", width=3]
    }
    c_point_1 -> d_dir_1

    {rank=same
      c_point_2 [shape=point]
      d_dir_2 [label="Typisierung\l", width=3]
    }
    c_point_2 -> d_dir_2

    {rank=same
      c_point_3 [shape=point]
      d_dir_3 [label="Vertragsbasierte Programmierung", width=3]
    }
    c_point_3 -> d_dir_3

    {rank=same
      c_point_4 [shape=point]
      d_dir_4 [label="Fehlertolerante Programmierung", width=3]
    }
    c_point_4 -> d_dir_4

    {rank=same
      c_point_5 [shape=point]
      d_dir_5 [label="Portabilität", width=3]
    }
    c_point_5 -> d_dir_5

    {rank=same
      c_point_6 [shape=point]
      d_dir_6 [label="Dokumentation", width=3]
    }
    c_point_6 -> d_dir_6

    {rank=same
      b_point_2 [shape=point]
      c_dir_2 [label="Analytische Qualitätssicherung", width=3]
    }
    b_point_2 -> c_dir_2
    b_point_1 -> b_point_2 [arrowhead=none minlen=7]

    c_dir_1 -> c_point_1 -> c_point_2 -> c_point_3 -> c_point_4 -> c_point_5 -> c_point_6 [arrowhead=none]
}
 
This will give you Tree with Paint. If you are doing this by hand, this is okay, but this approach requires that nasty minlen, which requires you to have some idea of what the layout will be before you do it, so it is not easy to automate.
The second approach is to write a small script that would take your input graph, gather the needed parameters from the graph and then generate the necessary dot file.
 

Thank you

I do this this by hand.
 
Thank you.

Recent comments