igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] graph components


From: Tamas Nepusz
Subject: Re: [igraph] graph components
Date: Wed, 25 Nov 2009 20:55:36 +0000

> 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





reply via email to

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