On Wed, Nov 25, 2009 at 3:55 PM, Tamas Nepusz
<address@hidden> wrote:
> I want to calculate the number of components in an undirected graph.
> I use the function in such way:
> igraph_integer_t num; // it is used to store the number of components
> igraph_clusters(&graph,NULL,&clusters,&num,IGRAPH_WEAK);
> printf("number of components: %d\n",num);
>
> But it always shows "number of components is: 0". Actually the number of components in my graph is two.
igraph_integer_t is a typedef to double. (I know, it is confusing). Therefore, you will have to cast it to an int explicitly when using it in printf:
printf("number of components: %d\n", (int)num);
--
Tamas
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help