我正在编写一个正在构建图形的软件 在最基本的形式中,图形将在文件中描述,如下一段中传递给agmemread的字符串。这是构造并将其保存为PNG的代码:
#include <gvc.h>
int main()
{
GVC_t* gvc;
Agraph_t* g;
gvc=gvContext();
g=agmemread
(
"digraph g"\
"{"\
" 1->2;"\
" 2->3;"\
" 2->13;"\
" 3->4;"\
" 4->5;"\
" 4->6;"\
" 5->8;"\
" 6->7;"\
" 7->8;"\
" 8->9;"\
" 8->10;"\
" 9->23;"\
" 10->11;"\
" 10->12;"\
" 11->23;"\
" 12->23;"\
" 13->14;"\
" 14->15;"\
" 15->16;"\
" 15->19;"\
" 16->17;"\
" 17->18;"\
" 18->21;"\
" 19->20;"\
" 20->21;"\
" 21->22;"\
" 22->23;"\
"}"
);
gvLayout(gvc,g,"dot");
gvRenderFilename(gvc,g,"png","g_gen.png");
gvFreeLayout(gvc, g);
agclose(g);
gvFreeContext(gvc);
return 0;
}
我的问题是保存在“g_gen.png”中的图表(来自代码)如下所示: http://i56.tinypic.com/25hk3de.png
我希望它类似于这种结构(用DIA for Windows绘制):
http://i56.tinypic.com/t070br.png
我指的是节点的位置。特别是: