graphviz - 如何引导点使用较短的边缘路径?

标签 graphviz dot

下图的布局几乎是完美的,除了从左边的“命名管道”节点到“cat”的边缘,它需要一条很长的迂回路线,而不是我在上面用红色标记的明显的短路线。下图。有没有办法引导点使用短边路径?请注意,图底部的序列图必须按当前显示的方式呈现,即按从左到右的顺序。

enter image description here

这是绘制图表的代码。

digraph D {
fontname="Arial";
subgraph cluster_async {
    label="Asynchronous processes";
    style=filled;
    color=lightgrey;

    node [shape=box, style=solid, fillcolor=white, fontname="Arial"];
    {
        rank=same;
        npi_0_0_0 [label="named\npipe"];
        npi_0_3_0 [label="named\npipe"];
        npi_0_2_0 [label="named\npipe"];

    }

    node [shape=box, style=bold];
    tee [label="sgsh-tee"];
    "ls -l" -> tee;
    tee -> npi_0_0_0;
    tee -> npi_0_3_0;
    tee -> npi_0_2_0;

    NBYTES [label="sgsh-writeval -s NBYTES"];
    npi_0_3_0 -> "awk '{s += $5} END {print s}'" -> NBYTES;

    NDIRS [label="sgsh-writeval -s NDIRS"];
    npi_0_2_0  -> "grep -c '^d'" -> NDIRS;

    // Put some order in the appearance
    {
        rank=same;
        NDIRS;
        NBYTES;
    }
}

subgraph clustersync {
    label="Synchronous sequence";
    style=dashed;
    start [shape=circle, style=filled, label="", fillcolor=black, width=.2];
    node [shape=box, style=bold, fontname="Arial"];
    npi_0_0_0:sw -> cat:nw [constraint=false];
    "sgsh-readval -s NDIRS" -> echo;
    "sgsh-readval -s NBYTES" -> echo;

    NBYTES -> "sgsh-readval -s NBYTES";
    NDIRS -> "sgsh-readval -s NDIRS";

    end [shape=doublecircle, style=filled, label="", fillcolor=black, width=.2];
    {
        rank=same;
        edge [arrowhead=open];
        start -> cat -> echo -> end;
    }
}
}

(如果您感兴趣,该图说明了 sgsh 中的示例的设置。)

最佳答案

对于此图,设置 splines=ortho将产生理想的结果。 enter image description here

关于graphviz - 如何引导点使用较短的边缘路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24107451/

相关文章:

python - graphviz 可以显示一次性解码的分类数据吗?

dot - 在 dot graphviz 中从左到右订购框

Graphviz:如何设置 'default' 箭头样式?

python - 在 Graphviz 中删除一个节点

Graphviz:水平对齐不适用于向后箭头

graphviz - 在graphviz中生成邻接矩阵

linux - 如何使用点在 GraphViz 的标签中使用\"?

linux - 使用 neato 问题进行编译

python - Graphviz 不绘制图表

python - 试图从 scikit-learn 集成中打印出森林的决策树