我想使用Graphviz的cgraph库api从节点a到b创建2条边,但是对老化的第二次调用总是返回NULL。我在下面的代码中做错了吗? Graphviz版本是2.34。感谢。
#include "gvc.h"
#include "cgraph.h"
#include <iostream>
using namespace std;
int main()
{
GVC_t *context = gvContext();
Agraph_t *graph = agopen((char *)("graph"), Agdirected, NULL);
agsafeset(graph, (char *)("rankdir"), (char *)("LR"), (char *)(""));
Agnode_t *a = agnode(graph, (char *)("a"), 1);
Agnode_t *b = agnode(graph, (char *)("b"), 1);
Agedge_t *e_ab0 = agedge(graph, a, b, (char *)("e_ab0"), 1);
Agedge_t *e_ab1 = agedge(graph, a, b, (char *)("e_ab1"), 1);
//e_ab1 is always 0
cout << e_ab0 << endl << e_ab1 << endl;
//other code...
return 0;
}