简体   繁体   English

奇怪的graphviz边缘重叠

[英]Strange graphviz edges overlapping

I get a strange graphviz layout with edges overlapping. 我得到一个边缘重叠的奇怪的graphviz布局。

Node "5" seems to be placed at the wrong place : 节点“5”似乎放在错误的位置:

默认凌乱的版本

If I force the correct position with an edge between node "5" and node "h", everything is well placed : 如果我用节点“5”和节点“h”之间的边缘强制正确的位置,一切都很好:

固定版本

Why the default layout is so messy ? 为什么默认布局如此混乱?

Here is my dot source (just uncomment the line to get the 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"
}

With the help of @Sisyphus I can get a better result (but nodes "11" ang "g" are switched without reason) : 在@Sisyphus的帮助下,我可以获得更好的结果(但节点“11”ang“g”无理由切换):

在此输入图像描述

change 更改

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

to

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

This place the node "5" right, but "9" and "g" wrong. 这使节点“5”正确,但“9”和“g”错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM