gpt4 book ai didi

alignment - Graphviz水平对齐子图

转载 作者:行者123 更新时间:2023-12-04 11:28:02 27 4
gpt4 key购买 nike

我有以下代码:

    digraph G {
bgcolor=antiquewhite;
compound=true;
{
rankdir=LR ;
rank=same g0 p1 p2 p3 h1;
}
subgraph cluster0 {
style=filled;
color=khaki;
g0 [label="G",shape=circle,style="filled", color="red", fillcolor="lightpink"]
label = "Cluster 0";
g0 -> p1;
}
subgraph cluster1 {
style=filled;
color=khaki;
p1 [label="S2",shape=box,style="filled", color="blue", fillcolor="skyblue"];
p2 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
p3 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
label = "Cluster 1";
p1 -> p2 -> p3 [arrowhead=none] ;
}
subgraph cluster2 {
style=filled;
color=khaki;
h1 [label="h1",shape=box,style="invis"];
label = "Cluster 2";
p3 -> h1;
}
}

除了子图不显示外,一切都完美无缺。一旦在集群外定义了等级,子图就会消失。

enter image description here

如果在簇体内部定义,则簇之间的相同等级将丢失。

最佳答案

  • rankdir仅适用于图形级别
  • 一个节点可能只属于一个集群

  • .
    digraph G {
    rankdir=LR ;
    bgcolor=antiquewhite;
    compound=true;
    subgraph cluster0 {
    style=filled;
    color=khaki;
    g0 [label="G",shape=circle,style="filled", color="red", fillcolor="lightpink"]
    label = "Cluster 0";
    }
    subgraph cluster1 {
    style=filled;
    color=khaki;
    p1 [label="S2",shape=box,style="filled", color="blue", fillcolor="skyblue"];
    p2 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
    p3 [label="S3",shape=box,style="filled", color="blue", fillcolor="skyblue"];
    label = "Cluster 1";
    p1 -> p2 -> p3 [arrowhead=none] ;
    }
    subgraph cluster2 {
    style=filled;
    color=khaki;
    h1 [label="h1",shape=box,style="invis"];
    label = "Cluster 2";
    }
    g0 -> p1;
    p3 -> h1;
    }



    enter image description here

    关于alignment - Graphviz水平对齐子图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30170133/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com