2012-10-24 20 views
10

Chcę podgrafu clusterCG mieć taką samą rangę jak 3 (clusterCG nie schould zawierać 3)Jak zmienić pozycję grafografu Graphviz?

digraph G{ 
rankdir = LR; 
node [shape = none] 

1->2->3->4[arrowhead=none] 

node [shape = ellipse] 

A->A2->A3; 

subgraph clusterCG{ 
    shape = rect; 
    rank=same; 
    A2; 
    B; 
    C; 
    color=blue; 
    label="C"; 
} 

{ rank=same; 1; A;} 
{ rank=same; 3; CG;} 
{ rank=same; 4; A3;} 
} 

enter image description here

CG jest generowany jako niezależnego węzła z rangi 3.

chcę podgrafu clusterCG mieć rangę 3.

+0

FDSg, nie należy przyjmować odpowiedź. Dla mnie wygląda dobrze! Wiem, że napisałeś to sam, ale było to całkiem pomocne. –

+0

Zgadzam się. Pomogło mi to znaleźć trudny problem, który miałem w innym układzie. Dzięki. – melston

Odpowiedz

7

Może nie najlepsze rozwiązanie, ale wydaje się, że węzły o zerowym rozmiarze to jedyna rzecz, która działa

digraph G{ 
rankdir = LR; 
node [shape = none] 

1->2->3->4[arrowhead=none] 

node [shape = ellipse] 
ACG[shape = none,label="",width=0, height=0]; 

CG->A2 [style=invis,constraint=false]; 

A->ACG[arrowhead=none]; 
ACG->A2->A3; 

subgraph clusterCG{ 
    shape = rect; 
    rank=same; 
    A2; 
    B; 
    C; 
    color=blue; 
    label="C"; 
} 

{ rank=same; 1; A;} 
{ rank=same; 2; ACG;} 
{ rank=same; 4; A3;} 

} 

enter image description here

2

użycie innego algorytmu rangi z "newrank = true"

digraph G { 
newrank=true 
rankdir = LR; 
node [shape = none] 

1->2->3->4[arrowhead=none] 

node [shape = ellipse] 

A->A2->A3; 

subgraph clusterCG{ 
    shape = rect; 
    rank=same; 

    A2; 
    B; 
    C; 
    color=blue; 
    label="C"; 
} 

{ rank=same; 1; A;} 
{ rank=same; 3; A2} 
{ rank=same; 4; A3;} 
} 
Powiązane problemy