different rankdir in a graph

Hi folks I can use some help here, I am very new at this. I want to create a network graph, but I am stuck on the 1st step. I have two network locations with multiple connections and I am trying to link them however I cannot use rankdir in subgraphs. I need one to be from left to right (the left one) and the other from right to left (the right one)
I am unable to achieve this, if any of you has a few minutes to give me a hint please...

Here is my current config:

digraph {
rankdir=LR;
subgraph cluster1 {
style=dotted;
rank=same;
label = "Paris";
parisgw1 [label="parisgw1",shape=rect]
parisgw2 [label="parisgw2",shape=rect]
VDFpgw1 [label="VDF",shape=rect]
VDFpgw2 [label="VDF",shape=rect]
l3pgw1 [label="l3",shape=rect]
l3pgw2 [label="l3",shape=rect]
parisgw1->{VDFpgw1 l3pgw1}
parisgw2->{VDFpgw2 l3pgw2}
}
subgraph cluster2 {
label = "Berlin";
style=dotted;
rank=same;
berlingw1 [label="berlingw1",shape=rect]
berlingw2 [label="berlingw2",shape=rect]
orgbgw1 [label="org",shape=rect]
orgbgw2 [label="org",shape=rect]
colbgw1 [label="col",shape=rect]
colbgw2 [label="col",shape=rect]
berlingw1->{orgbgw1 colbgw1}
berlingw2->{orgbgw2 colbgw2}
}
VDFpgw1->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,label="tun0",fontsize=12,fontname=mono];
VDFpgw2->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,label="tun0",fontsize=12,fontname=mono];
l3pgw1->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,label="tun0",fontsize=12,fontname=mono];
l3pgw2->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,label="tun0",fontsize=12,fontname=mono];
}

AttachmentSize
desired.jpg49.79 KB
grapgh1.png7.29 KB

Correct, rankdir only works

Correct, rankdir only works at the level of the root graph. You can emulate the effect you want by a small modification to the graph.

    rankdir=LR;
    subgraph cluster2 {
        label = "Berlin";
        style=dotted;
        rank=same;
        berlingw1 [label="berlingw1",shape=rect]
        berlingw2 [label="berlingw2",shape=rect]
               orgbgw1 [label="org",shape=rect]
               orgbgw2 [label="org",shape=rect]
               colbgw1 [label="col",shape=rect]
               colbgw2 [label="col",shape=rect]
        berlingw1->{orgbgw1 colbgw1}
        berlingw2->{orgbgw2 colbgw2}
    }
    subgraph cluster1 {
        style=dotted;
        rank=same;
        label = "Paris";
        parisgw1 [label="parisgw1",shape=rect]
        parisgw2 [label="parisgw2",shape=rect]
        VDFpgw1 [label="VDF",shape=rect]
        VDFpgw2 [label="VDF",shape=rect]
        l3pgw1 [label="l3",shape=rect]
        l3pgw2 [label="l3",shape=rect]
        {VDFpgw1 l3pgw1}->parisgw1 [dir=back]
        {VDFpgw2 l3pgw2}->parisgw2 [dir=back]
    }
    VDFpgw1->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,xlabel="tun0",fontsize=12,fontname=mono];
    VDFpgw2->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,xlabel="tun0",fontsize=12,fontname=mono];
    l3pgw1->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,xlabel="tun0",fontsize=12,fontname=mono];
    l3pgw2->orgbgw1 [constraint=false,dir=both,color=Red,arrowsize=0.5,xlabel="tun0",fontsize=12,fontname=mono];
}
 

Recent comments