从Graphviz中的记录元素的中心开始绘制传出边

时间:2012-12-16 02:42:04

标签: graphviz

在Graphviz中,是否可以从子记录开始绘制外边缘而不是边界?

This diagramoriginal article)看起来如此,但示例代码错误,我测试了清单1中的代码(绘制this,但我使用了twopi而在Graphviz 2.29中,结果是不同的(边缘从记录边界开始)。

有什么想法吗?

提前致谢。

1 个答案:

答案 0 :(得分:4)

链接的文章是从2004年开始的,之后对graphviz进行了一些更改。

以下是如何调整列表°1来显示源自记录形状单元格中心的边缘:

在定义边之前添加以下行:

edge[headclip=false, tailclip=false];

这告诉graphviz将边缘绘制到末尾而不是在边界节点处剪切它们。

但是在这种情况下这还不够,因为边缘已经使用了端口 - 我们可以添加compass point来指示放置边缘的结束/开始的位置。例如,为了让第一条边从J的中心移动到E的边框:

        "node0":f1:c -> "node1":f1;

或者只是省略端口和指南针点以使用节点的中心:

        "node0" -> "node1":f1;

为了让所有边缘始发并以记录节点的中心结束:

digraph G
{
    node [shape = record];
    edge[headclip=false, tailclip=false];

    node0 [ label ="<f0> | <f1> J | <f2> "];
    node1 [ label ="<f0> | <f1> E | <f2> "];
    node4 [ label ="<f0> | <f1> C | <f2> "];
    node6 [ label ="<f0> | <f1> I | <f2> "];
    node2 [ label ="<f0> | <f1> U | <f2> "];
    node5 [ label ="<f0> | <f1> N | <f2> "];
    node9 [ label ="<f0> | <f1> Y | <f2> "];
    node8 [ label ="<f0> | <f1> W | <f2> "];
    node10 [ label ="<f0> | <f1> Z | <f2> "];
    node7 [ label ="<f0> | <f1> A | <f2> "];
    node3 [ label ="<f0> | <f1> G | <f2> "];

    // identical result: "node0" -> "node1";
    "node0":f1:c -> "node1":f1:c;
    "node0":f1:c -> "node2":f1:c;

    "node1":f1:c -> "node4":f1:c;
    "node1":f1:c -> "node6":f1:c;
    "node4":f1:c -> "node7":f1:c;
    "node4":f1:c -> "node3":f1:c;

    "node2":f1:c -> "node5":f1:c;
    "node2":f1:c -> "node9":f1:c;

    "node9":f1:c -> "node8":f1:c;
    "node9":f1:c -> "node10":f1:c;
}

record nodes centered