Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Graphviz 如何防止子图簇对齐顺序颠倒?_Graphviz_Dot - Fatal编程技术网

Graphviz 如何防止子图簇对齐顺序颠倒?

Graphviz 如何防止子图簇对齐顺序颠倒?,graphviz,dot,Graphviz,Dot,如果我有这样一个graphviz点脚本: digraph g { node [style=rounded, shape=box] subgraph cluster1 { style="invis" 1 -> 2 -> 3 -> 4 -> 5 } subgraph cluster2 { style="invis" 6 -> 7 7 -> 8 ->

如果我有这样一个
graphviz点
脚本:

digraph g {
node [style=rounded, shape=box]

    subgraph cluster1 {
        style="invis"
        1 -> 2 -> 3 -> 4 -> 5
    }

    subgraph cluster2 {
        style="invis"
         6 -> 7

         7 -> 8 -> 11
         7 -> 9 -> 11
         7 -> 10 -> 11
    }

    edge[constraint=false];
    splines="ortho"
    5 -> 6 [weight=0]
}
digraph g {
node [style=rounded, shape=box]

8 [label="very long label"]
9 [label="very long label"]
10 [label="very long label"]


    subgraph cluster1 {
        style="invis"
        1 -> 2 -> 3 -> 4 -> 5
    }

    subgraph cluster2 {
        style="invis"
         6 -> 7

         7 -> 8 -> 11
         7 -> 9 -> 11
         7 -> 10 -> 11
    }

    edge[constraint=false];
    splines="ortho"
    5 -> 6 [weight=0]
}
我得到的输出如下(我想要的):

但是,如果末端某些节点中的标签变得太长,则排列会反转,如下所示:

digraph g {
node [style=rounded, shape=box]

    subgraph cluster1 {
        style="invis"
        1 -> 2 -> 3 -> 4 -> 5
    }

    subgraph cluster2 {
        style="invis"
         6 -> 7

         7 -> 8 -> 11
         7 -> 9 -> 11
         7 -> 10 -> 11
    }

    edge[constraint=false];
    splines="ortho"
    5 -> 6 [weight=0]
}
digraph g {
node [style=rounded, shape=box]

8 [label="very long label"]
9 [label="very long label"]
10 [label="very long label"]


    subgraph cluster1 {
        style="invis"
        1 -> 2 -> 3 -> 4 -> 5
    }

    subgraph cluster2 {
        style="invis"
         6 -> 7

         7 -> 8 -> 11
         7 -> 9 -> 11
         7 -> 10 -> 11
    }

    edge[constraint=false];
    splines="ortho"
    5 -> 6 [weight=0]
}


如何防止这种情况发生并强制执行原始的订购方法?

在定义了其他标签之后,您必须定义长标签
graphviz
按定义的顺序绘制节点

digraph g {
node [style=rounded, shape=box]

    subgraph cluster1 {
        style="invis"
        1 -> 2 -> 3 -> 4 -> 5
    }

    subgraph cluster2 {
        style="invis"
         6 -> 7

         7 -> 8 -> 11
         7 -> 9 -> 11
         7 -> 10 -> 11
    }

    8 [label="very long label"]
    9 [label="very long label"]
    10 [label="very long label"]

    edge[constraint=false];
    splines="ortho"
    5 -> 6 [weight=0]
}
屈服


非常感谢,按照所需的外观顺序声明节点使我的所有图形现在都更易于操作,这是一个很好的建议!