IGraph中没有显示任何图形 [英] No Graph is Being Displayed in IGraph
问题描述
我一直在尝试使用c中的igraph库制作图形.我什至已经重新安装了它,但我无法理解问题. 整个程序已成功编译,但是我没有输出任何图形. 所有的printf都已执行,并显示在输出中,仅图形似乎丢失了.
I have been trying to make graphs using the igraph library in c. I have even reinstalled it but i am unable to understand the problem. The whole program is compiled successfully but i get no graph as an output. All the printf's are executed and are shown in the output only the graph seems to be missing.
请帮助我解决这个问题.
Please help i am stuck in this problem.
#include <igraph.h>
int main(void)
{
igraph_real_t diameter;
igraph_t graph;
igraph_erdos_renyi_game(&graph, IGRAPH_ERDOS_RENYI_GNP, 1000, 5.0/1000,
IGRAPH_UNDIRECTED, IGRAPH_NO_LOOPS);
igraph_diameter(&graph, &diameter, 0, 0, 0, IGRAPH_UNDIRECTED, 1);
printf("Diameter of a random graph with average degree 5: %f\n",
(double) diameter);
igraph_destroy(&graph);
return 0;
}
这是我正在使用的代码.仅打印printf语句.没有错误或警告.
This is the code i am using. Only the printf statement is being printed.There is no error or warning.
推荐答案
您正在使用C语言中的igraph,而igraph的C核心完全缺乏绘图功能. (这是故意的).如果要绘制图形,则必须使用igraph的Python或R绑定.在Python和R模块中,绘图是在C核心库的顶部实现的.
You are using igraph from C, and the C core of igraph completely lacks plotting capabilities. (This is deliberate). If you want to plot graphs, you have to use igraph's Python or R bindings; in the Python and R modules, plotting is implemented on top of the C core library.
这篇关于IGraph中没有显示任何图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!