2017-08-23 58 views
0

之間無毛邊I'musing的Graphviz呈現一些分層結構。到目前爲止,使用子圖對於實現我所尋找的東西來說是次優的。的Graphviz忽略秩屬性如果節點

是什麼,我想獲得

enter image description here

(顏色代表層次不同層次所以他們需要按照這個順序)。爲了使這個形象我用無形的聯繫,但是這真的不是在真實的場景中的一個選項。

然而,此刻這是我使用這個.DOT文件

graph { 
    // Global config 
    rankdir=BT 
    node [style="filled" fontcolor="white" shape="box"] 
    // Rank (hierarchies) 
    { rank=same; 258 } 
    { rank=same; 259 } 
    { rank=same; 260 } 
    { rank=same; 261 262 } 
    // Nodes 
    // Tasks 
    258 [label="John Cleese" fillcolor="#E8B04D"] 
    // Project Goals 
    259 [label="Michael Palin" fillcolor="#C0C56B"] 
    // Identities 
    260 [label="Eric Idle" fillcolor="#FF8D61"] 
    // Virtues 
    261 [label="Graham Chapman" fillcolor="crimson"] 
    262 [label="Terry Jones" fillcolor="crimson"] 
    // Edges 
    259 -- 260 [style="bold" color="#3790af"] 
} 

它是更多鈔票對的Graphviz到邊前榮譽等級越來越 enter image description here

?如果是這樣,我將如何繼續?

回答

1

你的問題很容易通過添加一些看不見的邊緣,只要你想,讓各種級別(你正確設置)工作的解決。需要注意的簡單相加接近底部的三個可見邊:

graph { 
    // Global config 
    rankdir=BT 
    node [style="filled" fontcolor="white" shape="box"] 
    // Rank (hierarchies) 
    { rank=same; 258 } 
    { rank=same; 259 } 
    { rank=same; 260 } 
    { rank=same; 261 bl 262 } 
    // Nodes 
    // Tasks 
    258 [label="John Cleese" fillcolor="#E8B04D"] 

    // Project Goals 
    259 [label="Michael Palin" fillcolor="#C0C56B"] 

    // Identities 
    260 [label="Eric Idle" fillcolor="#FF8D61"] 

    // Virtues 
    261 [label="Graham Chapman" fillcolor="crimson"] 
    262 [label="Terry Jones" fillcolor="crimson"] 

    // Edges 
    259 -- 260 [style="bold" color="#3790af"] 
258--259 [style=invis] 
260--261 [style=invis] 
260--262 [style=invis] 
260--bl [style=invis] 

bl [style=invis label="" height=0, width=0] 

} 

我也是在中心添加一個不可見的平衡點,bl幫助中間的圖形更好。

enter image description here

+0

謝謝湯姆。我已經嘗試過,它確實有效。實際上,我在尋找替代方案,因爲正如我所說的編程添加這些幻象的邊緣可能會很複雜。如果沒有替代品可用,我必須這樣做! – Sebastialonso

+0

@Sebastialonso好的,謝謝,看到我的最新修改,有助於平衡曲線更好,如果可以幫助也。不幸的是,沒有辦法渲染引擎辨別的各種子圖,甚至用'秩same'必須在*不同*隊伍沒有某種優勢。 – TomServo