Search code examples
graphvizdot

Edge crossing each other


is there a way to eliminate the crossing of edges?

I tried many ways, nothing helped.

digraph graphname {
    graph [splines=ortho,];
    node [shape=box,];

    l;

    l_a [shape=diamond,label="",height=0.20,width=0.20];
    l_a_s [shape=point];
    l_a_i [shape=point];
    l_a_ii [shape=point];
    l_a -> l_a_s;
    {rank=same; a -> l_a -> l}
    {rank=same; l_a_i -> l_a_s -> l_a_ii}
    l_a_i -> i;
    l_a_ii -> ii;

    l_c [shape=diamond,label="",height=0.20,width=0.20];
    l_c_s [shape=point];
    l_c_t [shape=point];
    l_c_n [shape=point];
    l_c -> l_c_s;
    {rank=same; l -> l_c -> c} 
    {rank=same; l_c_t -> l_c_s -> l_c_n}
    l_c_t -> t;
    l_c_n -> n;
}

some more details: image


Solution

  • All you need to do is to reorganize your node/edge definitions a little bit, no additional edges needed.

    for example:

    digraph graphname {
        graph [splines=ortho,];
        node [shape=box,];
    
        a;
        l_a [shape=diamond,label="",height=0.20,width=0.20];
        l;
        l_c [shape=diamond,label="",height=0.20,width=0.20];
        c;
        {rank=same; a -> l_a -> l -> l_c -> c}
    
        l_a_s [shape=point];
        l_c_s [shape=point];
        l_a -> l_a_s;
        l_c -> l_c_s;
    
        l_a_i [shape=point];
        l_a_ii [shape=point];
        l_c_t [shape=point];
        l_c_n [shape=point];
    
        {rank=same;
        l_a_i -> l_a_s -> l_a_ii;
        l_c_t -> l_c_s -> l_c_n;}
    
        l_a_i -> i;
        l_a_ii -> ii;
    
        l_c_t -> t;
        l_c_n -> n;
    }