|
From: | ketan bhardwaj |
Subject: | Re: [igraph] Using basic querry commands for Igraph |
Date: | Fri, 22 May 2009 17:52:59 +0530 |
/* create and write the read graph from and to file*/
DO("Creating Graph from file state_machine.txt...\n");
res = igraph_read_graph_edgelist(&graph,ipFile,5,IGRAPH_DIRECTED);
EXPECT(res,IGRAPH_SUCCESS);
DO("Writing the read graph to read_state_machine.txt...\n");
res = igraph_write_graph_edgelist(&graph,opFile);
EXPECT(res,IGRAPH_SUCCESS);
DO("Getting No. of vertices ...\n");
nbVertex = igraph_vcount(&graph);
printf("No. of vertex = %d \n",nbVertex);
EXPECT(nbVertex,5);
DO("Getting No. of Edges ...\n");
nbEdges = igraph_ecount(&graph);
printf("No. of edges = %d\n",nbEdges);
EXPECT(nbEdges,12);
DO("Destroying the graph...\n");
res = igraph_destroy(&graph);
EXPECT(res,IGRAPH_SUCCESS);
//close open files
DO("Closing Files ... \n");
if(ipFile != NULL)
fclose(ipFile);
if(opFile !=NULL)
fclose(opFile);
DO("----------Done---------------\n");
END:
return 1;
}
Ketan, this is hard to answer if you don't show us what you did exactly.
Best,
Gabor
> _______________________________________________
On Fri, May 22, 2009 at 1:51 PM, ketan bhardwaj <address@hidden> wrote:
> Hello all,
>
> This is what i am doing :
> Create a graph using
> igraph_read_graph_edgelist()
>
> and counting the number of edges using igraph_ecount() but getting zero.
>
> here are the contents of file i am using
> 0 1 0 2 0 3 0 4 0 5 1 2 2 1 2 3 3 2 2 4 4 2 3 4 4 3
>
> Here are the contents of the file which i get from
> igraph_write_graph_edgelist()
>
> 0 1
>
> 0 2
>
> 0 3
>
> 0 4
>
> 0 5
>
> 1 2
>
> 2 1
>
> 2 3
>
> 2 4
>
> 3 2
>
> 3 4
>
> 4 2
>
> 4 3
> i think this is exactly right but why am i not be able to get the number of
> vertices.? any help.
>
> regards
> ketan
> --
> To get a comprehensive view of my work Please visit
> http://ketanbj.googlepages.com
>
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
--
Gabor Csardi <address@hidden> UNIL DGM
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |