Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.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,我制作了以下图形: 我想添加一个额外的箭头,从“远程回购”一直指向“工作副本”(标有“git pull”),我希望该箭头最好先稍微向下,然后向左,然后向上 当我简单地在代码中添加一个箭头时,图形结果如下所示: 这是代码: digraph G { /* set direction of graph to be left-->right */ rankdir="LR"; /* make boxes instead of ellipses */ node [

我制作了以下图形:

我想添加一个额外的箭头,从“远程回购”一直指向“工作副本”(标有“git pull”),我希望该箭头最好先稍微向下,然后向左,然后向上

当我简单地在代码中添加一个箭头时,图形结果如下所示:

这是代码:

digraph G {
    /* set direction of graph to be left-->right */
    rankdir="LR";

    /* make boxes instead of ellipses */
    node [shape=box];

    /* should enforce nodes to be horizontally aligned */
    /* is not working, though... */
    rank=same;

    /* assign labels to nodes */
    wc [label="working copy"];
    id [label="index"];
    lr [label="local repo"];
    rr [label="remote repo"];

    wc -> id [label="git add"];
    id -> lr [label="git commit"];
    lr -> rr [label="git push"];

    rr -> wc [label="git pull"];
}
问题:为什么水平线断裂,如何修复


后续问题:如何制作一个向下、向左、然后向上的箭头?(或者是使用某种不可见/伪节点实现此目的的唯一方法?

您可以使用
constraint=false
属性修改有问题的边。然后您将收到下图

如果您更喜欢角度更大的边,也可以为图形选择
spline=ortho

请用工作示例进行检查。下面我粘贴了源代码

digraph G {
    /* set direction of graph to be left-->right */
    rankdir="LR";
    splines=ortho;

    /* make boxes instead of ellipses */
    node [shape=box];

    /* should enforce nodes to be horizontally aligned */
    /* is not working, though... */
    rank=same;

    /* assign labels to nodes */
    wc [label="working copy"];
    id [label="index"];
    lr [label="local repo"];
    rr [label="remote repo"];

    wc -> id [label="git add"];
    id -> lr [label="git commit"];
    lr -> rr [label="git push"];

    rr -> wc [label="git pull", constraint=false];
}