使用 graphviz cgraph 库以编程方式设置罗盘点

Set compass points programatically with graphviz's cgraph library

我正在使用 graphviz 的 cgraph 库创建图表。例如,下面的 C 代码片段

Agraph_t *g = agopen("MyGraph", Agdirected, NULL);
Agnode_t *a = agnode(g, "A", TRUE);
Agnode_t *b = agnode(g, "B", TRUE);
Agedge_t *e = agedge(g, a, b, "", TRUE);
agwrite(g, stdout);

生成这个点图

digraph MyGraph {
    A -> B;
}

渲染成这样

(A)
 ↓
(B)

我想知道的是如何以编程方式设置罗盘点必须锚定边缘。我想要得到的点阵图是:

digraph MyGraph {
    A:ne -> B:sw
}

最终可以呈现为

    (B)
   ↗
(A)

谢谢。

最后我自己找到了答案。这就是我需要的:

agsafeset(e,"tailport","nw","");
agsafeset(e,"headport","se","");