我正在尝试使用graphviz建模特定的流,但我不知道如何建模以下图形以共享相同的水平中心

digraph exmp {
   A -> B -> C -> D
   C -> E [constraint=false]
   A -> C [style="dotted", constraint=false]
   A -> D [style="dotted",  constraint=false]
   B -> D [constraint=false]
   D -> A [style="dashed", constraint=false]
   C -> A [style="dashed", constraint=false]


   subgraph cluster_hackToSinkIt { E -> F }
   { rank="sink" E F }
}


结果如下图所示:



我的问题是,如何才能将E-> F放置在D之下(位于同一列中)?

最佳答案

至少不能as of May 2007本身不能强制“列”,但是可以对边缘施加权重,这应有助于强制对齐。但是实际上,在这种情况下,如果仅在D到E之间添加不可见的边缘,则可以实现垂直对齐。

digraph exmp {
    A -> B -> C -> D
    C -> E [constraint=false]
    A -> C [style="dotted", constraint=false]
    A -> D [style="dotted",  constraint=false]
    B -> D [constraint=false]
    D -> A [style="dashed", constraint=false]
    C -> A [style="dashed", constraint=false]
    D -> E [style="invis"] // <---- important new line


    subgraph cluster_hackToSinkIt { E -> F }
    { rank="sink" E F }
}




我不知道将边缘强制到一侧或另一侧的任何方法。

关于graph - 如何强制graphviz中同一列中的所有节点?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1476241/

10-12 17:39
查看更多