igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] graph components


From: zhengjun chen
Subject: Re: [igraph] graph components
Date: Wed, 25 Nov 2009 16:12:03 -0500

It can work. Thanks.

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



--
Thanks
zhengjun

Graduate research assistant
Dept of Computer Science and Engineering
Lehigh University

reply via email to

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