igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] number of nodes


From: Gábor Csárdi
Subject: Re: [igraph] number of nodes
Date: Wed, 25 Nov 2009 22:09:54 +0100

Could you please start a new thread for a new question? Thanks.

As for your code, the vector 'fixed' is not initialized, and 'initial'
is not initialized, either.

Gabor

On Wed, Nov 25, 2009 at 9:37 PM, Roberto Pagliari <address@hidden> wrote:
> I have a last question about clustering. I can't get the code to work, I
> always get "Assertion failed: (v->stor_begin != NULL), function
> igraph_vector_bool_size, file vector.pmt, line 449.
> Abort trap"
> The code is this
>
> #include <iostream.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <igraph.h>
>
> int main(void) {
> igraph_t graph;
> FILE *myfile;
> igraph_vector_t membership;
> igraph_vector_t weights;
> igraph_vector_t initial;
> igraph_vector_bool_t fixed;
> igraph_integer_t num_nodes, num_edges;
> myfile = fopen("europe.gml", "r");
> igraph_read_graph_gml(&graph, myfile);
> fclose(myfile);
> num_nodes = igraph_vcount(&graph);
> igraph_vector_init(&membership, num_nodes);
> num_edges = igraph_ecount(&graph);
> igraph_vector_init(&weights, num_edges);
>   for(int i=0; i<igraph_vector_size(&weights); i++)
> {
> VECTOR(weights)[i] = 1;
> /* VECTOR(initial)[i] = i;
> VECTOR(fixed)[i] = 0;*/
>   }
> igraph_community_label_propagation(&graph, &membership, &weights, &initial,
> &fixed);
> cout << "Number of nodes: " << num_nodes << "\n Number of edges: " <<
> num_edges << "\n";
> igraph_vector_destroy(&membership);
> igraph_vector_destroy(&weights);
> igraph_destroy(&graph);
> return 0;
> }
>
>
> On Wed, Nov 25, 2009 at 12:19 PM, Roberto Pagliari <address@hidden>
> wrote:
>>
>> for some reasons if I declare graph as igraph_t graph and use &graph, it
>> works
>>
>> On Wed, Nov 25, 2009 at 12:17 PM, Roberto Pagliari <address@hidden>
>> wrote:
>>>
>>> the code I used is this
>>>
>>> int main(void) {
>>> igraph_t *graph;
>>> FILE *myfile;
>>> igraph_vector_t *membership;
>>> igraph_vector_t *weights;
>>> igraph_vector_t *initial;
>>> igraph_vector_bool_t *fixed;
>>> int num_nodes;
>>> myfile = fopen("europe.gml", "r");
>>> igraph_read_graph_gml(graph, myfile);
>>> num_nodes = igraph_vcount(graph);
>>> // printf("number of nodes: %f\n", igraph_vcount(graph));
>>> // igraph_community_label_propagation(graph, )
>>> fclose(myfile);
>>> return 0;
>>> }
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

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