Dot - Drawing edges while preserving the tree layout

By xngo on July 10, 2019

digraph simple_hierarchy {
    a->b->c;
    b->d;
    a->e->f;
    e->g;
 
    // Drawing edges while preserving the tree layout with constraint=none
    // Very good for annotations.
    edge [color=red,arrowhead=none,constraint=none];
    b->f
    b->g
    d->f
    g->c
}

Output

Output from the dot code

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.