2014-07-14 141 views
4

我得到一個奇怪的graphviz佈局,邊緣重疊。奇怪的graphviz邊緣重疊

節點「5」似乎被放置在錯誤的地方:

Default messy version

如果我強迫與節點「H」節點「5」之間的邊緣和正確的位置,一切都很好地:

Fixed version

爲什麼默認佈局是如此凌亂?

這裏是我的點源(只是取消對該行獲得固定版本):

digraph dummy { 

    subgraph line1 { rank = same 
     "1", "a", "b", "c", "d", "e", "f", "17" 
    } 

    subgraph line2 { rank = same 
     "9", "g", "11" 
    } 

    subgraph line3 { rank = same 
     "3", "h", "i", "14" 
    } 

    "c" -> "d" 
    "a" -> "b" 
    "b" -> "c" 
    "e" -> "f" 
    "i" -> "14" 
    "14" -> "f" 
    "a" -> "3" 
    "3" -> "h" 
    "d" -> "9" 
    "9" -> "g" 
    "h" -> "i" 
    "g" -> "i" 
    "d" -> "e" 
    "g" -> "11" 
    "11" -> "e" 
    "b" -> "5" 
    #"5" -> "h" # Uncomment to "fix" 
    "c" -> "7" 
    "f" -> "17" 
    "1" -> "a" 
    "h" -> "13" 
    "i" -> "15" 
    "i" -> "15bis" 
    "i" -> "16" 
} 

隨着@Sisyphus的幫助下,我能得到更好的結果(但節點「11」昂「G」沒有理由被切換):

enter image description here

+0

請注意生成點內容。所以包括修改作爲一個看不見的邊''5「 - >」h「[style = invis]'是不可能的 – PhE

+0

...那麼,請指示生成器包含不可見屬性... –

+0

@ robert-siemer:我不能,因爲我不知道有關內容*佈局* – PhE

回答

1

變化

subgraph line2 { rank = same 
    "9", "g", "11" 
} 

{ rank = same 
    rankdir=LR 
    5->7->9->g->11[color=white] 
} 

這個地方的節點「5」正確,但「9」和「g」錯誤。

+0

謝謝,它有幫助!但我仍然不明白節點「11」和「g」是這樣切換的! – PhE