I want to read in pajek files and analyse these networks iteratively, for which I need to have access to the attributes (id, weight).
However, I've noticed that a problem turns up when the attribute handler is attached. After reading or generating multiple graphs iteratively, the program crashes. See code below for an example.
#include <stdio.h> #include <stdlib.h> #include "/usr/local/include/igraph/igraph.h" // change to path of igraph.h
int main(){ // attach handler (note: without handler, program runs fine)
igraph_i_set_attribute_table(&igraph_cattribute_table);
// if more than 30 iterations, program crashes if attribute handler is attached int iterations = 50;
int i; for(i=0;i<iterations;i++){
igraph_t graph; igraph_star(&graph, 5, IGRAPH_STAR_UNDIRECTED, 1);
int num_vertices = igraph_vcount(&graph); printf("Iteration %d:\tNumber of Vertices: %d\n",i,num_vertices);
// access attributes here...
igraph_destroy(&graph); }
return 0; }
/// output $ ./attrhandl Iteration 0: Number of Vertices: 5 Iteration 1: Number of Vertices: 5
Iteration 2: Number of Vertices: 5 ... ... ... Iteration 29: Number of Vertices: 5 Iteration 30: Number of Vertices: 5 attrhandl: error.c:122: IGRAPH_FINALLY_REAL: Assertion `no<100' failed.
Aborted (core dumped) $