删除图表中的边缘为C.

我试图删除一个随机选择的边缘形成一个名为“g”的igraph( http://igraph.org/c/ )图形。

Igraph的“igraph_delete_edges”函数手册在这里: http ://igraph.org/c/doc/igraph-Basic.html#igraph_delete_edges但是我仍然不能弄清楚它。

我有这个:

#include  #include  int main() { igraph_t g; igraph_vector_t v; igraph_vector_t edges; igraph_vector_init(&edges,0); igraph_vector_t indices; igraph_vector_init(&indices, 0); igraph_erdos_renyi_game(&g, IGRAPH_ERDOS_RENYI_GNP, 100, .10,IGRAPH_UNDIRECTED, IGRAPH_NO_LOOPS); // Create a random graph igraph_get_edgelist(&g, &edges, 0); // Put the graph's list of indices in "edges" int r = rand() % igraph_vector_size(&edges); // Get a random edge index igraph_vector_push_back(&indices, r); // create a vector of size 1 in which to put the random index found above igraph_delete_edges(&g, igraph_es_vector(&indices)); // Delete that edge } 

这似乎不是使用igraph_delete_edges的方式(对于这样一个简单的操作肯定非常冗长……)在igraph中使用igraph_delete_edges的正确方法是什么?