2017-12-03 148 views
1

我有以下graphviz的圓點輸入文件:的Graphviz點對齊節點垂直

digraph structs { 
rankdir = LR; 
node [shape=record]; 
hashTable [label="<f0>0|<f1>1|<f2>2|<f3>3|<f4>4|<f5>5|<f6>6|<f7>7|<f8>8"]; 
node_1_0 [label="<f0> one|<f1> two |<f2> three"]; 
node_1_1 [label="<f0> un |<f1> deux|<f2> trois"]; 
struct3 [label="<f0> einz|<f1> swei|<f2> drei"]; 
hashTable:f1 -> node_1_0:f0; 
node_1_0:f2 -> node_1_1:f0; 
hashTable:f4 -> struct3:f0; 
} 

其獲取呈現這樣的:

enter image description here

我怎麼能有[一|二|三]節點垂直對齊到[un | deux | trois]節點?謝謝!

回答

1

編輯澄清註釋後:在這裏,具有較強的重量一種無形的邊緣有助於保持節點一致:

digraph structs2 
{ 
    rankdir = LR; 
    node [shape=record]; 
    splines=false;  // optional; gives straight lines 

    hashTable [label="<f0>0|<f1>1|<f2>2|<f3>3|<f4>4|<f5>5|<f6>6|<f7>7|<f8>8"]; 
    node_1_0 [label="<f0> one|<f1> two |<f2> three" ]; 
    node_1_1 [label="<f0> un |<f1> deux|<f2> trois"]; 
    struct3 [label="<f0> einz|<f1> swei|<f2> drei"]; 

    // 
    node_1_0 -> node_1_1[ style = invis, weight= 10 ]; 
    //     ^^^^^^^^^^^^^^^^^^^^^^^^^ 

    hashTable:f1 -> node_1_0:f0; 
    node_1_0:f2 -> node_1_1:f0; 
    hashTable:f4 -> struct3:f0; 
} 

給你(我相信)你想要什麼:

enter image description here

...............

原始回答是:

回答您面值的問題,這可以迅速地通過將它們放入同一級別實現:

digraph structs 
{ 
    rankdir = LR; 
    node [shape=record]; 

    hashTable [label="<f0>0|<f1>1|<f2>2|<f3>3|<f4>4|<f5>5|<f6>6|<f7>7|<f8>8"]; 
    node_1_0 [label="<f0> one|<f1> two |<f2> three"]; 
    node_1_1 [label="<f0> un |<f1> deux|<f2> trois"]; 
    struct3 [label="<f0> einz|<f1> swei|<f2> drei"]; 

    {rank = same; node_1_0 node_1_1 } 

    hashTable:f1 -> node_1_0:f0; 
    node_1_0:f2 -> node_1_1:f0; 
    hashTable:f4 -> struct3:f0; 
} 

產生

enter image description here

+0

@vaettechen感謝,我其實意味着之一[ | two | three]將處於相同的高度(並且完全留在)[un | deux | trois]。也就是說,一個和聯合會在相同的高度等。 – OrenIshShalom

+0

現在我明白你的意思是「垂直對齊」。按照編輯。 – vaettchen

+0

完美的作品,謝謝! – OrenIshShalom