[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Problem: Attribute handler in C

From: Walter de Back - Collegium Budapest
Subject: [igraph] Problem: Attribute handler in C
Date: Sun, 25 May 2008 14:02:42 +0200


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.

Now, I realize that the attribute handler from C is experimental, but I hope you can help me.

Is there a way to circumvent this problem? Or am I doing something wrong in the code below?

Thanks in advance,


    gcc attrhandl.c -I/usr/local/igraph -L/usr/local/lib -ligraph -o attrhandl   

#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)

    // if more than 30 iterations, program crashes if attribute handler is attached
    int iterations = 50; 

    int 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...


    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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]