【问题标题】:Graphviz subgraphs layoutGraphviz 子图布局
【发布时间】:2020-11-20 13:07:35
【问题描述】:

我有以下图表:

digraph G {
    rankdir=TB
    subgraph cluster_1 {
      label = "cluster1"
      1; 2; 3; 4; 5; 6; 7; 8; 9; 10;
    }
    subgraph cluster_2 {
      label = "cluster2"
      11; 12; 13; 14; 15;
    }
    subgraph cluster_3 {
      label = "cluster3"
      16; 17; 18; 19; 20; 21;
    }
  7 -> {10, 3, 4}
  10 -> 9
  4 -> {1, 6, 5, 2}
  4 -> 13
  8 -> {3, 4}
  13 -> {11, 12}
  11 -> {16, 14, 15}
  16 -> {17, 19, 20, 21, 18}
}

我看到的输出是:

如何严格垂直放置所有集群?

【问题讨论】:

    标签: graphviz dot


    【解决方案1】:

    不幸的是,没有单一的属性可以完成你想要的。但是,如果您将这 3 行添加到您的图表中:

      edge [style=invis]
      {6 1} -> 13
      {14 15} ->16
    

    你得到这个:

    【讨论】:

    • 谢谢。但这不是一个自动化友好的解决方案。它也不适用于较长的节点名称。
    猜你喜欢
    • 2012-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-16
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 2018-08-09
    相关资源
    最近更新 更多