【发布时间】:2015-05-17 23:55:14
【问题描述】:
我想使用 igraph_degree_sequence_game igraph 图生成器来生成网络。 igraph C 库上的示例在我的计算机上运行良好,但是如果我更改为其他一些简单的度数分布(请参见下面的代码),则会出现此错误:
Error at games.c:830 :degree sequence game (simple), Out of memory.
我希望这给了我一个有 4 个节点的无向网络,每个节点都有 3 个邻居。我不知道我哪里做错了。感谢您的友好帮助和回复。
#include <igraph.h>
int main() {
igraph_t g;
igraph_vector_t outdeg, indeg, vec;
igraph_bool_t is_simple;
igraph_vector_init_real(&outdeg, 4,3,3,3,3);
igraph_vector_init(&vec, 0);
/* checking the simple method, undirected graphs */
igraph_degree_sequence_game(&g, &outdeg, 0, IGRAPH_DEGSEQ_SIMPLE);
if (igraph_is_directed(&g) || igraph_vcount(&g) != 4)
return 1;
if (igraph_degree(&g, &vec, igraph_vss_all(), IGRAPH_OUT, 1))
return 2;
igraph_vector_print(&vec);
igraph_destroy(&g);
igraph_vector_destroy(&vec);
igraph_vector_destroy(&outdeg);
igraph_vector_destroy(&indeg);
return 0;
}
【问题讨论】: