【问题标题】:Graphviz layout left to right, then top to bottomGraphviz 布局从左到右,然后从上到下
【发布时间】:2019-03-11 19:22:00
【问题描述】:
digraph finite_state_machine {
    size="8,5"
    rankdir=LR;
      node [shape = doublecircle]; beg, end;
      node [shape = circle];

  subgraph clusterG1 {
    label="area code";
    beg -> ac1 [ label = "(" ];
    ac1 -> ac2 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
    ac2 -> ac3 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
    ac3 -> ac4 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
  }

    ac4 -> ex1 [ label = ")" ];

  subgraph clusterG2 {
    label="exchange"
    ex1 -> ex2 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
    ex2 -> ex3 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
    ex3 -> ex4 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
  }

  ex4 -> num1 [ label = "-" ];

  subgraph clusterG3 {
    label="number"
    num1 -> num2 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
    num2 -> num3 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
    num3 -> num4 [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
    num4 -> end [ label = "0,1,2,3,4,\n5,6,7,8,9,0" ];
  }

}

给出这个:

(对不起,太小了:)

这是一个简单的线性图。我想从左到右有三个盒子,每个盒子在内部从上到下组织。经过大量的谷歌搜索,我仍然不知道该怎么做!

【问题讨论】:

    标签: graphviz


    【解决方案1】:

    基本上你可以将constraint=false 属性添加到连接集群之间节点的边缘:

    ac4 -> ex1 [ label = ")", constraint=false ];

    ex4 -> num1 [ label = "-", constraint=false ];

    该属性禁止边影响连接节点的排名位置。换句话说,它添加了连接箭头,但头部和尾部的位置仍然像根本没有连接一样。

    不过,您将面临另一个问题 - 如果您的集群并排,您将连接一个集群的 底部 与另一个集群的 顶部,这将导致在整个图中丑陋的重叠边。

    如果您在解决该问题时遇到困难,请告诉我您希望如何解决该问题,我们可以一起解决问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-02
      • 1970-01-01
      • 2018-06-15
      • 2021-11-05
      • 2015-05-08
      • 2011-09-25
      • 2016-03-01
      • 2017-05-08
      相关资源
      最近更新 更多